Change the face for SQLPLUS - Automatically display SID and connected User in Sql*Plus

Show the name of instance on startup of sqlplus

set termout off
define gname=idle
column global_name new_value gname
select lower(user)||’@’ ||substr(global_name,1,decode(dot,0,length(global_name),dot-1)) global_name from (select global_name, instr(global_name,’.') dot from global_name);
set sqlprompt ‘&gname>’
set termout on

Put this code on file “glogin.sql” in your $ORACLE_HOME/sqlplus/admin 

before
SQL>show user
USER is “SYS”
SQL>

After
sys@ORCL>show user
USER is “SYS”
sys@ORCL>


Comentários