转载链接
oracle之修改服务名
如何修改 service_name原有环境:
sid: mynewdb
global_name:mynewdb
service_names: MYNEWDB
db_domain :
db_name:mynewdb
需要修改如下:
global_name:mynewdb
service_names: test
db_domain :
db_name:mynewdb
服务器端:
alter system set service_names='test';
这里采用静态注册,同时还要修改下 listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME =/u01/app/oracle/product/11.2.0/dbhome_1)
(PROGRAM = extproc)
)
(SID_DESC=
(GLOBAL_DBNAME = mynewdb)
(ORALCE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = mynewdb)
)
(SID_DESC=
(GLOBAL_DBNAME = test) -------这个是需要添加
(ORALCE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = mynewdb) ------这个还是原来的实例名
)
)
cmd下执行命令lsnrctl reload
查看监听状态
lsnrctl status
LSNRCTL>
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.80.11.202)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for [Linux](https://www.2cto.com/os/linux/): Version 11.2.0.1.0 - Production
Start Date 21-NOV-2013 00:09:35
Uptime 0 days 20 hr. 30 min. 55 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/oracle11g/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.80.11.202)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "mynewdb" has 1 instance(s).
Instance "mynewdb", status UNKNOWN, has 1 handler(s) for this service...
Service "test" has 1 instance(s).
Instance "mynewdb", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
可以看到新的 Service "test" 已经可以使用了
客户端配置:
net manager 配置 服务名为 test ,ip为数据库服务器主机ip,相应端口。
测试连接:
SQL> conn sys/oracle@test as sysdba
已连接。
SQL>
当然不使用静态注册,动态注册也可以