??? 每次登录sql*plus的时候都会调用$ORACLE_HOME/sqlplus/admin /glogin.sql文件。我们可以修改这个文件,使得每次登录时都设置好一些sql*plus的环境变量,并将默认显示的SQL>改为显示登录的用户名和登录的数据库实例名,这样可以避免误操作,呵呵。
?
??? 下面是在Thomas Kyte大师的基础上自己做了些修改(Windows平台适用,如果是Unix平台将define _editor=notepad改为define _editor=vi即可)
?
?define _editor=notepadset line 150set pagesize 9999set long 5000set serveroutput on size 1000000col object_name for a30col name for a30col segment_name for a30col file_name for a50col event for a40col value for a40define gname=idlecolumn global_name new_value gnameset termout offselect lower(user)||'@'||substr(global_name,1,decode(dot,0,length(global_name),dot-1)) global_namefrom (select global_name,instr(global_name,'.') dot from global_name);set sqlprompt '&gname>'set termout on
?
?
?
效果:
? ? 引用:小木屋C:\Documents and Settings\Administrator>sqlplus scott/tigerSQL*Plus: Release 10.2.0.1.0 - Production on 星期二 4月 13 11:06:25 2010Copyright (c) 1982, 2005, Oracle. All rights reserved.连接到:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, OLAP and Data Mining options[email protected]>
?
?
?原文地址 http://space.itpub.net/498744/viewspace-310419