修改sqlplus預設環境設定

ittangzeng發表於2014-05-28
1:sqlplus 的預設環境設定
There are two startup files for SQL*Plus:
GLOGIN.SQL, which is the global startup file
LOGIN.SQL,  which is designed for local and individual use
Whenever any user starts SQL*Plus, first the GLOGIN.SQL file is read, followed by the user's LOGIN.SQL file.


2:測試
$ORACLE_HOME/sqlplus/admin/glogin.sql
define base=/u01/
define gvar=glogin


~/login.sql
define data=&base/oradata
define gvar=login


SQL> select '&base' from dual;
old   1: select '&base' from dual
new   1: select '/u01/' from dual


'/U01
-----
/u01/


SQL> select '&data' from dual;
old   1: select '&data' from dual
new   1: select '/u01//oradata' from dual


'/U01//ORADAT
-------------
/u01//oradata


SQL> select '&gvar' from dual;
old   1: select '&gvar' from dual
new   1: select 'login' from dual


'LOGI
-----
login

3:總結:
(2)中的測試驗證了(1)中的描述。

實際應用
(1)修改sqlplus的提示符和sqlplus命令編輯工具
$ORACLE_HOME/sqlplus/admin/glogin.sql
set sqlprompt "_user'@'_connect_identifier> "
define_editor='vi'

還可以在glogin.sql 和 loging.sql常見的使用習慣設定。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29497382/viewspace-1171624/,如需轉載,請註明出處,否則將追究法律責任。

相關文章