Monday, August 30, 2010

How to find Master Node in Oracle RAC

I have seen many users asking how to find “Master node” in Oracle RAC, let me clear some of their doubts.

There are two types of Masters in Oracle RAC, one is Mater node at Oracle Clusterware level and other is Master node for specific resource or block or object.

The node which gets the active state during startup is authorized to be a master node by Cluster Synchronization Service.

Run the below command to find which node is master at Clusterware level
$cat $ORA_CRS_HOME/log/`hostname`/cssd/ocssd* |grep master
or
$ for x in `ls -tr $ORA_CRS_HOME/log/`hostname`/cssd/ocssd* `; do grep -i "master node" $x ; done | tail -1

The OCR Automatic backups are taken only by master node. If the Master fails, the OCR backups will be created on the new Master. The Master node which has OCR backups goes down due to failure then we cannot be recover the OCR that’s why Oracle recommends taking backups using “ocrconfig” and also integrating OCR backups with backup strategy.

Run the below command to find which node is OCR Master and taking automatic backups.
$ocrconfig –showbackup
testrac02 2010/08/30 16:29:52 /oracle/crs/cdata/crs
testrac02 2010/08/30 16:29:52 /oracle/crs/cdata/crs
testrac02 2010/08/30 12:29:49 /oracle/crs/cdata/crs
testrac02 2010/08/30 08:29:46 /oracle/crs/cdata/crs
testrac02 2010/08/29 00:29:23 /oracle/crs/cdata/crs

The block level masters are used by Cache fusion while transferring the block. Any node can become the master node of a particular block and you can also see which node acting as master in V$GES_RESOURCE table (MASTER_NODE column)

You can manually remaster an object with oradebug command:
SQL> oradebug lkdebug -m pkey "object_id"

Regards
Satishbabu Gunukula
http://www.oracleracexpert.com

9 comments:

  1. Hi,

    First off, thanks for this very informative article. I hope I can be as good as you but use of Oracle in US is light years away compare to where I am.

    Anyway, I just want to ask if the Master Node is the same as the PREFERRED NODE? If they are different, how to check which one is the PREFERRED NODE or how does Oracle decide which one is the PREFERRED NODE or how to configure which node should be the PREFERRED NODE? I've asked our resident RAC gurus heap of times and they do not want to provide answers ... grrrrr

    ReplyDelete
  2. Please note that Master node is not same as preferred node. By default Oracle starts the service on preferred node and the available node will take over, in case of any failure of preferred node.

    Run the below command to find the Preferred and available nodes.
    $ srvctl config service -d database_name

    You can configure preferred node and available node using DBCA or srvctl (command-line).

    Regards
    Satishbabu Gunukula
    http://www.oracleracexpert.com

    ReplyDelete
    Replies
    1. Hi,

      can u explain how to identify which service is configured on which node and ways to identify them and relocate to the correct node.
      please explain preferred current available nodes in RAC

      Delete
  3. Hi Satish:
    Thanks for this nice article.
    I am trying to execute the below command to find the Preferred nodes but it dont show any output . No Error also. Just after executing the command the prompt appear -
    [oracle@rac1 cssd]$ srvctl config service -d rac
    [oracle@rac1 cssd]$

    Appreciate for your early reply.

    Thanks
    Ram

    ReplyDelete
  4. Run below command to find the status of the service and provide theo output.
    $ srvctl status service -d rac

    ReplyDelete
  5. Vencer,

    Run the below commands to find the preferred node and available node info, which service configured on which node.
    $srvctl config service -d database_name
    $ srvctl status service -d database_name

    Hope this helps

    ReplyDelete
  6. Hi Satish:
    Thanks for your reply.
    Here is the output -
    $ srvctl status service -d rac
    $

    Still I dont see any output after executing the above command. Do I need to do any changes in the configuration of the database?

    Thanks for your help.

    ReplyDelete
  7. Hi Satis,

    Is there a way for developers to identify what are the preferred and available nodes/instances for a service using any dictionary views.

    Thanks,
    Santosh

    ReplyDelete