首先rac有两大命令crsctl、srvctl
CRSCTL Overview
CRSCTL is an interface between you and Oracle Clusterware, parsing and calling Oracle Clusterware APIs for Oracle Clusterware objects.
Oracle Clusterware 11g release 2 (11.2) introduces cluster-aware commands with which you can perform check, start, and stop operations on the cluster. You can run these commands from any node in the cluster on another node in the cluster, or on all nodes in the cluster, depending on the operation.
You can use CRSCTL commands to perform several operations on Oracle Clusterware, such as:
Starting and stopping Oracle Clusterware resources
Enabling and disabling Oracle Clusterware daemons
Checking the health of the cluster
Managing resources that represent third-party applications
Integrating Intelligent Platform Management Interface (IPMI) with Oracle Clusterware to provide failure isolation support and to ensure cluster integrity
Debugging Oracle Clusterware components
Overview of SRVCTL
Use SRVCTL to manage configuration information. You can use SRVCTL commands to add, remove, start, stop, modify, enable, and disable a number of entities, such as databases, instances, listeners, SCAN listeners, services, grid naming service (GNS), and Oracle ASM.
Some SRVCTL operations modify the configuration data stored in the Oracle Cluster Registry (OCR). SRVCTL performs other operations, such as starting and stopping instances, by sending requests to the Oracle Clusterware process (CRSD), which then starts or stops the Oracle Clusterware resources.
1、prepare for work
C:\Users\Administrator>crs_stat -t
Name Type Target State Host
---------------------------------------------------------
ora.DATA.dg ora....up.type ONLINE ONLINE oradb1
ora.DATA2.dg ora....up.type ONLINE ONLINE oradb1
ora.DATA3.dg ora....up.type ONLINE ONLINE oradb1
ora....ER.lsnr ora....er.type ONLINE ONLINE oradb1
ora....N1.lsnr ora....er.type ONLINE ONLINE oradb1
ora.asm ora.asm.type ONLINE ONLINE oradb1
ora.cvu ora.cvu.type ONLINE ONLINE oradb1
ora.gsd ora.gsd.type ONLINE OFFLINE
ora.infra.db ora....se.type ONLINE ONLINE oradb1
ora....network ora....rk.type ONLINE ONLINE oradb1
ora.oc4j ora.oc4j.type ONLINE ONLINE oradb1
ora.ons ora.ons.type ONLINE ONLINE oradb1
ora....SM1.asm application ONLINE ONLINE oradb1
ora....B1.lsnr application ONLINE ONLINE oradb1
ora.oradb1.gsd application ONLINE OFFLINE
ora.oradb1.ons application ONLINE ONLINE oradb1
ora.oradb1.vip ora....t1.type ONLINE ONLINE oradb1
ora....SM2.asm application ONLINE ONLINE oradb2
ora....B2.lsnr application OFFLINE ONLINE oradb2
ora.oradb2.gsd application ONLINE OFFLINE
ora.oradb2.ons application ONLINE ONLINE oradb2
ora.oradb2.vip ora....t1.type ONLINE ONLINE oradb2
ora....ry.acfs ora....fs.type ONLINE ONLINE oradb1
ora.scan1.vip ora....ip.type ONLINE ONLINE oradb1
2、close database
C:\Users\Administrator>srvctl status database -d infra
Instance infra1 is running on node oradb1
Instance infra2 is running on node oradb2
srvctl stop database -d infra
C:\Users\Administrator>crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.DATA.dg ora....up.type ONLINE ONLINE oradb1
ora.DATA2.dg ora....up.type ONLINE ONLINE oradb1
ora.DATA3.dg ora....up.type ONLINE ONLINE oradb1
ora....ER.lsnr ora....er.type ONLINE ONLINE oradb1
ora....N1.lsnr ora....er.type ONLINE ONLINE oradb1
ora.asm ora.asm.type ONLINE ONLINE oradb1
ora.cvu ora.cvu.type ONLINE ONLINE oradb1
ora.gsd ora.gsd.type ONLINE OFFLINE
ora.infra.db ora....se.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE oradb1
ora.oc4j ora.oc4j.type ONLINE ONLINE oradb1
ora.ons ora.ons.type ONLINE ONLINE oradb1
ora....SM1.asm application ONLINE ONLINE oradb1
ora....B1.lsnr application ONLINE ONLINE oradb1
ora.oradb1.gsd application ONLINE OFFLINE
ora.oradb1.ons application ONLINE ONLINE oradb1
ora.oradb1.vip ora....t1.type ONLINE ONLINE oradb1
ora....SM2.asm application ONLINE ONLINE oradb2
ora....B2.lsnr application OFFLINE ONLINE oradb2
ora.oradb2.gsd application ONLINE OFFLINE
ora.oradb2.ons application ONLINE ONLINE oradb2
ora.oradb2.vip ora....t1.type ONLINE ONLINE oradb2
ora....ry.acfs ora....fs.type ONLINE ONLINE oradb1
ora.scan1.vip ora....ip.type ONLINE ONLINE oradb1
--stop cluster
crsctl stop cluster -all
--check cluster if it's closed
C:\Users\Administrator>crs_stat -t
CRS-0184: Cannot communicate with the CRS daemon.
-- start database
srvctl start database -d infra
C:\Users\Administrator>crs_stat -t
Name Type Target State Host
---------------------------------------------------------
ora.DATA.dg ora....up.type ONLINE ONLINE oradb1
ora.DATA2.dg ora....up.type ONLINE ONLINE oradb1
ora.DATA3.dg ora....up.type ONLINE ONLINE oradb1
ora....ER.lsnr ora....er.type ONLINE ONLINE oradb1
ora....N1.lsnr ora....er.type ONLINE ONLINE oradb2
ora.asm ora.asm.type ONLINE ONLINE oradb1
ora.cvu ora.cvu.type ONLINE ONLINE oradb1
ora.gsd ora.gsd.type ONLINE OFFLINE
ora.infra.db ora....se.type ONLINE ONLINE oradb1
ora....network ora....rk.type ONLINE ONLINE oradb1
ora.oc4j ora.oc4j.type ONLINE ONLINE oradb1
ora.ons ora.ons.type ONLINE ONLINE oradb1
ora....SM1.asm application ONLINE ONLINE oradb1
ora....B1.lsnr application ONLINE ONLINE oradb1
ora.oradb1.gsd application ONLINE OFFLINE
ora.oradb1.ons application ONLINE ONLINE oradb1
ora.oradb1.vip ora....t1.type ONLINE ONLINE oradb1
ora....SM2.asm application ONLINE ONLINE oradb2
ora....B2.lsnr application ONLINE ONLINE oradb2
ora.oradb2.gsd application ONLINE OFFLINE
ora.oradb2.ons application ONLINE ONLINE oradb2
ora.oradb2.vip ora....t1.type ONLINE ONLINE oradb2
ora....ry.acfs ora....fs.type ONLINE ONLINE oradb1
ora.scan1.vip ora....ip.type ONLINE ONLINE oradb2
--stop instance
C:\Users\Administrator>srvctl stop instance -d infra -i infra1
C:\Users\Administrator>srvctl status database -d infra
Instance infra1 is not running on node oradb1
Instance infra2 is running on node oradb2 C:\Users\Administrator>crs_stat -t ora.infra.db ora....se.type ONLINE ONLINE oradb2
C:\Users\Administrator>crs_stat -t
ora.infra.db ora....se.type ONLINE ONLINE oradb2
C:\Users\Administrator>srvctl stop instance -d infra -i infra2
C:\Users\Administrator>srvctl status database -d infra
Instance infra1 is not running on node oradb1
Instance infra2 is not running on node oradb2
C:\Users\Administrator>crs_stat -t
ora.infra.db ora....se.type OFFLINE OFFLINE
------------------------------------
C:\Users\Administrator>srvctl config scan
SCAN name: scan-cluster, Network: 1/10.120.240.0/255.255.240.0/pub
SCAN VIP name: scan1, IP: /scan-cluster/10.120.249.145
C:\Users\Administrator>srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/22193071/viewspace-1131871/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/22193071/viewspace-1131871/