用户每次登录sql*plus的时候都会调用$ORACLE_HOME/sqlplus/admin/glogin.sql文件。我们可以修改这个文件,使得每次登录时都设置好一些sql*plus的环境变量,并将默认显示的SQL>改为显示登录的用户名和登录的数据库实例名
下面是在Thomas Kyte大师的基础上自己做了些修改(Windows平台适用,如果是Unix平台将define _editor=notepad改为define _editor=vi即可)
define _editor=notepad
set line 150
set pagesize 9999
set long 5000
set serveroutput on size 1000000
col object_name for a30
col name for a30
col segment_name for a30
col file_name for a50
col event for a40
col value for a40
define gname=idle
column global_name new_value gname
set termout off
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