Search This Blog

Monday, September 17, 2012

Oracle RAC 11gR2 Clusterware and Database Administration.

Prior to 11gR2 "crs_stat -t" was used for checking the status of all the resources
But now "crsctl status resource -t" can be used in it's place.

I have a test two node RAC system on which i am going to demonstrate some of
the database and clusterware administration commands.

Here are some important notes from Oracle Docs on "SRVCTL" & "CRSCTL" utilities which are
going to be used in this article.

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.


Difference between Using SRVCTL and CRSCTL.

Use SRVCTL to manage Oracle-supplied resources such as listener, 
instances, disk groups, and networks, and CRSCTL for managing 
Oracle Clusterware and its resources.

Note: Oracle strongly discourages directly manipulating Oracle-supplied 
resources (resources whose names begin with ora) using CRSCTL. 
This could adversely impact the cluster configuration.

Stopping Active SRVCTL Commands

Although you may be able to cancel running SRVCTL commands by 
pressing the Control-C keys, you may corrupt your configuration 
data by doing this.

You are strongly advised not to attempt to terminate SRVCTL in 
this manner.







You can check the clusterware resources on all the nodes by executing the following
command as the "grid user".



[grid@rac1 ~]$ crsctl status resource -t


--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS                                                                      

                        
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.CRS.dg
               ONLINE  ONLINE       rac1                                                                                                        

                        
               ONLINE  ONLINE       rac2                                                                                                        

                        
ora.DATA.dg
               OFFLINE OFFLINE      rac1                                                                                                        

                        
               OFFLINE OFFLINE      rac2                                                                                                        

                        
ora.FRA.dg
               OFFLINE OFFLINE      rac1                                                                                                        

                        
               OFFLINE OFFLINE      rac2                                                                                                        

                        
ora.LISTENER.lsnr
               ONLINE  ONLINE       rac1                                                                                                        

                        
               ONLINE  ONLINE       rac2                                                                                                        

                        
ora.asm
               ONLINE  ONLINE       rac1                     Started                                                                            

                        
               ONLINE  ONLINE       rac2                     Started                                                                            

                        
ora.eons
               ONLINE  ONLINE       rac1                                                                                                        

                        
               ONLINE  ONLINE       rac2                                                                                                        

                        
ora.gsd
               OFFLINE OFFLINE      rac1                                                                                                        

                        
               OFFLINE OFFLINE      rac2                                                                                                        

                        
ora.net1.network
               ONLINE  ONLINE       rac1                                                                                                        

                        
               ONLINE  ONLINE       rac2                                                                                                        

                        
ora.ons
               ONLINE  ONLINE       rac1                                                                                                        

                        
               ONLINE  ONLINE       rac2                                                                                                        

                        
ora.registry.acfs
               ONLINE  ONLINE       rac1                                                                                                        

                        
               ONLINE  ONLINE       rac2                                                                                                        

                        
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       rac1                                                                                                        

                        
ora.LISTENER_SCAN2.lsnr
      1        ONLINE  ONLINE       rac2                                                                                                        

                        
ora.LISTENER_SCAN3.lsnr
      1        ONLINE  ONLINE       rac2                                                                                                        

                        
ora.dell.db
      1        OFFLINE OFFLINE                                                                                                                  

                        
      2        OFFLINE OFFLINE                                                                                                                  

                        
ora.oc4j
      1        OFFLINE OFFLINE                                                                                                                  

                        
ora.orcl.db
      1        OFFLINE OFFLINE                                                                                                                  

                        
      2        OFFLINE OFFLINE                                                                                                                  

                        
ora.rac1.vip
      1        ONLINE  ONLINE       rac1                                                                                                        

                        
ora.rac2.vip
      1        ONLINE  ONLINE       rac2                                                                                                        

                        
ora.scan1.vip
      1        ONLINE  ONLINE       rac1                                                                                                        

                        
ora.scan2.vip
      1        ONLINE  ONLINE       rac2                                                                                                        

                        
ora.scan3.vip
      1        ONLINE  ONLINE       rac2 



To check for Local Daemons.

[grid@rac1 ~]$ crsctl status resource -init

NAME=ora.asm
TYPE=ora.asm.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.crsd
TYPE=ora.crs.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.cssd
TYPE=ora.cssd.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.cssdmonitor
TYPE=ora.cssdmonitor.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.ctssd
TYPE=ora.ctss.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.diskmon
TYPE=ora.diskmon.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.drivers.acfs
TYPE=ora.drivers.acfs.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.evmd
TYPE=ora.evm.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.gipcd
TYPE=ora.gipc.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.gpnpd
TYPE=ora.gpnp.type
TARGET=ONLINE
STATE=ONLINE on rac1

NAME=ora.mdnsd
TYPE=ora.mdns.type
TARGET=ONLINE
STATE=ONLINE on rac1


Starting and Stopping your Database.

[oracle@rac1 ~]$ srvctl status database -d orcl
Instance orcl1 is running on node rac1
Instance orcl2 is running on node rac2

[oracle@rac1 ~]$ srvctl stop database -d orcl
[oracle@rac1 ~]$ srvctl start database -d orcl

[oracle@rac1 ~]$ srvctl stop instance -d orcl -i orcl1
[oracle@rac1 ~]$ srvctl start instance -d orcl -i orcl1



Shutting down the RAC cluster


[oracle@rac1 ~]$ srvctl stop database -d orcl

[oracle@rac1 ~]$ srvctl stop listener

Note:
To manage Oracle ASM on Oracle Database 11g release 2 (11.2) 
installations, use the SRVCTL binary in the Oracle Grid 
Infrastructure home for a cluster (Grid home). If you have Oracle 
RAC or Oracle Database installed, then you cannot use the SRVCTL 
binary in the database home to manage Oracle ASM.


[grid@rac1 ~]$ srvctl stop diskgroup -g data -n rac1,rac2
[grid@rac1 ~]$ srvctl stop diskgroup -g fra -n rac1,rac2



[oracle@rac1 ~]$ srvctl stop scan_listener
[oracle@rac1 ~]$ srvctl stop scan

stop nodeapps on all nodes.

[oracle@rac1 ~]$ srvctl stop nodeapps -f


As Root User.

[root@rac1 bin]# ./crsctl stop resource ora.registry.acfs

CRS-2673: Attempting to stop 'ora.registry.acfs' on 'rac2'
CRS-2673: Attempting to stop 'ora.registry.acfs' on 'rac1'
CRS-2677: Stop of 'ora.registry.acfs' on 'rac2' succeeded
CRS-2677: Stop of 'ora.registry.acfs' on 'rac1' succeeded

stop clusterware stack.

[root@rac1 bin]# ./crsctl stop cluster -all
CRS-2673: Attempting to stop 'ora.crsd' on 'rac1'
CRS-2673: Attempting to stop 'ora.crsd' on 'rac2'
CRS-2790: Starting shutdown of Cluster Ready Services-managed 

resources on 'rac1'
CRS-2673: Attempting to stop 'ora.CRS.dg' on 'rac1'
CRS-2790: Starting shutdown of Cluster Ready Services-managed 

resources on 'rac2'
CRS-2673: Attempting to stop 'ora.CRS.dg' on 'rac2'
CRS-2677: Stop of 'ora.CRS.dg' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'rac1'
CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 

'rac1' has completed
CRS-2677: Stop of 'ora.CRS.dg' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.asm' on 'rac2'
CRS-2677: Stop of 'ora.asm' on 'rac2' succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on 

'rac2' has completed
CRS-2677: Stop of 'ora.crsd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cssdmonitor' 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.crsd' on 'rac2' succeeded
CRS-2677: Stop of 'ora.cssdmonitor' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cssdmonitor' on 'rac2'
CRS-2673: Attempting to stop 'ora.ctssd' on 'rac2'
CRS-2673: Attempting to stop 'ora.evmd' on 'rac2'
CRS-2673: Attempting to stop 'ora.asm' on 'rac2'
CRS-2677: Stop of 'ora.cssdmonitor' on 'rac2' succeeded
CRS-2677: Stop of 'ora.evmd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.evmd' on 'rac2' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'rac1' succeeded
CRS-2677: Stop of 'ora.ctssd' on 'rac2' succeeded
CRS-2677: Stop of 'ora.asm' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac2'
CRS-2677: Stop of 'ora.asm' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.cssd' on 'rac1'
CRS-2677: Stop of 'ora.cssd' on 'rac2' succeeded
CRS-2673: Attempting to stop 'ora.diskmon' on 'rac2'
CRS-2677: Stop of 'ora.cssd' on 'rac1' succeeded
CRS-2673: Attempting to stop 'ora.diskmon' on 'rac1'
CRS-2677: Stop of 'ora.diskmon' on 'rac2' succeeded
CRS-2677: Stop of 'ora.diskmon' on 'rac1' succeeded


Stop CRS services 

By executing the following commands on All nodes

[root@rac1 bin]# ./crsctl stop crs



Starting the RAC cluster.

On all nodes execute.

[root@rac1 bin]# ./crsctl start crs
CRS-4123: Oracle High Availability Services has been started.

[oracle@rac1 ~]$ srvctl start nodeapps

PRKO-2421 : Network resource is already started on node(s): 

rac1,rac2
PRKO-2422 : ONS is already started on node(s): rac1,rac2
PRKO-2423 : eONS is already started on node(s): rac1,rac2

[oracle@rac1 ~]$ srvctl start scan
[oracle@rac1 ~]$ srvctl start scan_listener

[grid@rac1 ~]$ srvctl start diskgroup -g fra -n rac1,rac2
[grid@rac1 ~]$ srvctl start diskgroup -g data -n rac1,rac2

[oracle@rac1 ~]$ srvctl start listener
[oracle@rac1 ~]$ srvctl start database -d orcl



References:

http://docs.oracle.com/cd/E11882_01/rac.112/e16795/srvctladmin.htm#autoId185
http://docs.oracle.com/cd/E11882_01/rac.112/e16794/crsref.htm#CHDFEEEG

 


3 comments:

  1. srvctl is not deprecated in 11g and should be used for managing resources like listeners,instances etc. in place of crsctl. Read the below note from Oracle documentation:

    "Use SRVCTL to manage Oracle-supplied resources such as listener, instances, disk groups, and networks, and CRSCTL for managing Oracle Clusterware and its resources.

    Note:
    Oracle strongly discourages directly manipulating Oracle-supplied resources (resources whose names begin with ora) using CRSCTL. This could adversely impact the cluster configuration.

    ReplyDelete
    Replies
    1. Point Noted and Confirmed, Documentation will be corrected ASAP.

      Delete