11g RAC 基本命令管理

来源:互联网 发布:女声变男声软件 编辑:程序博客网 时间:2024/06/06 17:21

1.查看当前集群状态

[grid@rac1 ~]$ crs_stat -tName           Type           Target    State     Host        ------------------------------------------------------------ora.DATA.dg    ora....up.type ONLINE    ONLINE    rac1        ora.GRID.dg    ora....up.type ONLINE    ONLINE    rac1        ora....ER.lsnr ora....er.type ONLINE    ONLINE    rac1        ora....N1.lsnr ora....er.type ONLINE    ONLINE    rac2        ora....VERY.dg ora....up.type ONLINE    ONLINE    rac1        ora.asm        ora.asm.type   ONLINE    ONLINE    rac1        ora.cvu        ora.cvu.type   ONLINE    ONLINE    rac2        ora.gsd        ora.gsd.type   OFFLINE   OFFLINE               ora....network ora....rk.type ONLINE    ONLINE    rac1        ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    rac1        ora.ons        ora.ons.type   ONLINE    ONLINE    rac1        ora.rac.db     ora....se.type ONLINE    ONLINE    rac1        ora....SM1.asm application    ONLINE    ONLINE    rac1        ora....C1.lsnr application    ONLINE    ONLINE    rac1        ora.rac1.gsd   application    OFFLINE   OFFLINE               ora.rac1.ons   application    ONLINE    ONLINE    rac1        ora.rac1.vip   ora....t1.type ONLINE    ONLINE    rac1        ora....SM2.asm application    ONLINE    ONLINE    rac2        ora....C2.lsnr application    ONLINE    ONLINE    rac2        ora.rac2.gsd   application    OFFLINE   OFFLINE               ora.rac2.ons   application    ONLINE    ONLINE    rac2        ora.rac2.vip   ora....t1.type ONLINE    ONLINE    rac2        ora.scan1.vip  ora....ip.type ONLINE    ONLINE    rac2

 

2.各个状态检查

 

1)cluster 状态

[grid@rac1 ~]$ crsctl check clusterCRS-4537: Cluster Ready Services is onlineCRS-4529: Cluster Synchronization Services is onlineCRS-4533: Event Manager is online

 

crs没online

[grid@rac1 ~]$ crsctl check clusterCRS-4535: Cannot communicate with Cluster Ready Services----看这行,有时需要耐心等待CRS-4529: Cluster Synchronization Services is onlineCRS-4533: Event Manager is online

 

当crs服务没online时会报这个错

[grid@rac1 ~]$ crs_stat -tCRS-0184: Cannot communicate with the CRS daemon.

 

当耐心等待过后,crs还是没online的话,那需要通过root用户重启CLUSTER,别的用户没权限

 

2)nodeapp状态

nodeapp包括GSD,ONS,VIP,LISTENER

[grid@rac1 ~]$ srvctl status nodeappsVIP rac1-vip is enabledVIP rac1-vip is running on node: rac1VIP rac2-vip is enabledVIP rac2-vip is running on node: rac2Network is enabledNetwork is running on node: rac1Network is running on node: rac2GSD is disabled-----------------------------GSD是CRS用于跟9i RAC进行通信的一个模块,为了向后兼容所保留的,默认是disableGSD is not running on node: rac1GSD is not running on node: rac2ONS is enabledONS daemon is running on node: rac1ONS daemon is running on node: rac2

 

3)ASM 状态

[grid@rac1 ~]$ srvctl status ASMASM is running on rac2,rac1

 

4)数据库状态

[grid@rac1 ~]$ srvctl status database -d racInstance rac1 is running on node rac1Instance rac2 is running on node rac2

 

亦可以查看单个实例状态

[grid@rac1 ~]$ srvctl status instance -d rac -i rac1Instance rac1 is running on node rac1[grid@rac1 ~]$ srvctl status instance -d rac -i rac2Instance rac2 is running on node rac2

 

5)监听状态

[grid@rac1 ~]$ srvctl status listenerListener LISTENER is enabledListener LISTENER is running on node(s): rac2,rac1

 

3.手工关闭RAC

在Oracle 11gR2 下的RAC,架构发生了变化。CRS的信息也是放在ASM 实例里的,所以要关asm,必须关闭crs, 如果还使用了acfs的话,一关crs那么acfs里的信息也不能访问了,所以一般不重启机器,不轻易关crs, 其他的service可以根据自己的需要去stop/start

1)关闭TNS监听

2)关闭数据库

3)关闭集群软件(VIP,SCAN_LISTENER,CVU,SCAN_VIP,ONS,NETWORK,ASM)

[grid@rac1 ~]$ srvctl stop listener
[grid@rac1 ~]$ srvctl stop instance -d rac -i rac1
[grid@rac1 ~]$ srvctl stop instance -d rac -i rac2
[root@rac1 bin]# ./crsctl stop cluster  -----------以root用户执行,该命令只会对该节点起作用,假如,关闭节点一,你会看到所有应用都会飘到节点二
[root@rac2 bin]# ./crsctl stop cluster

 

 

4.手工启动RAC

1)启动集群软件----11g集群启动较慢,需耐心等待,先看cluster是否online,再去crs_stat -t 不断刷新就会看到各应用会慢慢拉起online

2)启动数据库

3)启动TNS监听

 

启动集群软件

[root@rac1 bin]# ./crsctl start cluster
[root@rac2 bin]# ./crsctl start cluster
 
cluster状态
[grid@rac1 ~]$ crsctl check clusterCRS-4537: Cluster Ready Services is onlineCRS-4529: Cluster Synchronization Services is onlineCRS-4533: Event Manager is online

 

启动数据库

[grid@rac1 ~]$ srvctl start instance -d rac -i rac1
[grid@rac1 ~]$ srvctl start instance -d rac -i rac2

 

启动TNS监听

[grid@rac1 ~]$ srvctl start listener

 

最终状态

[grid@rac1 ~]$ crs_stat -tName           Type           Target    State     Host        ------------------------------------------------------------ora.DATA.dg    ora....up.type ONLINE    ONLINE    rac1        ora.GRID.dg    ora....up.type ONLINE    ONLINE    rac1        ora....ER.lsnr ora....er.type ONLINE    ONLINE    rac1        ora....N1.lsnr ora....er.type ONLINE    ONLINE    rac1        ora....VERY.dg ora....up.type ONLINE    ONLINE    rac1        ora.asm        ora.asm.type   ONLINE    ONLINE    rac1        ora.cvu        ora.cvu.type   ONLINE    ONLINE    rac1        ora.gsd        ora.gsd.type   OFFLINE   OFFLINE               ora....network ora....rk.type ONLINE    ONLINE    rac1        ora.oc4j       ora.oc4j.type  OFFLINE   OFFLINE               ora.ons        ora.ons.type   ONLINE    ONLINE    rac1        ora.rac.db     ora....se.type ONLINE    ONLINE    rac2        ora....SM1.asm application    ONLINE    ONLINE    rac1        ora....C1.lsnr application    ONLINE    ONLINE    rac1        ora.rac1.gsd   application    OFFLINE   OFFLINE               ora.rac1.ons   application    ONLINE    ONLINE    rac1        ora.rac1.vip   ora....t1.type ONLINE    ONLINE    rac1        ora....SM2.asm application    ONLINE    ONLINE    rac2        ora....C2.lsnr application    ONLINE    ONLINE    rac2        ora.rac2.gsd   application    OFFLINE   OFFLINE               ora.rac2.ons   application    ONLINE    ONLINE    rac2        ora.rac2.vip   ora....t1.type ONLINE    ONLINE    rac2        ora.scan1.vip  ora....ip.type ONLINE    ONLINE    rac1

       

单节点执行./crsctl stop crs,验证该命令只对改节点生效

[root@rac1 bin]# ./crsctl stop crsCRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on 'rac1'CRS-2673: Attempting to stop 'ora.crsd' on 'rac1'CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on 'rac1'CRS-2673: Attempting to stop 'ora.GRID.dg' on 'rac1'CRS-2673: Attempting to stop 'ora.rac.db' on 'rac1'CRS-2673: Attempting to stop 'ora.LISTENER_SCAN1.lsnr' on 'rac1'CRS-2673: Attempting to stop 'ora.LISTENER.lsnr' on 'rac1'CRS-2673: Attempting to stop 'ora.cvu' on 'rac1'CRS-2677: Stop of 'ora.LISTENER_SCAN1.lsnr' on 'rac1' succeededCRS-2673: Attempting to stop 'ora.scan1.vip' on 'rac1'CRS-2677: Stop of 'ora.LISTENER.lsnr' on 'rac1' succeededCRS-2673: Attempting to stop 'ora.rac1.vip' on 'rac1'CRS-2677: Stop of 'ora.scan1.vip' on 'rac1' succeededCRS-2672: Attempting to start 'ora.scan1.vip' on 'rac2'CRS-2677: Stop of 'ora.rac1.vip' on 'rac1' succeededCRS-2672: Attempting to start 'ora.rac1.vip' on 'rac2'CRS-2677: Stop of 'ora.cvu' on 'rac1' succeededCRS-2672: Attempting to start 'ora.cvu' on 'rac2'CRS-2676: Start of 'ora.rac1.vip' on 'rac2' succeededCRS-2676: Start of 'ora.scan1.vip' on 'rac2' succeededCRS-2677: Stop of 'ora.rac.db' on 'rac1' succeededCRS-2673: Attempting to stop 'ora.DATA.dg' on 'rac1'CRS-2673: Attempting to stop 'ora.RECOVERY.dg' on 'rac1'CRS-2672: Attempting to start 'ora.LISTENER_SCAN1.lsnr' on 'rac2'CRS-2676: Start of 'ora.cvu' on 'rac2' succeededCRS-2676: Start of 'ora.LISTENER_SCAN1.lsnr' on 'rac2' succeededCRS-2677: Stop of 'ora.RECOVERY.dg' on 'rac1' succeededCRS-2677: Stop of 'ora.DATA.dg' on 'rac1' succeededCRS-2677: Stop of 'ora.GRID.dg' on 'rac1' succeededCRS-2673: Attempting to stop 'ora.asm' on 'rac1'CRS-2677: Stop of 'ora.asm' on 'rac1' succeededCRS-2673: Attempting to stop 'ora.ons' on 'rac1'CRS-2677: Stop of 'ora.ons' on 'rac1' succeededCRS-2673: Attempting to stop 'ora.net1.network' on 'rac1'CRS-2677: Stop of 'ora.net1.network' on 'rac1' succeededCRS-2792: Shutdown of Cluster Ready Services-managed resources on 'rac1' has completedCRS-2677: Stop of 'ora.crsd' on 'rac1' succeededCRS-2673: Attempting to stop 'ora.mdnsd' on 'rac1'CRS-2673: Attempting to stop 'ora.ctssd' on 'rac1'CRS-2673: Attempting to stop 'ora.evmd' on 'rac1'CRS-2673: Attempting to stop 'ora.asm' on 'rac1'CRS-2677: Stop of 'ora.evmd' on 'rac1' succeededCRS-2677: Stop of 'ora.ctssd' on 'rac1' succeededCRS-2677: Stop of 'ora.mdnsd' on 'rac1' succeededCRS-2677: Stop of 'ora.asm' on 'rac1' succeededCRS-2673: Attempting to stop 'ora.cluster_interconnect.haip' on 'rac1'CRS-2677: Stop of 'ora.cluster_interconnect.haip' on 'rac1' succeededCRS-2673: Attempting to stop 'ora.cssd' on 'rac1'CRS-2677: Stop of 'ora.cssd' on 'rac1' succeededCRS-2673: Attempting to stop 'ora.crf' on 'rac1'CRS-2677: Stop of 'ora.crf' on 'rac1' succeededCRS-2673: Attempting to stop 'ora.gipcd' on 'rac1'CRS-2677: Stop of 'ora.gipcd' on 'rac1' succeededCRS-2673: Attempting to stop 'ora.gpnpd' on 'rac1'CRS-2677: Stop of 'ora.gpnpd' on 'rac1' succeededCRS-2793: Shutdown of Oracle High Availability Services-managed resources on 'rac1' has completedCRS-4133: Oracle High Availability Services has been stopped.
 

资源状态(全都飘到节点二)

[grid@rac2 ~]$ crs_stat -tName           Type           Target    State     Host        ------------------------------------------------------------ora.DATA.dg    ora....up.type ONLINE    ONLINE    rac2        ora.GRID.dg    ora....up.type ONLINE    ONLINE    rac2        ora....ER.lsnr ora....er.type ONLINE    ONLINE    rac2        ora....N1.lsnr ora....er.type ONLINE    ONLINE    rac2        ora....VERY.dg ora....up.type ONLINE    ONLINE    rac2        ora.asm        ora.asm.type   ONLINE    ONLINE    rac2        ora.cvu        ora.cvu.type   ONLINE    ONLINE    rac2        ora.gsd        ora.gsd.type   OFFLINE   OFFLINE               ora....network ora....rk.type ONLINE    ONLINE    rac2        ora.oc4j       ora.oc4j.type  OFFLINE   OFFLINE               ora.ons        ora.ons.type   ONLINE    ONLINE    rac2        ora.rac.db     ora....se.type ONLINE    ONLINE    rac2        ora.rac1.vip   ora....t1.type ONLINE    ONLINE    rac2        ora....SM2.asm application    ONLINE    ONLINE    rac2        ora....C2.lsnr application    ONLINE    ONLINE    rac2        ora.rac2.gsd   application    OFFLINE   OFFLINE               ora.rac2.ons   application    ONLINE    ONLINE    rac2        ora.rac2.vip   ora....t1.type ONLINE    ONLINE    rac2        ora.scan1.vip  ora....ip.type ONLINE    ONLINE    rac2
 

 

5.srvctl 帮助

[grid@rac2 ~]$ srvctl -h

 

6.crsctl 帮助

[grid@rac2 ~]$ crsctl -h
原创粉丝点击