http://ahczl88.blog.163.com/blog/static/22732364201092254029537/
1.添加服务,以支持负载均衡和故障切换
srvctl add service -d racdb -s MYRAC -r 'racdb1' -a 'racdb2' -P PRECONNECT -e SELECT -x TRUE -w 0
2.启动服务
srvctl start service -d racdb -s MYRAC
3.查看配置
srvctl config service -d racdb -s myrac -a
4.把MYRAC服务修改为支持事务级的负载均衡
srvctl modify service -d racdb -s myrac -z 180 -w 5 -m BASIC
srvctl modify service -d racdb -s myrac -B SERVICE_TIME
srvctl modify service -d racdb -s myrac -q TRUE
srvctl modify service -d racdb -s myrac -j SHORT
5.查看配置是否生效
srvctl config service -d racdb -s myrac -a
--------------------------------------------------------------------------------
--- 将myrac服务重新定位到首选实例 ----------
--- 6.srvctl relocate service -d racdb -s myrac -i racdb2 -t racdb1 ----------
--------------------------------------------------------------------------------
7.查看实例命令
select instance_name from v$instance;
8.关闭某个实例
shutdown 和 srvctl stop instance -d dbname -i instance1 -o abort [-f]
9.测试语句
select systate from dual;
select * from all_objects;
10.备注
为了解决两边都能不断的failover,手工地在两个节点上都加上了这个backup services。
SQL> ALTER SYSTEM SET service_names='xxx','yyy','xxx_PRECONNECT','yyy_PRECONNECT';