Download presentation
Presentation is loading. Please wait.
Published byKayden Waddington Modified over 9 years ago
1
prligence Empowering Intelligence 1 Painless Master Table Alter In Replication Paper # 524 Arup Nanda prligence Empowering Intelligence
2
prligence Empowering Intelligence 2 Question Two Most Important Objectives of Living Organisms Surviving Reproducing!
3
prligence Empowering Intelligence 3 Replication Options Revisited MASTERCOPY
4
prligence Empowering Intelligence 4 Multi-Master MASTERCOPY Trigger Snapshot Logs ROW1 push ROW2 Trigger Snapshot Logs ROW2 PrimarySecondary
5
prligence Empowering Intelligence 5 Multi-Master contd. Can be Used in Disaster Recovery Can be SYNCHRONOUS Secondary Copy Useful for Transactions Bidirectional Flow of Data _ Changes are PUSHED to secondary Advantages
6
prligence Empowering Intelligence 6 Multi-Master contd. Continuosly Available Link Required Conflict Resolution Logic Needed Can Strain the Database _ Disadvantages
7
prligence Empowering Intelligence 7 Updateable Snapshot MASTERSNAPSHOT Trigger Snapshot Logs ROW1 pull ROW2 Trigger Snapshot Logs ROW2 push CREATE SNAPSHOT MYSNAP FOR UPDATE AS SELECT * FROM MASTER@MAINDB
8
prligence Empowering Intelligence 8 Updateble Snapshots contd. Changes are PULLED rather than pushed Advantages Controlled from Secondary Side Continuous Link Not Needed Can be Used in Disaster Recovery _
9
prligence Empowering Intelligence 9 Updateable Snapshots contd. Disadvantages Conflict Management Difficult Setup and Administration Strain on Resources Cannot be SYNCHRONOUS Reporting Requirements – Overkill _
10
prligence Empowering Intelligence 10 Read Only Snapshot MASTERSNAPSHOT Trigger Snapshot Logs ROW1 pull PrimarySecondary
11
prligence Empowering Intelligence 11 Read Only Snapshots contd. PULLED Controlled by Secondary Disadvantages Cannot be Used in Disaster Recovery Advantages No Conflict Management Simple Setup Less Strain on Resources Continuous Link Not Needed _
12
prligence Empowering Intelligence 12 Altering The Master Table EMPNOENAMESAL 1CHARLIE1000 2DAN1500 COMM 100 120 PROD REPL Not captured in Refresh Process EMPNOENAMESALCOMM 1CHARLIE1000100 2DAN1500120 EMPNOENAMESAL 1CHARLIE1000 2DAN1500
13
prligence Empowering Intelligence 13 Documented EMPNOENAMESALCOMM 1CHARLIE1000100 2DAN1500120 PROD REPL EMPNOENAMESAL 1CHARLIE1000 2DAN1500 X Drop the Snasphot
14
prligence Empowering Intelligence 14 Documented EMPNOENAMESALCOMM 1CHARLIE1000100 2DAN1500120 PROD REPL EMPNOENAMESALCOMM 1CHARLIE1000100 2DAN1500120 Recreate the Snapshot
15
prligence Empowering Intelligence 15 Documented Process Drop Snapshot (Snapsite) Add Column to Master Table (Master) Create Snapshot (Snapsite) Refresh Snapshot (Snapsite)
16
prligence Empowering Intelligence 16 Problem Time Consuming Rollback Segment Space Needed ORA-1555 Temporary Segment Space Needed Space Needed in Target Tablespace
17
prligence Empowering Intelligence 17 Database Example Schema Owner : ANANDA Table TEST1 –COL1CHAR(1) –COL2CHAR(1)
18
prligence Empowering Intelligence 18 Prepping the Master Site Creating the Snapshot Log As user ANANDA CREATE SNAPSHOT LOG ON TEST1 TABLESPACE USER_DATA WITH PRIMARY KEY INCLUDING NEW VALUES;
19
prligence Empowering Intelligence 19 Create Repl Group As REPADMIN User DBMS_REPCAT. CREATE_MASTER_REPGROUP ( GNAME=>'TEST1', QUALIFIER=>'', GROUP_COMMENT=>’TEST SNAPSHOT’ ); Group Name
20
prligence Empowering Intelligence 20 Generate Master RepObject DBMS_REPCAT. CREATE_MASTER_REPOBJECT( GNAME=>'TEST1', TYPE=>'TABLE', ONAME=>'TEST1', SNAME=>'ANANDA' ); Group Name Table Name Schema Name
21
prligence Empowering Intelligence 21 Generate Repl Support DBMS_REPCAT. GENERATE_REPLICATION_SUPPORT( SNAME=>'ANANDA', ONAME=>'TEST1', TYPE=>'TABLE', MIN_COMMUNICATION=>TRUE ); Schema Name Object Name
22
prligence Empowering Intelligence 22 Resume Master Activity DBMS_REPCAT. RESUME_MASTER_ACTIVITY( GNAME=>'TEST1'); Group Name
23
prligence Empowering Intelligence 23 Make the Refresh Group At Database REPL as user MVADMIN DBMS_REFRESH.MAKE( NAME=>'MVADMIN.TEST1', NEXT_DATE=>SYSDATE+5/(24*60), INTERVAL=>'SYSDATE+5/(24*60)' ); Group Name
24
prligence Empowering Intelligence 24 Make the Snapshot Group At Database REPL as user MVADMIN DBMS_REPCAT. CREATE_SNAPSHOT_REPGROUP( GNAME=>'TEST1', MASTER=>'PROD', PROPAGATION_MODE=> ‘ASYNCHRONOUS’ ); Group Name Master Database
25
prligence Empowering Intelligence 25 Create the Snapshot At Database REPL as user ANANDA CREATE SNAPSHOT TEST1 REFRESH FAST AS SELECT * FROM TEST1@PROD
26
prligence Empowering Intelligence 26 Add Snapshot to Group At Database REPL as user ANANDA DBMS_REFRESH.ADD ( NAME=>'MVADMIN.TEST1', LIST=>'ANANDA.TEST1' ); Group Name Object Name
27
prligence Empowering Intelligence 27 Generate Repl Support At Database REPL as user MVADMIN DBMS_REPCAT. CREATE_SNAPSHOT_REPOBJECT( GNAME=>'TEST1', SNAME=>'ANANDA', ONAME=>'TEST1', TYPE=>'SNAPSHOT' ) Group Name Schema Name Object Name
28
prligence Empowering Intelligence 28 Most Expensive CREATE SNAPSHOT TEST1 REFRESH FAST AS SELECT * FROM TEST1@PROD
29
prligence Empowering Intelligence 29 Prebuilt Table PROD TEST1 SNAPSHOT LOGS TEST1 EXPORT/IMPORT SQL*LOADER DIRECT PATH DIRECT PATH INSERT CREATE TABLE AS SELECT REPL SNAPSHOT LOGS SNAPSHOT FAST REFRESH
30
prligence Empowering Intelligence 30 Usual Method CREATE SNAPSHOT TEST1 REFRESH FAST AS SELECT * FROM TEST1@PROD
31
prligence Empowering Intelligence 31 Prebuilt Table CREATE SNAPSHOT TEST1 ON PREBUILT TABLE REFRESH FAST AS SELECT * FROM TEST1@PROD
32
prligence Empowering Intelligence 32 Needed Changes Add a column COL3 CHAR(1) Modify column COL2 CHAR(1000) As user ANANDA in PROD Database ALTER TABLE TEST1 ADD (COL3 CHAR(1); ALTER TABLE TEST1 MODIFY (COL2 CHAR(1000));
33
prligence Empowering Intelligence 33 Snapshot on Prebuilt Table TEST1 TABLE SNAPSHOT TEST1 is a TABLE CREATE SNASPSHOT TEST1 ON PREBUILT TABLE AS …. DROP SNASPHOT TEST1 TEST1 is a TABLE again!
34
prligence Empowering Intelligence 34 SNAPSHOT IS CREATED ON PREBUILT TABLE SNAPSHOT IS DROPPED COL3 IS ADDED TO THE TABLE SNAPSHOT IS RECREATED ON THE TABLE Segment State COL1 CHAR(1) COL2 CHAR(1) SNAPSHOT ROW3 ROW2 ROW1 TEST1 COL3 CHAR(1) SNAPSHOT
35
prligence Empowering Intelligence 35 Segment State Analysis Snapshot is Dropped Segment Reverts to Table Column Is Added Snapshot is Recreated Segment Becomes Snapshot TIME The state of the segment, i.e. the data is the same at these two points in time; only the additional column is different. Therefore, a FULL Refresh Is NOT Needed!
36
prligence Empowering Intelligence 36 Stop Any Refresh SELECT JOB FROM USER_REFRESH WHERE RNAME = 'TEST1'; EXEC DBMS_JOB.BROKEN (,TRUE); COMMIT; SELECT SID FROM DBA_JOBS_RUNNING WHERE JOB = ;
37
prligence Empowering Intelligence 37 Add the Columns DROP SNAPSHOT TEST1; Snapshot dropped; Table remains ALTER TABLE TEST1 ADD (COL4 CHAR(1); ALTER TABLE TEST1 MODIFY (COL3 CHAR(1000));
38
prligence Empowering Intelligence 38 Potential Problem When a SNAPSHOT is Created on a Master Table, the Snashot Logs Entries are Erased Need to Capture Snapshot Log Entries MLOG$_ Table Name: THIS_IS_A_LONG_TABLE_NAME Snap Log Name: MLOG$_THIS_IS_A_LONG_TABLE
39
prligence Empowering Intelligence 39 Preserve the Log As User ANANDA COL PART_TAB_NAME NOPRINT NEW_VALUE PART_TAB_VAL SELECT SUBSTR(‘&TABNAME',1,20) PART_TAB_NAME FROM DUAL / DROP TABLE MLOG_BAK / CREATE TABLE MLOG_BAK AS SELECT * FROM MLOG$_&&PART_TAB_VAL.@PROD / Table to Preserve Snapshot Log
40
prligence Empowering Intelligence 40 Recreate the Snapshot Build the Snapshot Add the Snapshot to the Refresh Group Build Replication Support for the Group
41
prligence Empowering Intelligence 41 Snapshot Log Table Reinstate the Log Entries INSERT INTO MLOG$_&&PART_TAB_VAL.@PROD SELECT * FROM MLOG_BAK / COMMIT / Table We Preserved the Snapshot Logs In
42
prligence Empowering Intelligence 42 Test the Refresh Do a Fast Refresh execute dbms_snapshot.refresh('TEST1','F') Re-run the Job execute dbms_job.run( )
43
prligence Empowering Intelligence 43 Dare to Compare? Elapsed Time USUAL APPROACHRECOMMENDED APPROACH 1m 5m 10 hr 1m 5m 1m Drop the Snapshot and Table Add Columns in Master NO NEED Recreate the Table Build the Snapshot Add the Snapshot to the Refresh Group Build Replication Support for the Group NO NEED Check Refresh Drop the Snapshot Add Columns in Master Preserve Snapshot Logs NO NEED Build the Snapshot Add the Snapshot to the Refresh Group Build Replication Support for the Group Reinstate Logs Check Refresh 10 hours 6 minutes 16 minutes
44
prligence Empowering Intelligence 44 Conclusion Elapsed Time Reduced As Much As 99% Resource Utilization Low All Processes Supported by Oracle No Data Dictionary Manipluation, No Underscore Parameters
45
prligence Empowering Intelligence 45 Thank You! Painless Master Table Alter In Replication Paper # 524 by Arup Nanda www.proligence.com
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.