RAC集群常用管理命令

Posted 元朗蛋卷

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了RAC集群常用管理命令相关的知识,希望对你有一定的参考价值。

1、查看集群栈状态:

[[email protected] ~]$ crsctl check cluster -all
**************************************************************
node1:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************
node2:
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
**************************************************************

2、查看集群的资源:

[[email protected] ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       node1                                        
               ONLINE  ONLINE       node2                                        
ora.FRA.dg
               ONLINE  ONLINE       node1                                        
               ONLINE  ONLINE       node2                                        
ora.LISTENER.lsnr
               ONLINE  ONLINE       node1                                        
               ONLINE  ONLINE       node2                                        
ora.OCRVOTE.dg
               ONLINE  ONLINE       node1                                        
               ONLINE  ONLINE       node2                                        
ora.asm
               ONLINE  ONLINE       node1                    Started             
               ONLINE  ONLINE       node2                    Started             
ora.gsd
               OFFLINE OFFLINE      node1                                        
               OFFLINE OFFLINE      node2                                        
ora.net1.network
               ONLINE  ONLINE       node1                                        
               ONLINE  ONLINE       node2                                        
ora.ons
               ONLINE  ONLINE       node1                                        
               ONLINE  ONLINE       node2                                        
ora.registry.acfs
               ONLINE  ONLINE       node1                                        
               ONLINE  ONLINE       node2                                        
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       node1                                        
ora.cvu
      1        ONLINE  ONLINE       node1                                        
ora.gzyt.db
      1        ONLINE  ONLINE       node1                    Open                
      2        ONLINE  ONLINE       node2                    Open                
ora.node1.vip
      1        ONLINE  ONLINE       node1                                        
ora.node2.vip
      1        ONLINE  ONLINE       node2                                        
ora.oc4j
      1        ONLINE  ONLINE       node1                                        
ora.scan1.vip
      1        ONLINE  ONLINE       node1                                        

3、查看集群后台daemon:

[[email protected] ~]$ crsctl stat res -t -init
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.asm
      1        ONLINE  ONLINE       node2                    Started             
ora.cluster_interconnect.haip
      1        ONLINE  ONLINE       node2                                        
ora.crf
      1        ONLINE  OFFLINE                                                   
ora.crsd
      1        ONLINE  ONLINE       node2                                        
ora.cssd
      1        ONLINE  ONLINE       node2                                        
ora.cssdmonitor
      1        ONLINE  ONLINE       node2                                        
ora.ctssd
      1        ONLINE  ONLINE       node2                    ACTIVE:0            
ora.diskmon
      1        OFFLINE OFFLINE                                                   
ora.drivers.acfs
      1        ONLINE  ONLINE       node2                                        
ora.evmd
      1        ONLINE  ONLINE       node2                                        
ora.gipcd
      1        ONLINE  ONLINE       node2                                        
ora.gpnpd
      1        ONLINE  ONLINE       node2                                        
ora.mdnsd
      1        ONLINE  ONLINE       node2                                        

4、查看集群的名字

[[email protected] ~]$ cemutlo -n
node-cluster

5、查看节点应用状态:

[[email protected] ~]$ srvctl status nodeapps
VIP node1-vip is enabled
VIP node1-vip is running on node: node1
VIP node2-vip is enabled
VIP node2-vip is running on node: node2
Network is enabled
Network is running on node: node1
Network is running on node: node2
GSD is disabled
GSD is not running on node: node1
GSD is not running on node: node2
ONS is enabled
ONS daemon is running on node: node1
ONS daemon is running on node: node2

6、检查SCAN-IP的配置:

[[email protected] ~]$ srvctl config scan
SCAN name: scanip, Network: 1/192.168.41.0/255.255.255.0/eth1
SCAN VIP name: scan1, IP: /scanip/192.168.41.139

7、检查SCAN-IP实际分布:

[[email protected] ~]$ srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node node1

8、检查SCAN-IP监听情况:

[[email protected] ~]$ srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node node1

9、检查节点VIP状态:

[[email protected] ~]$ srvctl status vip -n node1
VIP node1-vip is enabled
VIP node1-vip is running on node: node1
[[email protected] ~]$ srvctl status vip -n node2
VIP node2-vip is enabled
VIP node2-vip is running on node: node2

10、检查节点VIP配置:

[[email protected] ~]$ srvctl config vip -n node1
VIP exists: /node1-vip/192.168.41.143/192.168.41.0/255.255.255.0/eth1, hosting node node1
[[email protected] ~]$ srvctl config vip -n node2
VIP exists: /node2-vip/192.168.41.144/192.168.41.0/255.255.255.0/eth1, hosting node node2

11、检查节点本地监听配置:

[[email protected] ~]$ srvctl config listener -a
Name: LISTENER
Network: 1, Owner: grid
Home: <CRS home>
  /u01/app/11.2.0/grid on node(s) node2,node1
End points: TCP:1521

12、检查节点本地监听状态:

[[email protected] ~]$ srvctl status listener
Listener LISTENER is enabled
Listener LISTENER is running on node(s): node2,node1

13、检查ASM实例状态:

[[email protected] ~]$ srvctl status asm -a
ASM is running on node2,node1
ASM is enabled.

14、检查磁盘组资源:

[[email protected] ~]$ srvctl status diskgroup -g DATA
Disk Group DATA is running on node2,node1

15、检查ASM实例配置:

[[email protected] ~]$ srvctl config asm -a
ASM home: /u01/app/11.2.0/grid
ASM listener: LISTENER
ASM is enabled.

16、检查数据库状态:

[[email protected] ~]$ srvctl status database -d GZYT
Instance GZYT1 is running on node node1
Instance GZYT2 is running on node node2

17、检查单个实例的状态:

[[email protected] ~]$ srvctl status instance -d GZYT -i GZYT2
Instance GZYT2 is running on node node2

18、检查数据库配置:

[[email protected] ~]$ srvctl config database -d GZYT -a
Database unique name: GZYT
Database name: GZYT
Oracle home: /u01/app/oracle/product/11.2.0/db_1
Oracle user: oracle
Spfile: +DATA/GZYT/spfileGZYT.ora
Domain: 
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: GZYT
Database instances: GZYT1,GZYT2
Disk Groups: DATA,FRA
Mount point paths: 
Services: 
Type: RAC
Database is enabled
Database is administrator managed

19、检查节点应用的配置:

[[email protected] ~]$ srvctl config nodeapps -a -g -s -l
Warning:-l option has been deprecated and will be ignored.
Network exists: 1/192.168.41.0/255.255.255.0/eth1, type static
VIP exists: /node1-vip/192.168.41.143/192.168.41.0/255.255.255.0/eth1, hosting node node1
VIP exists: /node2-vip/192.168.41.144/192.168.41.0/255.255.255.0/eth1, hosting node node2
GSD exists
ONS exists: Local port 6100, remote port 6200, EM port 2016
Name: LISTENER
Network: 1, Owner: grid
Home: <CRS home>
  /u01/app/11.2.0/grid on node(s) node2,node1
End points: TCP:1521

20、检查所有集群节点间的时钟同步:

[[email protected] ~]$ cluvfy comp clocksync -verbose

Verifying Clock Synchronization across the cluster nodes 

Checking if Clusterware is installed on all nodes...
Check of Clusterware install passed

Checking if CTSS Resource is running on all nodes...
Check: CTSS Resource running on all nodes
  Node Name                             Status                  
  ------------------------------------  ------------------------
  node2                                 passed                  
Result: CTSS resource check passed


Querying CTSS for time offset on all nodes...
Result: Query of CTSS for time offset passed

Check CTSS state started...
Check: CTSS state
  Node Name                             State                   
  ------------------------------------  ------------------------
  node2                                 Active                  
CTSS is in Active state. Proceeding with check of clock time offsets on all nodes...
Reference Time Offset Limit: 1000.0 msecs
Check: Reference Time Offset
  Node Name     Time Offset               Status                  
  ------------  ------------------------  ------------------------
  node2         0.0                       passed                  

Time offset is within the specified limits on the following set of nodes: 
"[node2]" 
Result: Check of clock time offsets passed


Oracle Cluster Time Synchronization Services check passed

Verification of Clock Synchronization across the cluster nodes was successful. 

21、在所有节点启动和停止集群:

[[email protected] bin]# ./crsctl start cluster -all
[[email protected] bin]# ./crsctl stop cluster -all

22、在所有节点启动和停止数据库:

[[email protected] ~]$ srvctl start database -d GZYT
[[email protected] ~]$ srvctl stop database -d GZYT

23、启动和停止单个实例:

[[email protected] ~]$ srvctl stop instance -d GZYT -i GZTY2
[[email protected] ~]$ srvctl start instance -d GZYT -i GZTY2

24、检查节点网卡列表:

[[email protected] ~]$ oifcfg iflist -n -p
eth0  10.0.0.0  PRIVATE  255.255.255.0
eth0  169.254.0.0  UNKNOWN  255.255.0.0
eth1  192.168.41.0  PRIVATE  255.255.255.0

25、检查网卡的属性:

[[email protected] ~]$ oifcfg getif
eth0  10.0.0.0  global  cluster_interconnect
eth1  192.168.41.0  global  public

以上是关于RAC集群常用管理命令的主要内容,如果未能解决你的问题,请参考以下文章

RAC 数据库的启动与关闭

Oracle 11gR2 RAC集群服务启动与关闭总结

如何查看当前的oracle是单机还是集群

Linux系统Oracle 12cR2 RAC集群安装与维护管理(12.2)专题

Oracle RAC OCR 的管理与维护

oracle rac的启动与停止