这篇文章给大家分享的是有关Service如何使用referred和avileable固定会话到一个节点并且宕机后会切换到另一个节点的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。 Service使用referred和avileable固定session连接到一台数据库服务器上,这台数据库服务器宕机后会切换到另一台数据库服务器上
管理员管理的DB里,service分为:
– preferred instance:服务启动的时候,在哪个实例上启动,该实例就是preferred instance。
– available instance:服务所在的实例崩溃,集群件会在另外一个available instance里启动该服务。
必须在oracle用户下执行
[root@node1 ~]# srvctl add service -d orcl -s srv1 -r orcl1 -a orcl2
PRCD-1026 : Failed to create service srv1 for database orcl
PRKH-1014 : Current user “root” is not the oracle owner user “oracle” of oracle home “/u01/app/oracle/product/11.2.0/dbhome_1”
[oracle@node1 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 24-AUG-2017 19:56:25
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 – Production
Start Date 24-AUG-2017 19:19:59
Uptime 0 days 0 hr. 36 min. 49 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01免费主机域名/app/grid/diag/tnslsnr/node1/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.92.20)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.92.22)(PORT=1521)))
Services Summary…
Service “+ASM” has 1 instance(s).
Instance “+ASM1”, status READY, has 1 handler(s) for this service…
Service “orcl” has 1 instance(s).
Instance “orcl1”, status READY, has 1 handler(s) for this service…
Service “orclXDB” has 1 instance(s).
Instance “orcl1”, status READY, has 1 handler(s) for this service…
The command completed successfully
[oracle@node2 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 24-AUG-2017 19:55:48
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 – Production
Start Date 24-AUG-2017 19:24:29
Uptime 0 days 0 hr. 31 min. 29 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/node2/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.92.24)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.92.23)(PORT=1521)))
Services Summary…
Service “+ASM” has 1 instance(s).
Instance “+ASM2”, status READY, has 1 handler(s) for this service…
Service “orcl” has 1 instance(s).
Instance “orcl2”, status READY, has 1 handler(s) for this service…
Service “orclXDB” has 1 instance(s).
Instance “orcl2”, status READY, has 1 handler(s) for this service…
The command completed successfully
添加一个service:srv1,orcl1是prefer,orcl2是available:
srvctl add service -d orcl -s srv1 -r orcl1 -a orcl2
srvctl start service -d orcl -s srv1
[oracle@node1 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 24-AUG-2017 20:09:06
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 – Production
Start Date 24-AUG-2017 19:19:59
Uptime 0 days 0 hr. 49 min. 12 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/node1/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.92.20)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.92.22)(PORT=1521)))
Services Summary…
Service “+ASM” has 1 instance(s).
Instance “+ASM1”, status READY, has 1 handler(s) for this service…
Service “orcl” has 1 instance(s).
Instance “orcl1”, status READY, has 1 handler(s)免费主机域名 for this service…
Service “orclXDB” has 1 instance(s).
Instance “orcl1”, status READY, has 1 handler(s) for this service…
Service “srv1” has 1 instance(s).
Instance “orcl1”, status READY, has 1 handler(s) for this service…
The command completed successfully
[oracle@node2 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 24-AUG-2017 20:09:10
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 – Production
Start Date 24-AUG-2017 19:24:29
Uptime 0 days 0 hr. 44 min. 44 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/node2/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.92.24)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.92.23)(PORT=1521)))
Services Summary…
Service “+ASM” has 1 instance(s).
Instance “+ASM2”, status READY, has 1 handler(s) for this service…
Service “orcl” has 1 instance(s).
Instance “orcl2”, status READY, has 1 handler(s) for this service…
Service “orclXDB” has 1 instance(s).
Instance “orcl2”, status READY, has 1 handler(s) for this service…
The command completed successfully
异常关闭orcl1,再过一会,会看到srv1在orcl2上启动了。
[root@node1 ~]# crsctl stop crs
[oracle@node2 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.3.0 – Production on 24-AUG-2017 21:11:40
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 – Production
Start Date 24-AUG-2017 19:24:29
Uptime 0 days 1 hr. 47 min. 28 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/node2/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.92.24)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.92.23)(PORT=1521)))
Services Summary…
Service “+ASM” has 1 instance(s).
Instance “+ASM2”, status READY, has 1 handler(s) for this service…
Service “orcl” has 1 instance(s).
Instance “orcl2”, status READY, has 1 handler(s) for this service…
Service “orclXDB” has 1 instance(s).
Instance “orcl2”, status READY, has 1 handler(s) for this service…
Service “srv1” has 1 instance(s).
Instance “orcl2”, status READY, has 1 handler(s) for this service…
The command completed successfully
可以为服务添加多个preferred实例,这样可以不需要available实例:
srvctl add service -d orcl -s srv2 -r orcl1,orcl2
srvctl start service -d orcl -s srv2
[oracle@node1 ~]$ srvctl status service -d orcl -s srv2
Service srv2 is running on instance(s) orcl1,orcl2
service可以只定义preferred实例,而不定义available实例。但是这样就没有HA了。
这样当service所在的实例崩溃以后,该service不会failover到另外一个实例上去。
把srv1从orcl1上运行,转移到orcl2上运行:
srvctl relocate service -d orcl -s srv1 -i orcl1 -t orcl2
感谢各位的阅读!关于“Service如何使用referred和avileable固定会话到一个节点并且宕机后会切换到另一个节点”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!
相关推荐: 用innobackupex对于全量备份恢复mysql出错的示例分析
这篇文章给大家分享的是有关用innobackupex对于全量备份恢复mysql出错的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。 一、问题描述:用innobackupex对于全量备份恢复mysql。执行如下命令:[mysq…