1.DBCA创建service
2. srvctl创建service
2. srvctl创建service
--创建service
[oracle@rac01 admin]$ srvctl add service -d mbs -s batch -r mbs2 -a mbs1
--启动service
[oracle@rac01 admin]$ srvctl start service -d mbs -s batch
--查看service运行状态
[oracle@rac01 admin]$ srvctl status database -d mbs -f -v
Instance mbs1 is running on node rac01
Instance mbs2 is running on node rac02 with online services batch
可见batch已经被注册到ocr中,且运行在实例mbs2上,此时关闭实例mbs2,则batch将在实例mbs1上运行。
[oracle@rac01 admin]$ srvctl stop instance -d mbs -i mbs2
[oracle@rac01 admin]$ srvctl status database -d mbs -f -v
Instance mbs1 is running on node rac01 with online services batch
Instance mbs2 is not running on node rac02
重新启动实例mbs2,查看service的运行情况:
[oracle@rac01 admin]$ srvctl start instance -d mbs -i mbs2
[oracle@rac01 admin]$ srvctl status database -d mbs -f -v
Instance mbs1 is running on node rac01 with online services batch
Instance mbs2 is running on node rac02
可见,service仍然运行在实例mbs1上,并没有回到mbs2。手动停止service,并在mbs2上运行service
[oracle@rac01 admin]$ srvctl stop service -d mbs -s batch -i mbs1
[oracle@rac01 admin]$ srvctl status database -d mbs -f -v
Instance mbs1 is running on node rac01
Instance mbs2 is running on node rac02
[oracle@rac01 admin]$ srvctl start service -d mbs -s batch -i mbs2
[oracle@rac01 admin]$ srvctl status database -d mbs -f -v
Instance mbs1 is running on node rac01
Instance mbs2 is running on node rac02 with online services batch
service的使用:
tnsnames.ora里面配置如下:
BATCH =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac01-vip)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = rac02-vip)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = batch)
)
)
[oracle@rac01 admin]$ sqlplus scott/tiger@batch
SQL*Plus: Release 10.2.0.5.0 - Production on Mon Sep 3 14:16:24 2012
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
mbs2
将实例mbs2停止,再重新连接到数据库:
[oracle@rac01 admin]$ srvctl stop instance -d mbs -i mbs2
[oracle@rac01 admin]$ sqlplus scott/tiger@batch
SQL*Plus: Release 10.2.0.5.0 - Production on Mon Sep 3 14:19:04 2012
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> select instance_name from v$instance;
INSTANCE_NAME
----------------
mbs1
此时service已经自动运行到实例mbs1上了。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10972173/viewspace-742540/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/10972173/viewspace-742540/
本文详细介绍了在Oracle RAC环境中如何使用srvctl命令进行服务的创建、启动、停止及状态查询等操作。并通过实例展示了服务如何在不同实例间迁移及故障转移的过程。
601

被折叠的 条评论
为什么被折叠?



