背景:
项目前期是在一台服务器建立了两个实例,客户端配置两个连接,现在需要把两个实例整合其中一个实例中去,要求不更改客户端的配置。
例如
整合前有test,standby2两个实例
整合后只有standby2这个实例
之前在RAC上用srvctl配置过,还没有在单实例上配置,现在具体操作整理如下:
1、创建服务
exec dbms_service.create_service('test','test');
select t.name,t.NETWORK_NAME from v$services t;
standby2,standby2
2、设置服务立即生效
alter system set service_names='standby2,test' ;
select t.name,t.NETWORK_NAME from v$services t;
standby2,standby2
test,test
3、重新加载监听
[oracle@standby2 ~]$ lsnrctl reload
[oracle@standby2 ~]$ lsnrctl status;
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 15-SEP-2014 12:52:32
copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=standby2)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 15-SEP-2014 12:39:28
Uptime 0 days 0 hr. 13 min. 4 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/standby2/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=standby2)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "test" has 1 instance(s).
Instance "standby2", status READY, has 1 handler(s) for this service...
Service "standby2" has 1 instance(s).
Instance "standby2", status READY, has 1 handler(s) for this service...
Service "standby2_DGMGRL" has 1 instance(s).
Instance "standby2", status UNKNowN, has 1 handler(s) for this service...
The command completed successfully
以上就是在standby2监控的两个服务standby2,test
5、测试
以上只是说明了在不更改客户端配置的情况可下,怎么样保存应用的正常访问。至于怎么把实例test整合到standby2中并没有详细介绍,过程如下:
a、创建test实例所用到的用户及授权
b、创建test实例所需要的表空间
c、从test实例导出数据
b、导入数据到standby2实例
f、参考第5点测试