expert中文版中关于sqlplus登陆脚本的一处错误

今天看了expert one on one,在序言部分,tom建议修改sqlplus的登陆脚本,使得登陆者能够很清楚的看到自己的登陆的用户名和服务。其中修改的脚本如下:

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
select lower(user) || ‘@’ ||
decode(global_name, ‘ORACLE8.WORLD’, ‘8.0’, ‘ORA8I.WORLD’,
‘8i’, global_name ) global_name from global_name;
set sqlprompt ‘&gname> ‘
set termout on
在这里需要说明的是,中文版的expert one on one中有一个错误:他把
set pagesize 9999
column plan_plus_exp format a80写成了
set pagesize 9999 column plan_plus_exp format a80两行写在了一行,这时候,登陆的时候就会报错:SP2-0158: 未知的SET选项"column"。因此,在这里我们如果要修改sqlplus的登陆脚本,我们必须将这个分开来写,而且更好的做法是,备份原来的glogin.sql脚本成glogin_bak.sql,在原来的glogin.sql后面添加。

下面是修改后完整的glogin.sql脚本:


— Copyright (c) Oracle Corporation 1988, 2000. All Rights Reserved.

— NAME
— glogin.sql

— DESCRIPTION
— SQL*Plus global login startup file.

— Add any sqlplus commands here that are to be executed when a user
— starts SQL*Plus on your system

— USAGE
— This script is automatically run when SQL*Plus starts

— For backward compatibility
SET PAGESIZE 14
SET SQLPLUSCOMPATIBILITY 8.1.7

— Used by Trusted Oracle
COLUMN ROWLABEL FORMAT A15

— Used for the SHOW ERRORS command
COLUMN LINE/COL FORMAT A8
COLUMN ERROR FORMAT A65 WORD_WRAPPED

— Used for the SHOW SGA command
COLUMN name_col_plus_show_sga FORMAT a24

— Defaults for SHOW PARAMETERS
COLUMN name_col_plus_show_param FORMAT a36 HEADING NAME
COLUMN value_col_plus_show_param FORMAT a30 HEADING VALUE

— Defaults for SET AUTOTRACE EXPLAIN report
COLUMN id_plus_exp FORMAT 990 HEADING i
COLUMN parent_id_plus_exp FORMAT 990 HEADING p
COLUMN plan_plus_exp FORMAT a60
COLUMN object_node_plus_exp FORMAT a8
COLUMN other_tag_plus_exp FORMAT a29
COLUMN other_plus_exp FORMAT a44

— SET SQLPROMTP USER@SID>
–chage by jimmyhe1981 at 20060624
COLUMN inst_name new_value gname
set termout off
select lower(user)||’@’||instance_name inst_name from v$instance;
set sqlprompt’&gname>’;
set termout on

相关文章

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据