In this post, I will demonstrate dynamic remastering of the resources in RAC .In RAC, every data block is mastered by an instance. Mastering a block simply means that master instance keeps track of the state of the block until the next reco
In this post, I will demonstrate dynamic remastering of the resources in RAC . In RAC, every data block is mastered by an instance. Mastering a block simply means that master instance keeps track of the state of the block until the next reconfiguration event .When one instance departs the cluster, the GRD portion of that instance needs to be redistributed to the surviving nodes. Similarly, when a new instance enters the cluster, the GRD portions of the existing instances must be redistributed to create the GRD portion of the new instance. This is called dynamic resource reconfiguration. In addition to dynamic resource reconfiguration, This is called dynamic remastering. The basic idea is to master a buffer cache resource on the instance where it is mostly accessed. In order to determine whether dynamic remastering is necessary, the GCS essentially keeps track of the number of GCS requests on a per-instance and per-object basis. This means that if an instance, compared to another, is heavily accessing blocks from the same object, the GCS can take the decision to dynamically migrate all of that object’s resources to the instance that is accessing the object most. LMON, LMD and LMS processes are responsible for Dynamic remastering. – Remastering can be triggered as result of – Manual remastering – Resource affinity – Instance crash – CURRENT SCENARIO - - 3 node setup - name of the database – racdb — SETUP – – Get data_object_id for scott.empSYS> col owner for a10 col data_object_id for 9999999 col object_name for a15 select owner, data_object_id, object_name from dba_objects where owner = 'SCOTT' and object_name = 'EMP';
SQL>select empno, dbms_rowid.rowid_relative_fno(rowid), dbms_rowid.rowid_block_number(rowid) from scott.emp where empno in (7788, 7369);
[oracle@host01 ~]$ srvctl stop database -d racdb srvctl start database -d racdb srvctl status database -d racdb
SCOTT@NODE2> select * from emp;
– Find the GCS resource name to be used in the query x$kjbl.kjblname = resource name in hexadecimal format([id1],[id2],[type] x$kjbl.kjblname2 = resource name in decimal format Hexname will be used to query resource in V$gc_element and v$dlm_rss views get_resource_name
SYS@NODE2>col hexname for a25 col resource_name for a15 select b.kjblname hexname, b.kjblname2 resource_name, b.kjblgrant, b.kjblrole, b.kjblrequest from x$le a, x$kjbl b where a.le_kjbl=b.kjbllockp and a.le_addr = (select le_addr from x$bh where dbablk = 151 and obj = 73181 and class = 1 and state <> 3);
SYS>select o.object_name, m.CURRENT_MASTER, m.PREVIOUS_MASTER, m.REMASTER_CNT from dba_objects o, v$gcspfmaster_info m where o.data_object_id=73181 and m.data_object_id = 73181 ;
SYS@NODE2> select kj.kjblname, kj.kjblname2, kj.kjblowner, kj.kjblmaster from (select kjblname, kjblname2, kjblowner, kjblmaster, kjbllockp from x$kjbl where kjblname = '[0x97][0x4],[BL]' ) kj, x$le le where le.le_kjbl = kj.kjbllockp order by le.le_addr;
SYS@NODE2>oradebug lkdebug -m pkey 74625
SYS>select o.object_name, m.CURRENT_MASTER, m.PREVIOUS_MASTER, m.REMASTER_CNT from dba_objects o, v$gcspfmaster_info m where o.data_object_id=74625 and m.data_object_id = 74625 ;
SYS> select kj.kjblname, kj.kjblname2, kj.kjblowner, kj.kjblmaster from (select kjblname, kjblname2, kjblowner, kjblmaster, kjbllockp from x$kjbl where kjblname = '[0x97][0x4],[BL]' ) kj, x$le le where le.le_kjbl = kj.kjbllockp order by le.le_addr;
SYS>drop table scott.test purge; create table scott.test as select * from sh.sales; insert into scott.test select * from scott.test; commit; insert into scott.test select * from scott.test; commit; insert into scott.test select * from scott.test; commit; insert into scott.test select * from scott.test; commit;
SYS> col data_object_id for 9999999 col object_name for a15 select owner, data_object_id, object_name, object_id from dba_objects where owner = 'SCOTT' and object_name = 'TEST';
SYS> SET linesize 235 col Parameter FOR a20 col Instance FOR a10 col Description FOR a40 word_wrapped SELECT a.ksppinm "Parameter", c.ksppstvl "Instance", a.ksppdesc "Description" FROM x$ksppi a, x$ksppcv b, x$ksppsv c, v$parameter p WHERE a.indx = b.indx AND a.indx = c.indx AND p.name(+) = a.ksppinm AND UPPER(a.ksppinm) LIKE UPPER('%¶meter%') ORDER BY a.ksppinm; Enter value for parameter: gc_policy old 11: AND UPPER(a.ksppinm) LIKE UPPER('%¶meter%') new 11: AND UPPER(a.ksppinm) LIKE UPPER('%gc_policy%')
SYS>alter system set "_gc_policy_minimum" = 10 scope=spfile; alter system set "_gc_policy_time" = 1 scope=spfile;
[oracle@host01 ~]$ srvctl stop database -d racdb srvctl start database -d racdb srvctl status database -d racdb
SYS> SET linesize 235 col Parameter FOR a20 col Instance FOR a10 col Description FOR a40 word_wrapped SELECT a.ksppinm "Parameter", c.ksppstvl "Instance", a.ksppdesc "Description" FROM x$ksppi a, x$ksppcv b, x$ksppsv c, v$parameter p WHERE a.indx = b.indx AND a.indx = c.indx AND p.name(+) = a.ksppinm AND UPPER(a.ksppinm) LIKE UPPER('%¶meter%') ORDER BY a.ksppinm; old 11: AND UPPER(a.ksppinm) LIKE UPPER('%¶meter%') new 11: AND UPPER(a.ksppinm) LIKE UPPER('%gc_policy%') Enter value for parameter: gc_policy
SYS@NODE1>oradebug lkdebug -m pkey 74626 SCOTT@NODE1>select * from scott.test;
SYS@NODE1>select o.object_name, m.CURRENT_MASTER, m.PREVIOUS_MASTER, m.REMASTER_CNT from dba_objects o, v$gcspfmaster_info m where o.data_object_id=74626 and m.data_object_id = 74626 ;
SCOTT@NODE3>insert into scott.test select * from test;
SYS@NODE1>select inst_id, sopens, xopens from x$object_policy_statistics where object=74626;
SYS@NODE1>/
SYS@NODE1>/
SYS@NODE1>/
SYS@NODE2>select o.object_name, m.CURRENT_MASTER, m.PREVIOUS_MASTER, m.REMASTER_CNT from dba_objects o, v$gcspfmaster_info m where o.data_object_id=74626 and m.data_object_id = 74626 ;
16:09:16 SYS@NODE2>/
16:12:24 SYS@NODE2>/
root@node3#init 6
SYS@NODE2>select o.object_name, m.CURRENT_MASTER, m.PREVIOUS_MASTER, m.REMASTER_CNT from dba_objects o, v$gcspfmaster_info m where o.data_object_id=74626 and m.data_object_id = 74626 ;
SYS@NODE1>drop table scott.test purge; SYa@NODE1S> alter system reset "_gc_policy_minimum" = 10 scope=spfile; alter system reset "_gc_policy_time" = 1 scope=spfile; [oracle@host01 ~]$ srvctl stop database -d racdb srvctl start database -d racdb srvctl status database -d racdb