最近重新安装了oracle rac测试环境,以及两台单实例测试环境;
rac测试环境包括10g,和11g,由于服务器数据量增加有时难免会登陆到错误的服务器,而执行不当操作,为了避免这个情况在sqlplus中,添加数据库服务器的信息提示是一个有效的办法
本机测试结果如下
登陆时:
C:\Users\parameters>sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on 星期日 8月 7 17:59:00 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
GLOBAL_NAME
--------------------------------------------------------------------------------
sys@192.168.0.123:ORCL
sys@192.168.0.123:ORCL>conn scott/tiger
已连接。
GLOBAL_NAME
--------------------------------------------------------------------------------
scott@192.168.0.123:ORCL
scott@192.168.0.123:ORCL>
实现方法:
在$oracle_home/sqlplus/admin下编辑glogin.sql文件,在末尾添加
define gname=idle
column global_name new_value gname
select lower(user)||'@'||nvl(UTL_INADDR.GET_HOST_ADDRESS, SYS_CONTEXT('userenv', 'ip_address'))||':'||
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>'
rac测试环境包括10g,和11g,由于服务器数据量增加有时难免会登陆到错误的服务器,而执行不当操作,为了避免这个情况在sqlplus中,添加数据库服务器的信息提示是一个有效的办法
本机测试结果如下
登陆时:
C:\Users\parameters>sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on 星期日 8月 7 17:59:00 2011
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
GLOBAL_NAME
--------------------------------------------------------------------------------
sys@192.168.0.123:ORCL
sys@192.168.0.123:ORCL>conn scott/tiger
已连接。
GLOBAL_NAME
--------------------------------------------------------------------------------
scott@192.168.0.123:ORCL
scott@192.168.0.123:ORCL>
实现方法:
在$oracle_home/sqlplus/admin下编辑glogin.sql文件,在末尾添加
define gname=idle
column global_name new_value gname
select lower(user)||'@'||nvl(UTL_INADDR.GET_HOST_ADDRESS, SYS_CONTEXT('userenv', 'ip_address'))||':'||
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>'
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25656398/viewspace-704353/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/25656398/viewspace-704353/