分类: Oracle
2010-04-12 23:24:39
1,先定义SQLPATH这样系统登录时自动去这个路径下寻找login.sql文件
export SQLPATH=/opt/oracle/admin/mc/pfile
2,查看login.sql的内容
oracle@mmloyal [/opt/oracle/admin/mc/pfile]# vi login.sql
define _editor=vi <==指定默认的编辑器
set serveroutput on size 1000000 <==默认打开DBMS_OUTPUT;设置默认缓冲区尽可能大
set trimspool on <==假脱机输出文本时,会去除文本行两端的空格,而且行宽不定。
set long 5000 <==设置选择 LONG 和 CLOB 列时显示的默认字节数。
set linesize 100 <==设置 SQL*Plus 显示的文本行宽为 100 个字符。
set pagesize 9999 <==PAGESIZE 可以控制 SQL*Plus 多久打印一次标题
column plan_plus_exp format a80 <==设置由 AUTOTRACE 得到的解释计划输出(explain plan output)
的默认宽度。 A80 通常足以放下整个计划。
column global_name new_value gname <==
set termout off <==
define gname=SQL <==定义一个默认标识符“SQL”
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
3,显示后的效果:
SQL> conn /as sysdba
Connected.
sys@MC> <==运行后的效果
4,附录login.sql干净内容
define _editor=vi
set serveroutput on size 1000000
set trimspool on
set long 5000
set linesize 100
set pagesize 9999
column plan_plus_exp format a80
column global_name new_value gname
set termout off
define gname=SQL
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