Monday, September 30, 2013

How to Stop and Stop Oracle RAC Instances

Information about How To Stop and Start Oracle RAC Instances
This document will explain how to stop Oracle RAC instances on any node. This is good to know for reboot or server maintenance.
Document Creator Todd Walters 
Requirements
  • Oracle RAC is installed on srv0dbx01, srv0dbx02, and srv0dbx03
  • The name of the database is PSITEDB
  • Each Instance is called PSITEDBX where X is the node, i.e. PSITEDB1
  • srvctl is used to control all nodes. srvctl -h will show you syntax help
  • showcrs script stored in oracle home directory will show status of all nodes.
  • If srvctl does not stop and start instance properly verify TNS_ADMIN env is set. See Setting TNS_ADMIN Below
  • TIP: Run export SRVM_TRACE=TRUE
    Then try and start instance:$ srvctl start instance -d PSITEDB -I PSITEDB3
    This will then let you see the log file as it starts and check for errors.
  • sqlplus / as sysdba
  • Check ENV for TNS and set if needed if having problems starting/stopping instance, ie. dsandb3
    • srvctl getenv database -d PSITEDB
    • srvctl setenv database -d PSITEDB -T TNS_ADMIN=/u00/app/oracle/product/10.2.0/ASM/network/admin
    • Next check starting/stopping with
      • srvctl start database -d PSITEDB
      • Then Check status with crs_stat -t -v or showcrs
How to Stop and Start Oracle RAC Instances
  1. Login to Oracle Server (node 1 for example, srv0dbx01)
  2. su - oracle
  3. Source CRS
      • srv0dbx01 | ORA1020 | /export/home/oracle
        > .
        oraenv
        ORACLE_SID = [ORA1020] ?
        CRS
        srv0dbx01 | CRS | /export/home/oracle
        >
        cd $ORACLE_HOME
        srv0dbx01 | CRS | /u00/app/oracle/product/10.2.0/CRS
  4. Check Status of Instance
      • > srvctl status instance -d PSITEDB -i PSITEDB1
        Instance PSITEDB1 is running on node srv0dbx01
  5. Stop the Instance
      • srvctl stop instance -d PSITEDB -i PSITEDB1
  6. Check the status of the Instance again
      • > srvctl status instance -d PSITEDB -i PSITEDB1
        Instance PSITEDB1 is not running on node srv0dbx01
  7. Perform Server maintnence, reboot, or other tasks as necessary.
  8. When server is back online check status again with showcrs or srvctl statusExample showcrs output:
> ~/showcrs
HA Resource                                                  Target     State
-----------                                                       ------     -----
ora.PSITEDB.APPPSAN.PSITEDB3.srv                 ONLINE     ONLINE on srv0dbx03
ora.PSITEDB.APPPSAN.cs                                 ONLINE     ONLINE on srv0dbx03
ora.PSITEDB.PSAN.PSITEDB2.srv                      ONLINE     ONLINE on srv0dbx03
ora.PSITEDB.PSAN.cs                                      ONLINE     ONLINE on srv0dbx02
ora.PSITEDB.PSITEDB1.inst                              ONLINE     ONLINE on srv0dbx01
ora.PSITEDB.PSITEDB2.inst                              ONLINE     ONLINE on srv0dbx02
ora.PSITEDB.PSITEDB3.inst                              ONLINE     ONLINE on srv0dbx03
ora.PSITEDB.db                                              ONLINE     ONLINE on srv0dbx01
ora.srv0dbx01.ASM1.asm                              ONLINE     ONLINE on srv0dbx01
ora.srv0dbx01.LISTENER_srv0DBX01.lsnr   ONLINE     ONLINE on srv0dbx01
ora.srv0dbx01.gsd                                        ONLINE     ONLINE on srv0dbx01
ora.srv0dbx01.ons                                        ONLINE     ONLINE on srv0dbx01
ora.srv0dbx01.vip                                         ONLINE     ONLINE on srv0dbx01
ora.srv0dbx02.ASM2.asm                              ONLINE     ONLINE on srv0dbx02
ora.srv0dbx02.LISTENER_srv0DBX02.lsnr   ONLINE     ONLINE on srv0dbx02
ora.srv0dbx02.gsd                                        ONLINE     ONLINE on srv0dbx02
ora.srv0dbx02.ons                                        ONLINE     ONLINE on srv0dbx02
ora.srv0dbx02.vip                                         ONLINE     ONLINE on srv0dbx02
ora.srv0dbx03.ASM3.asm                              ONLINE     ONLINE on srv0dbx03
ora.srv0dbx03.LISTENER_srv0DBX03.lsnr   ONLINE     ONLINE on srv0dbx03
ora.srv0dbx03.gsd                                        ONLINE     ONLINE on srv0dbx03
ora.srv0dbx03.ons                                        ONLINE     ONLINE on srv0dbx03
ora.srv0dbx03.vip                                         ONLINE     ONLINE on srv0dbx03
Set TNS_ADMIN  env in Database

  1. Stop the database
      • srvctl stop database -d PSITEDB
  2. View current database settings:
      • srv0dbx01 | CRS | /u00/app/oracle/product/10.2.0/CRS
        >
        srvctl getenv database -d PSITEDBTNS_ADMIN=/u00/app/oracle/product/10.2.0/ASM/network/admin
  3. If there is no env set for TNS_ADMIN set it with this command
      • > srvctl setenv database -d PSITEDB -T TNS_ADMIN=/u00/app/oracle/product/10.2.0/ASM/network/admin
  4. Start the database
      • srvctl start database -d PSITEDB
  5. Check the status and srvctl should be able to start this now.
      • srvctl start instance -d PSITEDB -i PSITEDB1

Other Options

  1. srvctl stop instance options
    Option
    Description
    -d db_unique_name
    Unique name for the database
    -i inst_name_list
    Comma-separated instance names
    -o stop_options
    Options for shutdown command (for example: normal, transactional, immediate, or abort)
    -c connect_str
    Connect string (default: / as sysdba)
    -q
    Query connect string from standard input
    1. You stop all the services through srvctl and stop crs stack

      As root

      /etc/init.d/init.crs stop

      and start

      /etc/init.d/init.crs start

      It should bring up all the resources automatically.

      If not wait for 5 minutes, grep crs processes

      ps -ef| grep d.bin

      When all the processes are up, you can bring up the resources through srvctl
    1. stop all srvctl services in the following order:
    srvctl stop instance -d <DB> -i <INST>
    do this for all instances on this node
    srvctl stop asm -n <NODE> -i <ASMINST>
    srvctl stop nodeapps -n <NODE>
    this stops the listener and the gsd/ons/vip apps

    2. as root:
    /etc/init.d/init.crs stop
    wait 5 mins
    /etc/init.d/init.crs start

    3. monitor progress
    tail -f alert_INST.log
    plus
    occasional executions of crs_stat -t
    crs_stat -f ora.PSITEDB.PSITEDB1.inst
    Is the Cluster Healthy?
    srv0dbx01 | ORA1020 | /export/home/oracle
    > crsctl check crs
    CSS appears healthy
    CRS appears healthy
    EVM appears healthy
    > crsctl check cssd
    CSS appears healthy
    Reference

No comments:

Post a Comment