Thursday, 13 March 2014

How to start/stop RAC componants

How to Stop/Start RAC components
In this article, I am going to explain how to stop/start rac components. This is my environment:

My db version : 11.2.0.3
My Operating System : AIX 6.1
My servers hostname : node1-node2
My database name : TEST
My instance name : TEST1-TEST2

Here is the some basic  commands, for commands details&options  please review Reference docs:


$$CRS_HOME/bin/crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   763e07f95ac84ff6bf7132f672c5c47e (/dev/voting01) [OCR_VOTE]
 2. ONLINE   2dc5840f8eeb4f6bbfe624bdf3f2c4a2 (/dev/voting02) [OCR_VOTE]
 3. ONLINE   8422c3282a1f4f55bfa6b1242ff7b967 (/dev/voting03) [OCR_VOTE]

$$CRS_HOME/bin/ocrcheck
Status of Oracle Cluster Registry is as follows :
         Version                  :          3
         Total space (kbytes)     :     262120
         Used space (kbytes)      :       2808
         Available space (kbytes) :     259312
         ID                       :  597557072
         Device/File Name         :  +OCR_VOTE
                                    Device/File integrity check succeeded

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

                                    Device/File not configured

         Cluster registry integrity check succeeded

         Logical corruption check bypassed due to non-privileged user

Checking CRS Status
[oracle@node1] $ORACLE_HOME/bin/crsctl check crs

CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online

[oracle@node2] $ORACLE_HOME/bin/crsctl check crs

CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online

Checking Node Status

[oracle@node1] $ORACLE_HOME/bin/srvctl status nodeapps

VIP node1-vip is enabled
VIP node1-vip is running on node: node1
VIP 192.168.100.101 is enabled
VIP 192.168.100.101 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

[oracle@node2] $ORACLE_HOME/bin/srvctl status nodeapps

VIP node1-vip is enabled
VIP node1-vip is running on node: node1
VIP 192.168.100.101 is enabled
VIP 192.168.100.101 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

Checking Clusterware Resource Status
[oracle@node1]$ cd $CRS_HOME/bin
[oracle@node1]$ ./crsctl stat res -t
--------------------------------------------------------------------------------
NAME                    TARGET  STATE        SERVER        STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA1.dg ONLINE  ONLINE       node1
                ONLINE  ONLINE       node2
ora.LISTENER.lsnr       ONLINE  ONLINE       node1
                ONLINE  ONLINE       node2
ora.OCR_VOTE.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       node2
ora.LISTENER_SCAN2.lsnr     1        ONLINE  ONLINE       node1
ora.LISTENER_SCAN3.lsnr     1        ONLINE  ONLINE       node1
ora.cvu        1        ONLINE  ONLINE       node1
ora.oc4j    1        ONLINE  ONLINE       node1
ora.scan1.vip    1        ONLINE  ONLINE       node2
ora.scan2.vip    1        ONLINE  ONLINE       node1
ora.scan3.vip      1        ONLINE  ONLINE       node1
ora.node1.vip    1        ONLINE  ONLINE       node1
ora.node2.vip    1        ONLINE  ONLINE       node2

You can use below command which is not recommended for 11g and which is depreciated

[oracle@node1]crs_stat -t
Name Type Target State Host
————————————————————
ora….DATA.dg ora….up.type ONLINE ONLINE node1
ora….ER.lsnr ora….er.type ONLINE ONLINE node1
ora….N1.lsnr ora….er.type ONLINE ONLINE node1
ora….N2.lsnr ora….er.type ONLINE ONLINE node2
ora.ORADATA.dg ora….up.type ONLINE ONLINE node1
ora.asm ora.asm.type ONLINE ONLINE node1
ora.cvu ora.cvu.type ONLINE ONLINE node2
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora….SM1.asm application ONLINE ONLINE node1
ora….11.lsnr application ONLINE ONLINE node1
ora….b11.gsd application OFFLINE OFFLINE
ora….b11.ons application ONLINE ONLINE node1
ora….b11.vip ora….t1.type ONLINE ONLINE node1
ora….SM2.asm application ONLINE ONLINE node2
ora….12.lsnr application ONLINE ONLINE node2
ora….b12.gsd application OFFLINE OFFLINE
ora….b12.ons application ONLINE ONLINE node2
ora….b12.vip ora….t1.type ONLINE ONLINE node2
ora….network ora….rk.type ONLINE ONLINE node1
ora.oc4j ora.oc4j.type ONLINE ONLINE node2
ora.ons ora.ons.type ONLINE ONLINE node1
ora.TEST.db ora….se.type ONLINE ONLINE node1
ora….int.svc ora….ce.type ONLINE ONLINE node2
ora….int.svc ora….ce.type ONLINE ONLINE node2
ora….kis.svc ora….ce.type ONLINE ONLINE node2
ora….est.svc ora….ce.type ONLINE ONLINE node1
ora….ry.acfs ora….fs.type ONLINE ONLINE node1
ora.scan1.vip ora….ip.type ONLINE ONLINE node1
ora.scan2.vip ora….ip.type ONLINE ONLINE node2

Oracle High Availability Services

– disable/enable Oracle HAS.
Use the “crsctl enable/disable has” command to disable automatic startup of the Oracle High Availability Services stack when the server boots up.

To can see current settings for Oracle High Availability Services stack when the server boots up, follow:

[root@node1]crsctl config has
CRS-4622: Oracle High Availability Services autostart is enabled.

or

[root@node1]cat /etc/oracle/scls_scr/node1/root/ohasdstr
enable

So as you can see my current setting is enable.If your system shown disable than :

For Disable:
[root@node1]crsctl disable has
CRS-4621: Oracle High Availability Services autostart is disabled.

[root@node1] crsctl config has
CRS-4621: Oracle High Availability Services autostart is disabled.

# cat /etc/oracle/scls_scr/node1/root/ohasdstr
disable

For Enable:
[root@node1]crsctl enable has
CRS-4621: Oracle High Availability Services autostart is enabled.

Check new setting:

[root@node1] crsctl config has
CRS-4621: Oracle High Availability Services autostart is enabled.

[root@node1] cat /etc/oracle/scls_scr/node1/root/ohasdstr
enable

Stop the Oracle clusterware stack

You can use below commands:
With root user:

crsctl stop crs or crsctl stop has

[root@node1]crsctl stop has
CRS-2791: Starting shutdown of Oracle High Availability Services-managed resources on ‘node1′
CRS-2673: Attempting to stop ‘ora.crsd’ on ‘node1′
CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on ‘node1′
CRS-2673: Attempting to stop ‘ora.LISTENER_SCAN2.lsnr’ on ‘node1′
CRS-2673: Attempting to stop ‘ora.LISTENER.lsnr’ on ‘node1′
CRS-2673: Attempting to stop ‘ora.TEST.db’ on ‘node1′
CRS-2673: Attempting to stop ‘ora.LISTENER_SCAN3.lsnr’ on ‘node1′
CRS-2677: Stop of ‘ora.LISTENER_SCAN2.lsnr’ on ‘node1′ succeeded
CRS-2673: Attempting to stop ‘ora.scan2.vip’ on ‘node1′
CRS-2677: Stop of ‘ora.LISTENER.lsnr’ on ‘node1′ succeeded
CRS-2673: Attempting to stop ‘ora.node1.vip’ on ‘node1′
CRS-2677: Stop of ‘ora.LISTENER_SCAN3.lsnr’ on ‘node1′ succeeded
CRS-2673: Attempting to stop ‘ora.scan3.vip’ on ‘node1′
CRS-2677: Stop of ‘ora.node1.vip’ on ‘node1′ succeeded
CRS-2672: Attempting to start ‘ora.node1.vip’ on ‘node2′
CRS-2677: Stop of ‘ora.scan2.vip’ on ‘node1′ succeeded
CRS-2672: Attempting to start ‘ora.scan2.vip’ on ‘node2′
CRS-2677: Stop of ‘ora.scan3.vip’ on ‘node1′ succeeded
CRS-2672: Attempting to start ‘ora.scan3.vip’ on ‘node2′
CRS-2676: Start of ‘ora.node1.vip’ on ‘node2′ succeeded
CRS-2677: Stop of ‘ora.TEST.db’ on ‘node1′ succeeded
CRS-2676: Start of ‘ora.scan2.vip’ on ‘node2′ succeeded
CRS-2672: Attempting to start ‘ora.LISTENER_SCAN2.lsnr’ on ‘node2′
CRS-2676: Start of ‘ora.scan3.vip’ on ‘node2′ succeeded
CRS-2672: Attempting to start ‘ora.LISTENER_SCAN3.lsnr’ on ‘node2′
CRS-2676: Start of ‘ora.LISTENER_SCAN2.lsnr’ on ‘node2′ succeeded
CRS-2676: Start of ‘ora.LISTENER_SCAN3.lsnr’ on ‘node2′ succeeded
CRS-2673: Attempting to stop ‘ora.ons’ on ‘node1′
CRS-2673: Attempting to stop ‘ora.eons’ on ‘node1′
CRS-2677: Stop of ‘ora.ons’ on ‘node1′ succeeded
CRS-2673: Attempting to stop ‘ora.net1.network’ on ‘node1′
CRS-2677: Stop of ‘ora.net1.network’ on ‘node1′ succeeded
CRS-2677: Stop of ‘ora.eons’ on ‘node1′ succeeded
CRS-2792: Shutdown of Cluster Ready Services-managed resources on ‘node1′ has completed
CRS-2677: Stop of ‘ora.crsd’ on ‘node1′ succeeded
CRS-2673: Attempting to stop ‘ora.mdnsd’ on ‘node1′
CRS-2673: Attempting to stop ‘ora.gpnpd’ on ‘node1′
CRS-2673: Attempting to stop ‘ora.cssdmonitor’ on ‘node1′
CRS-2673: Attempting to stop ‘ora.ctssd’ on ‘node1′
CRS-2673: Attempting to stop ‘ora.evmd’ on ‘node1′
CRS-2677: Stop of ‘ora.cssdmonitor’ on ‘node1′ succeeded
CRS-2677: Stop of ‘ora.mdnsd’ on ‘node1′ succeeded
CRS-2677: Stop of ‘ora.gpnpd’ on ‘node1′ succeeded
CRS-2677: Stop of ‘ora.evmd’ on ‘node1′ succeeded
CRS-2677: Stop of ‘ora.ctssd’ on ‘node1′ succeeded
CRS-2673: Attempting to stop ‘ora.cssd’ on ‘node1′
CRS-2677: Stop of ‘ora.cssd’ on ‘node1′ succeeded
CRS-2673: Attempting to stop ‘ora.diskmon’ on ‘node1′
CRS-2673: Attempting to stop ‘ora.gipcd’ on ‘node1′
CRS-2677: Stop of ‘ora.gipcd’ on ‘node1′ succeeded
CRS-2677: Stop of ‘ora.diskmon’ on ‘node1′ succeeded
CRS-2793: Shutdown of Oracle High Availability Services-managed resources on ‘node1′ has completed
CRS-4133: Oracle High Availability Services has been stopped.

Start the Oracle clusterware stack

You can use below commands:
With root user:
crsctl start crs or crsctl start has

[root@node1] crsctl start crs
CRS-4123: Oracle High Availability Services has been started.

Start the Oracle Database
To start all Oracle RAC instances for a database:
[oracle@node1]
$ORACLE_HOME/bin/srvctl start database -d db_name
PS: db_name is the name of the database this command is starting all the instances

Stop the Oracle Database
To shut down all Oracle RAC instances for a database:
[oracle@node1]
$ORACLE_HOME/bin/srvctl stop database -d db_name
PS: db_name is the name of the databasethis command is starting all the instances

Start the Oracle Instance:

[oracle@node1]
$ORACLE_HOME/bin/srvctl start database -d db_name -i instance_name

Stop the Oracle Instance:

[oracle@node1]
$ORACLE_HOME/bin/srvctl stop database -d db_name -i instance_name
Stop/Start Listener-SCAN_LISTENER

srvctl stop/start listener -n node1
srvctl stop/start listener -n node2
srvctl stop scan_listener

Stop ASM

srvctl stop asm [-o stop_options] [-f]
srvctl stop asm -n node1