在SQLPLUS里显示IP、用户名和实例名

方法一:

编辑$ORACLE_HOME/sqlplus/admin/glogin.sql文件在末尾加入下面的内容即可

define  gname = 'SQL'

column global_name new_value gname

set termout off

select utl_inaddr.get_host_address()||':'||lower(user)||'@'||lower(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 termout on

set sqlprompt '&&gname> '

方法二:

编制文件  vim   $ORACLE_HOME/sqlplus/admin/glogin.sql  在最后一行加上

set sqlprompt  _user'@'_connect_identifier>

05-11 22:08