您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

Oracle修改提示符方法

2024/3/1 23:40:03发布24次查看
oracle修改提示符方法sqlplus启动的时候会读取glogin.sql脚本,在$oracle_home/sqlplus/admin目录中,写在里面就可以了。给你个例
oracle修改提示符方法
sqlplus启动的时候会读取glogin.sql脚本,,在$oracle_home/sqlplus/admin目录中,写在里面就可以了。
给你个例子。
[php]
--
-- 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 serveroutput on size 1000000
set trimspool on
set long 5000
set linesize 100
set pagesize 9999
set sqlpluscompatibility 8.1.7
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
-- 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 a80
column object_node_plus_exp format a8
column other_tag_plus_exp format a29
column other_plus_exp format a44
[/php]
d:\temp>;sqlplus
sql*plus: release 9.2.0.4.0 - production on tue dec 16 12:07:06 2003
copyright (c) 1982, 2002, oracle corporation.  all rights reserved.
enter user-name: scott/tiger@ora921.hl3
connected to:
oracle9i enterprise edition release 9.2.0.4.0 - production
with the partitioning, olap and oracle data mining options
jserver release 9.2.0.4.0 - production
welcome to seraphim's sql*plus!
you are connected to ora921.iagent as scott
sql>;
实现这种效果,在glogin.sql中加入以下行:
set heading off
prompt welcome to seraphim's sql*plus!
select 'you are connected to ' || global_name || ' as ' || user from global_name;
set serveroutput on
set heading on

column host_name new_value hname
set termout off
select sys_context('userenv','host') host_name from dual;
set sqlprompt '&hname>;'
set termout on
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product