How to Modify / Set SQLPlus Prompt With Connected Username and SID?

It is always better have the username and the database SID to be set in the sqlplus prompt to avoid confusions. It will be very useful to identify the database where you connected especially your work involved in multiple databases.
        1.   Setting the prompt temporarily with the current connected session.
set sqlprompt "_CONNECT_IDENTIFIER'-'_USER> "
esbtst-SYS>


        2.   Setting the prompt permanently with glogin.sql file.
Add the required format to the glogin.sql file located in $ORACLE_HOME/sqlplus/admin directory.
$ cd $ORACLE_HOME/sqlplus/admin

$ echo set sqlprompt "_USER'@'_CONNECT_IDENTIFIER> ">>glogin.sql

No comments:

Post a Comment