Tuesday, March 28, 2017

Find the Resource Master


In RAC, every data block is mastered by an instance. Mastering a block means that master instance keeps track of the state of the block until the next reconfiguration event.

Re-mastering might be triggered because of below reasons :-
    1) Instance crash
    2) Resource affinity
    3) Manually


SYS@orcl1>select * from dept;

    DEPTNO DNAME          LOC
---------- -------------- -------------
        10 ACCOUNTING     NEW YORK
        20 RESEARCH         DALLAS
        30 SALES               CHICAGO
        40 OPERATIONS     BOSTON


#Let's find the object-id of dept table


SYS@orcl1>select owner, data_object_id, object_name from dba_objects where owner = 'SYS' and object_name = 'DEPT';

OWNER      DATA_OBJECT_ID OBJECT_NAME
---------- -------------- ---------------------------------
SYS                 74809             DEPT


#Let's manually master the DEPT table to node1


SYS@orcl1> oradebug lkdebug -m pkey <objectid>
SYS@orcl1>oradebug lkdebug -m pkey 74809
Statement processed.


#Let's find the master node from v$gcspfmaster_info using data_object_id


SYS@orcl1>select o.object_name, m.CURRENT_MASTER from   dba_objects o, v$gcspfmaster_info m where o.data_object_id=74809 and m.data_object_id = 74809 ; 

OBJECT_NAME     CURRENT_MASTER
--------------- -------------------------------------
DEPT                         0


# Means current master is node 1 as node numbering starts from 0

Happy Learning !!

No comments:

Post a Comment