Friday, January 2, 2009

Customize 10g sqlplus prompt

Edit the file $ORACLE_HOME/sqlplus/admin/glogin.sql and add in line as below.
set sqlprompt "_USER'@'_CONNECT_IDENTIFIER> "

When perform sqlplus,
[localhost.localdomain]oracle:> sqlplus user1/user1@ORCL

SQL*Plus: Release 10.2.0.4.0 - Production on Sat Jan 3 15:27:23 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options


user1@ORCL>


This setting can be overwritten if you have login.sql file in the directory where you run sqlplus.
Eg. On my windows client, I have D:\> login.sql and the contents of the file is as below:
set sqlprompt "_USER'@'_CONNECT_IDENTIFIER _DATE> "

When I run sqlplus from D:\ I get output below.
D:\>sqlplus user1/user1@ORCL

SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jan 3 15:31:38 2009
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

user1@ORCL 03-JAN-09>

1 comment:

Tee Chess said...

Thanks for sharing the way to customize the prompt. I have been trying to figure out a way to do this but failed to find one. I will try the method that you have explained above.
sap project system