All About RAC Master Node

What is a Master Node in RAC


The master node in oracle RAC is node which is responsible to initiate the OCR backup.
Node-id of the Master node in rac is least node-id among the nodes in cluater
node-ids are assigned to the nodes in the order they join the cluater and therefore the node which joins the cluster first is designated as Master Node

Task of the Master Node


crsd process of the master node is responsible to initiate OCR backup
Master node is responsible to sync the OCR local cache across the nodes
only crsd process on the master node updates the OCR on disk
in case of node eviction, if the cluster is devided into 2 equal nodes the sub-cluster having the master node survives and the other sub-cluster is evicted


How to identify the Master Node in RAC


there are 3 possible ways

1> Identify the node which performs the backup of OCR

$ ocrconfig -showbackup
node1     2017/06/17 21:32:42     +DATA_MGMT:/RAC01/OCRBACKUP/backup00.ocr.281.946935141     0
node1     2017/06/17 21:32:42     +DATA_MGMT:/RAC01/OCRBACKUP/day.ocr.282.946935163     0
node1     2017/06/17 21:32:42     +DATA_MGMT:/RAC01/OCRBACKUP/week.ocr.283.946935165     0
PROT-25: Manual backups for the Oracle Cluster Registry are not available

2> Check  crsd logs from various nodes.

cat crsd.trc |grep MASTER

2017-06-17 17:30:51.457 :  OCRMAS:2797573888: proath_master: SUCCESSFULLY CONNECTED TO THE MASTER
2017-06-17 17:30:51.457 :  OCRMAS:2797573888: th_master: NEW OCR MASTER IS 1
2017-06-17 17:30:52.095 :   CRSPE:2384393984: {2:12188:2} PE MASTER NAME: node1
2017-06-17 17:31:54.926 :  CRSOCR:2388596480: {2:12188:2} Registered PE standby with CSS. I AM A STANDBY MASTER.
2017-06-17 23:14:47.617 :  CRSOCR:2390697728: {2:12188:3229} Deregistered PE standby with CSS. I AM NO LONGER A STANDBY MASTER.
2017-06-17 23:21:50.596 :  OCRMAS:1748141824: proath_master: SUCCESSFULLY CONNECTED TO THE MASTER
2017-06-17 23:21:50.596 :  OCRMAS:1748141824: th_master: NEW OCR MASTER IS 1
2017-06-17 23:21:51.874 :   CRSPE:1121937152: {2:46838:2} PE MASTER NAME: node1
2017-06-17 23:22:15.020 :  CRSOCR:1130342144: {2:46838:2} Registered PE standby with CSS. I AM A STANDBY MASTER.

3> Check ocssd logs from various nodes.

cat ocssd.trc |grep MASTER

2017-06-17 17:30:54.010 :    CSSD:1971631872: clssgmOptagProcessGrockCreate: grock CLSN.ONSNETPROC.MASTER from node node1, number 1, with 1 attributes having size 20
2017-06-17 17:30:54.010 :    CSSD:1971631872: clssgmGenSetGrockAttr: grock CLSN.ONSNETPROC.MASTER, attribute MAXMBRNUM, type 7, length 4, value (512/512/0x200)
2017-06-17 17:30:54.010 :    CSSD:1971631872: clssgmGroupAttrPrint: Attributes for group CLSN.ONSNETPROC.MASTER, ID 32:2
2017-06-17 17:30:54.010 :    CSSD:1971631872: clssgmGroupAttrPrint: Attributes for group CLSN.ONSNETPROC.MASTER, ID 32:2
2017-06-17 17:30:54.010 :    CSSD:1971631872: clssgmsCreateMember: Created memberID 32:2:1 in group CLSN.ONSNETPROC.MASTER with event subscriptions 0x000000a1, flags 0x0 for clientID 1:76:18

What will happen if the Master Node is down.

very obious question, if the master node is down what will happen ? Does OCR will not be backed up?


When OCR master (crsd.bin process) stops or restarts for whatever reason, the crsd.bin on surviving node with lowest node number will become new OCR master.

Just to proof the same I restarted the Node1 which is my current master node and checked the logfile and did a Manual OCR backup too and you can see the result below


2017-06-18 00:17:15.398 :   CRSPE:1121937152: {2:46838:561} PE Role|State Update: old role [SLAVE] new [MASTER]; old state [Running] new [Configuring]
2017-06-18 00:17:15.398 :   CRSPE:1121937152: {2:46838:561} PE MASTER NAME: node2
2017-06-18 00:17:15.403 :  OCRMAS:1748141824: th_master:13: I AM THE NEW OCR MASTER at incar 7. Node Number 2
2017-06-18 00:17:15.407 :  OCRSRV:1128240896: proas_amiwriter: ctx is MASTER CHANGING/CONNECTING
2017-06-18 00:17:16.304 :   CRSPE:1121937152: {2:46838:561} PE Role|State Update: old role [MASTER] new [MASTER]; old state [Configuring] new [Starting]
2017-06-18 00:17:16.311 :   CRSPE:1121937152: {2:46838:561} PE Role|State Update: old role [MASTER] new [MASTER]; old state [Starting] new [Running]

lets do a Manual OCR backup and see whats Happening

[root@node1 oracle]# ocrconfig -manualbackup

node2     2017/06/18 00:23:47     +DATA_MGMT:/RAC01/OCRBACKUP/backup_20170618_002347.ocr.284.946945427     0


As you can see, although I executed the backup from node1, its node2 who took the backup


The easiest Way to Identify the Master Node in  Oracle 12.2


and finially the easiest way. Works perfectly with 12c. Not Aware of about other versions

oclumon manage -get MASTER

Master = node2



9 comments:

  1. I found something difference where oclumon output is not up to mark. O/P of same command shows node2 is master node while taking manual backup of it was taking on node1 and even same in ocssd.trc i.e node 1 is mater node, below is O/P:

    [root@ol6-112-rac2 ol6-112-scan]# date
    Thu Jan 31 17:01:31 IST 2019
    [root@ol6-112-rac2 ol6-112-scan]# oclumon manage -get MASTER

    Master = ol6-112-rac2
    [root@ol6-112-rac2 ol6-112-scan]# date
    Thu Jan 31 17:01:41 IST 2019
    [root@ol6-112-rac2 ol6-112-scan]# ocrconfig -manualbackup

    ol6-112-rac1 2019/01/31 17:01:51 /u01/app/12.1.0/grid/cdata/ol6-112-scan/backup_20190131_170151.ocr 811007039

    ol6-112-rac2 2019/01/31 16:26:11 /u01/app/12.1.0/grid/cdata/ol6-112-scan/backup_20190131_162611.ocr 811007039

    ol6-112-rac1 2019/01/31 14:59:53 /u01/app/12.1.0/grid/cdata/ol6-112-scan/backup_20190131_145953.ocr 811007039

    ol6-112-rac1 2019/01/31 14:32:55 /u01/app/12.1.0/grid/cdata/ol6-112-scan/backup_20190131_143255.ocr 811007039

    ol6-112-rac2 2019/01/31 14:19:12 /u01/app/12.1.0/grid/cdata/ol6-112-scan/backup_20190131_141912.ocr 811007039

    [root@ol6-112-rac2 ol6-112-scan]# cat crsd.trc | grep 'MASTER NAME'

    2019-01-31 16:53:35.919932 : CRSPE:1270863616: {2:31733:9} PE MASTER NAME: ol6-112-rac1

    ReplyDelete
    Replies
    1. May be you need to rely on oclumon . Refer https://docs.oracle.com/en/database/oracle/oracle-database/12.2/atnms/oclumon-manage.html#GUID-CF970862-EAD8-41F5-8CE7-3C50720CEE70

      Delete
  2. This command can also work -

    -bash-3.2$ . oraenv
    ORACLE_SID = [grid] ? +ASM1
    The Oracle base has been set to /opt/ora/app/grid
    -bash-3.2$
    -bash-3.2$
    -bash-3.2$ oclumon manage -get MASTER

    Master = testhlr01

    Done
    -bash-3.2$

    ReplyDelete
  3. command worked on 12.1 also ,

    oclumon manage -get MASTER

    ReplyDelete
  4. Excellent blog I visit this blog it's really awesome. The important thing is that in this blog content written clearly and understandable. The content of information is very informative.
    Workday Online Training
    Oracle Fusion HCM Online Training
    Oracle Fusion SCM Online Training
    Oracle Fusion Financials Online Training

    ReplyDelete
  5. Thank you! Its very useful information to get understand easily. Thank you so much and appreciated on you effort.

    ReplyDelete
  6. Very Nice Article.. Thank you brother!

    ReplyDelete