streams2ogg - oracle data warehouse community seite. create an oracle 12c streams test environment...

20
streams2ogg Migration Oracle Streams (OS) 12c to Oracle GoldenGate (OGG) 12c Last Updated: 22.05.2015

Upload: dodang

Post on 03-May-2018

246 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

streams2ogg

Migration

Oracle Streams (OS) 12c to Oracle GoldenGate (OGG) 12c

Last Updated: 22.05.2015

Page 2: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

Table of Contents

1. Assumptions and Requirements

2. Create an Oracle 12c Streams test environment

2.1. Database users, privileges and replication objects 2.2. Database Jobs and procedures 2.3. Streams configuration unidirectional from primary to secondary database 2.4. Streams configuration unidirectional from secondary to primary database

3. Migration Utility "streams2ogg"

3.1. Install Package "streams2ogg" 3.2. Run the procedures CUSTOMIZE and/or MAIN

4. Migration Streams to GoldenGate

4.1. Direction 1 - From NOCDBP to NOCDBS 4.1.1. Check and modify the GoldenGate parameter files 4.1.2. Transition and transaction states 4.1.3. Transition steps from OS to OGG for direction 1 4.1.4. GoldenGate and Streams processes after migration of direction 1 4.2. Direction 2 - From NOCDBS to NOCDBP 4.2.1. Check and modify the GoldenGate parameter files 4.2.2. Transition steps from OS to OGG for direction 2 4.2.3. GoldenGate and Streams processes after migration was finished

5. Scripts and Parameter Files Summary

5.1. SQL-Scripts 5.2. OBEY-Scripts (GGSCI commands) 5.2. OGG Parameter-Files

Page 3: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

1. Assumptions and Requirements

- Oracle Streams does not support the new Oracle 12c Multitenant Architecture You must use two traditional (non-container) databases. - Replication object is the heartbeat table: TSTSTR.STR_HEARTBEAT_Table - Oracle 12c Database initialization parameters ENABLE_GOLDENGATE_REPLICATION = TRUE (11.2.0.4 or 12.1.0.2 +) STREAMS_POOL_SIZE = (similar to Streams) GLOBAL_NAMES = TRUE

- Create a database directory with a file location of your choice to store the Streams install scripts (in this sample: ADM_STREAMS that pointed to d:\myfiles\00_misc\sql) - All used sample SQL-Scripts are named with prefix "STR12_" - Oracle Streams administration user: STRADMIN - Oracle GoldenGate software is installed (Version: 12.1.2.0.0) - Oracle GoldenGate administration user: OGGADMIN - Migration Utility "streams2ogg" generates parameters for GoldenGate Integrated processes Integrated Capture supported in Oracle 11.2.0.4 + Integrated Apply supported in Oracle 12c (12.1.0) + If you need Classic Capture or Classic Apply you must change the parameter files. - Migration Utility "streams2ogg" generates parameter files for GoldenGate version 12.1.2.1. If you use an older version of GoldenGate you must: 1. change the parameters (generated by "streams2ogg" MAIN procedure) or 2. change parameter "OGG VERSION" in the "ogg_name_map.csv" to "12.1.2.0" - Transition from Oracle Streams to Oracle GoldenGate required a running Streams replication.

Note: Oracle Streams test environment must be created because Oracle Streams replication was not more used since years but it is needed to demonstrate a sample Oracle Streams replacement using the migration utility "streams2ogg"

Page 4: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

2. Create an Oracle 12c Streams test environment

Primary Database name: NOCDBP Secondary Database name: NOCDBS

Oracle Streams environment before migration with process names

2.1. Database users, privileges and replication objects

Create the Streams tablespaces: STR12_Create_TS_STREAMS.sql Create the Streams admin users: STR12_Create_STRADMIN.sql

Create database links between the two databases: STR12_Create_Admin_DB_Links.sql Create users TSTSTR: STR12_Create_TSTSTR.sql Create the heartbeat tables: STR12_Create_HB_Tables.sql

Create primary key for heartbeat tables: STR12_Create_PK.sql Create User OGGADMIN: STR12_Create_OGGADMIN.sql

Set supplemental & force logging: STR12_Set_Database_Logging.sql Set supplemental logging for heartbeat table STR12_Set_Table_Logging.sql

2.2. Database jobs and procedures In both databases each minute a job is running and execute the update procedure to keep the timestamp in the heartbeat table current. Create procedure STR_HEARTBEAT_PROC_P STR12_Create_PROC_P.sql Create procedure STR_HEARTBEAT_PROC_S STR12_Create_PROC_S.sql Create procedure STR_HEARTBEAT_Job_P STR12_Create_Job_P.sql Create procedure STR_HEARTBEAT_Job_S STR12_Create_Job_S.sql

2.3. Streams configuration unidirectional from primary to secondary database

- To configure Streams I use the high level interface DBMS_STREAMS_ADM.MAINTAIN_TABLES - Configuration without instantiation, Instantiate the target table later.

Page 5: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

- Configuration direction 1 (P-S) STR12_P-S_01_Define_Script_NoInst.sql

BEGIN

DBMS_STREAMS_ADM.MAINTAIN_TABLES(

table_names => 'TSTSTR.STR_HEARTBEAT_TABLE',

script_name => 'STR12_P-S_02_Install_Streams_NoInst.SQL',

script_directory_object => 'ADM_STREAMS',

source_directory_object => NULL,

destination_directory_object => NULL,

perform_actions => FALSE,

capture_name => 'C_CN1_NOCDBP',

capture_queue_name => 'C_QN1_NOCDBP',

capture_queue_table => 'C_QT1_NOCDBP',

capture_queue_user => 'STRADMIN',

propagation_name => 'P_PN1_NOCDBP',

apply_name => 'A_AN1_NOCDBS',

apply_queue_name => 'A_QN1_NOCDBS',

apply_queue_table => 'A_QT1_NOCDBS',

apply_queue_user => 'STRADMIN',

bi_directional => FALSE,

include_ddl => TRUE,

source_database => 'NOCDBP.DE.ORACLE.COM',

destination_database => 'NOCDBS.DE.ORACLE.COM',

instantiation => DBMS_STREAMS_ADM.INSTANTIATION_NONE);

END;

Note: I use "bi_directional => FALSE" because the names of the Streams processes should not be the same for both directions. After this procedure was running at the primary database I run this procedure at the secondary database with different process names. - After this step the Streams install script "STR12_P-S_02_Install_Streams_NoInst.sql" was created in the database directory. - Modify this install script three times: Change "include_tagged_lcr => TRUE" to "include_tagged_lcr => FALSE" 1. "dbms_streams_adm.add_table_propagation_rules" 2. "dbms_streams_adm.add_table_rules" (Streams_type => Capture) 3. "dbms_streams_adm.add_table_rules" (Streams Type => Apply) With parameter "FALSE" default tagging will be used and "change-cycling" is suppressed. 1. Apply process tags each applied transaction with tag "00" 2. Capure process will be configured with a default rule which excludes LCRs with tag "00" - Add a "SPOOL …" and "SPOOL OFF" Command for better information in case of failure: SPOOL D:\myfiles\00_misc\sql\STR12_P-S_02_Install_Streams_NoInst.txt ...

SPOOL OFF - Run the Streams install script (Direction 1): STR12_P-S_02_Install_Streams_NoInst.sql - Instantiation target table in database NOCDBS: STR12_P-S_03_Table_Instantiation.sql

Note: After instantiation replication begins and aborted immediately because the CURRENT_TIME before image of the primary database table row is different compared with this row in the secondary database.

Page 6: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

ORA-26786: A row with key string exists but has conflicting column(s) string in table string

Cause: The row to update or delete exists in the table but had conflicting value

for some columns.

Action: For Streams, please define a conflict resolution, or resolve the conflict

and execute the error transaction using DBMS_APPLY_ADM.EXECUTE_ERROR.

For logical standby, please verify the status of the database guard to ensure

local modifications are not allowed, then re-instantiate the table and contact

support if the problem persists.

- Change Apply parameter "DISABLE_ON_ERROR=>TRUE" to "DISABLE_ON_ERROR=>FALSE" After this change Apply process will never be aborted after an error occurs. Run SQL-script: STR12_P-S_04_Disable_on_Error.sql - Create Conflict handler: STR12_P-S_05_Apply_Conflict_Handler.sql - Now you can re-execute all Apply errors: STR12_P-S_06_Execute_All_Errors.sql - Re-start the Apply process: STR12_Start_Apply_S.sql Now the Streams replication will be running unidirectional (Direction 1) from primary to secondary database. SQL-scripts to maintain replication direction 1: Start all Streams processes of direction 1: STR12_Start_Processes_P-S.sql

Stop all Streams processes of direction 1: STR12_Stop_Processes_P-S.sql Show Streams queues of direction 1: STR12_Show_Streams_Queues_P-S.sql

SQL-scripts to maintain primary database (xxxxx = Start or Stop): Start / Stop Capture process at primary Side: STR12_xxxxx_Capture_P.sql

Start / Stop Propagation process at primary Side: STR12_xxxxx_Propagation_P.sql Start / Stop Apply process at primary Side: STR12_xxxxx_Apply_P.sql

2.4. Streams configuration unidirectional from secondary to primary database

- In contrast to direction 1 this configuration will be initiated from the secondary database. - Configuration direction 1 (S-P) STR12_S-P_01_Define_Script_NoInst.sql BEGIN

DBMS_STREAMS_ADM.MAINTAIN_TABLES(

table_names => 'TSTSTR.STR_HEARTBEAT_TABLE',

script_name => 'STR12_S-P_02_Install_Streams_NoInst.SQL',

script_directory_object => 'ADM_STREAMS',

source_directory_object => NULL,

destination_directory_object => NULL,

perform_actions => FALSE,

capture_name => 'C_CN1_NOCDBS',

capture_queue_name => 'C_QN1_NOCDBS',

capture_queue_table => 'C_QT1_NOCDBS',

capture_queue_user => 'STRADMIN',

propagation_name => 'P_PN1_NOCDBS',

Page 7: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

apply_name => 'A_AN1_NOCDBP',

apply_queue_name => 'A_QN1_NOCDBP',

apply_queue_table => 'A_QT1_NOCDBP',

apply_queue_user => 'STRADMIN',

bi_directional => FALSE,

include_ddl => TRUE,

source_database => 'NOCDBS.DE.ORACLE.COM',

destination_database => 'NOCDBP.DE.ORACLE.COM',

instantiation => DBMS_STREAMS_ADM.INSTANTIATION_NONE);

END; - After this step the Streams install script "STR12_S-P_02_Install_Streams_NoInst.sql" was created in the database directory. - Modify this install script three times: Change "include_tagged_lcr => TRUE" to "include_tagged_lcr => FALSE" 1. "dbms_streams_adm.add_table_propagation_rules" 2. "dbms_streams_adm.add_table_rules" (Streams_type => Capture) 3. "dbms_streams_adm.add_table_rules" (Streams Type => Apply) With parameter "FALSE" default tagging will be used and "change-cycling" is suppressed. 1. Apply process tags each applied transaction with tag "00" 2. Capure process will be configured with a default rule which excludes LCRs with tag "00" - Add a "SPOOL …" and "SPOOL OFF" Command for better information in case of failure: SPOOL D:\myfiles\00_misc\sql\STR12_S-P_02_Install_Streams_NoInst.txt ... SPOOL OFF

- Run the Streams install script (Direction 2): STR12_S-P_02_Install_Streams_NoInst.sql

- Instantiation target table in database NOCDBS: STR12_S-P_03_Table_Instantiation.sql

Note: After instantiation replication begins and aborted immediately because the CURRENT_TIME before image of the heartbeat table in the secondary database is different compared with the primary database. - Change Apply parameter "DISABLE_ON_ERROR=>TRUE" to "DISABLE_ON_ERROR=>FALSE" After this change Apply process will never be aborted after an error occurs. Run SQL-script: STR12_S-P_04_Disable_on_Error.sql - Create a Conflict handler: STR12_S-P_05_Apply_Conflict_Handler.sql - Now you can re-execute all Apply errors: STR12_S-P_06_Execute_All_Errors.sql - Re-start the Apply process: STR12_Start_Apply_P.sql Now the Streams replication will be running bi-directional (in two directions) from primary to secondary database and vice versa. SQL-scripts to maintain replication direction 2: Start all Streams processes of direction 2: STR12_Start_Processes_S-P.sql

Stop all Streams processes of direction 2: STR12_Stop_Processes_S-P.sql Show Streams queues of direction 2: STR12_Show_Streams_Queues_S-P.sql

Page 8: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

SQL-scripts to maintain secondary database (xxxxx = Start or Stop): Start / Stop Capture process at secondary Side: STR12_xxxxx_Capture_S.sql

Start / Stop Propagation process at secondary Side: STR12_xxxxx_Propagation_S.sql Start / Stop Apply process at secondary Side: STR12_xxxxx_Apply_S.sql

3. Migration Utility "streams2ogg" The migration utility was announced at the Oracle Open World conference in October 2014. This tool will eliminate manual conversion errors and minimize the GoldenGate learning curve for Streams customers. For further information see the data sheet and the two My Oracle Support (MOS) notes: 1. Data Sheet: "Oracle Streams to Oracle GoldenGate Migration Utility" http://www.oracle.com/technetwork/middleware/goldengate/streamstoggutildatasheet-09172014-2311191.pdf

2. MOS note 1912338.1: "Documentation for Streams to GoldenGate Migration Tool" https://support.oracle.com 3. MOS note 1383303.1: "Best Practices: Oracle Streams to Oracle GoldenGate Conversion"

Action Description Comments

Prepare and run the migration utility: exec streams2ogg.<proc_name>

(Source & target database!)

Analyze your Oracle Streams environment and decide what you must migrate to OGG. Without parameter modifications: MAIN (one step) With modification of "csv" file: CUSTOMIZE (two step)

MOS Note: 1912338.1

Check (and modify) the configuration files

(Source & target database!)

If you have checked the configuration files and all looks well than you are ready to transition from Streams to GoldenGate

Stopping OS Starting OGG

Unidirectional – one direction

Bi-Directional – two directions

Check for open transactions and Apply errors Stop OS Apply at target database

Find last applied SCN from OS replication at the target database

Start OGG Replicate using AFTERCSN parm

Stop OS Capture and OS Propagation at source database

MOS Note: 1383303.1

How you can see migration utility does generate GoldenGate parameter files only. The transition from Oracle Streams to Oracle GoldenGate is subject of MOS note 1383303.1!

Note: Please read these support notes before you start the migration process!

Page 9: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

3.1. Install Package "streams2ogg"

Download and install the database package in all databases where Oracle Streams processes should be migrated to Oracle GoldenGate. You will be prompted for two parameters: 1. User name of the GoldenGate administrator (here: OGGADMIN for both databases) 2. A separate directory for each database configuration (here: "d:\temp\nocdbp" and "d:\temp\nocdbs") Default name of the created directory is "TEST_DIR1" (both databases)

3.2. Run the procedures CUSTOMIZE and/or MAIN

Migration utility procedure MAIN analyzes the database dictionary and looks for configured Oracle Streams processes. After execution is finished Streams processes are mapped to Oracle GoldenGate processes in the file "ogg_name_map.csv" and the appropriate parameter files for GoldenGate was created ("One step execution"). Procedure CUSTOMIZE does only map the process names and writes the "csv" file ("Two step execution"). In a second step MAIN procedure must be executed after the "csv" file was modified. This behavior is used that you can delete process entries these must not be migrate. MAIN procedure use an existing modified "csv" file to generate the GoldenGate parameter files.

-- Generated by streams2ogg (Version 3.0) 15.04.15 08:59:39,599000

C_CN1_NOCDBP,"e1nocdbp"

A_AN1_NOCDBP,"r_nocdbp"

P_PN1_NOCDBP,"p1nocdbp"

STRADMIN.C_QN1_NOCDBP,"aa"

./dirdat,"./dirdat"

MANAGER PORT,"7809"

DYNAMICPORTLIST,"15000-15040"

Conflict Detection,"Y"

OGG VERSION,"12.1.2.1"

DBLOGIN,"BOTH"

File "ogg_name_map.csv" after running "streams2ogg" (MAIN or CUSTOMIZE) for database NOCDBP

GoldenGate files (Database: NOCDBP) created by "streams2ogg" MAIN procedure: Parameter files

MGR.prm Manager process

E1NOCDBP.prm Extract (Capture) process Maps: C_CN1_NOCDBP

P1NOCDBP.prm Datapump process Maps: P_PN1_NOCDBP

R_NOCDBP.prm Apply (Replicat) process Maps: A_AN1_NOCDBP

NOCDBP_STRADMIN.prm Login information

Page 10: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

OBEY files

GGCONFIG.oby GoldenGate config commands

GGCONFIG2.prm Only if multiple Streams Capture processes (empty)

GGCONFIG_TRANDATA.oby ADD SCHEMATRANDATA command

Handler files

HANDLERS.sql Script to attach the Streams Apply DML and error handlers to Integrated Apply (empty, because no handler used)

GoldenGate files (Database: NOCDBS) created by "streams2ogg" MAIN procedure: Parameter files

MGR.prm Manager process

E1NOCDBS.prm Extract (Capture) process Maps: C_CN1_NOCDBS

P1NOCDBS.prm Datapump process Maps: P_PN1_NOCDBS

R_NOCDBS.prm Apply (Replicat) process Maps: A_AN1_NOCDBS

NOCDBP_STRADMIN.prm Login information

OBEY files

GGCONFIG.oby GoldenGate config commands

GGCONFIG2.prm Only if multiple Streams Capture processes (empty)

GGCONFIG_TRANDATA.oby ADD SCHEMATRANDATA command

Handler files

HANDLERS.sql Script to attach the Streams Apply DML and error handlers to Integrated Apply (empty, because no handler used)

Processes for Replication Direction 1 (from NOCDBP to NOCDBS)

Processes for Replication Direction 2 (from NOCDBS to NOCDBP)

Page 11: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

4. Migration Streams to GoldenGate 4.1. Direction 1 - From NOCDBP to NOCDBS 4.1.1. Check and modify the GoldenGate parameter files A list with explanation of all generated GoldenGate configuration files is part of the MOS note 1912338.1 (Pages 20-22). For this example not all of the files are needed. Here the modifications of the files for migration direction 1: MGR.prm - TCP/IP port must be unique, if more than one is running on the same machine: OGG instance 1 (Database NOCDBP) - Port 7816 OGG instance 2 (Database NOCDBS) - Port 7817 NOCDBP_OGGADMIN.prm - Renamed file NOCDBP_STRADMIN.prm because GoldenGate administrator is OGGADMIN. UserID, TNSAlias and password changed. OGG instance 1 (NOCDBP) - userid oggadmin@nocdbp password OGGADMIN

OGG instance 2 (NOCDBS) - userid oggadmin@nocdbs password OGGADMIN GGCONFIG.oby - GoldenGate config commands outcommended

OGG instance 1 (NOCDBP) - Commands for Apply process OGG instance 2 (NOCDBS) - Commands for Capture and Datapump processes Note: The migration utility generates parameter files based of GoldenGate 12.1.2.1. Therefore I must change or delete/outcommend the following parameters: GoldenGate Extract parameter:

TRANLOGOPTIONS EXCLUDETAG + TRANLOGOPTIONS EXCLUDETAG 00 GoldenGate Replicat parameter:

DBOPTIONS _NO_DISABLE_ON_RETRY_ERROR Outcommended This is not required if you change the parameter OGG VERSION to "12.1.2.0" in "ogg_name_map.csv" before you generate the parameter files with the MAIN procedure of "streams2ogg".

Page 12: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

4.1.2. Transition and transaction states

1 Transactions that start and commit before GoldenGate Extract is created are managed by Streams. 2 Transactions that start before GoldenGate Extract is created and commit after the Extract is created but before the Streams Capture is stopped are replicated by Streams. 3 Transactions that are processed between the time that GoldenGate Extract is started and the Streams Capture is stopped are pushed from source to target by both, Streams Capture and GoldenGate Extract. Who will replicate depends from the time where Streams Apply is stopped. 4 Transactions that start after the Extract is created and before the Capture is stopped, but commit after the Streams Capture is stopped are managed by GoldenGate. 5 Transactions that are processed after Extract is started and Capture is stopped are managed by GoldenGate 6 Changes that started before the GoldenGate Extract was created and commited after the Streams Capture was stopped are ignored by any processes. This is why you must insure that there are no open transactions that were started before Extract was started!

4.1.3. Transition Steps from OS to OGG for direction 1 1. Create the GoldenGate Extract and Pump processes (Source: NOCDBP) GGSCI: obey ggconfig.oby 2. Start the GoldenGate Extract and Pump processes (Source: NOCDBP) GGSCI: start manager (if not yet running) start e1nocdbp

start p1nocdbp

Page 13: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

3. Create the GoldenGate Replicat process (Target: NOCDBS) GGSCI: obey ggconfig.oby 4. Check source database for long running transactions (NOCDBP) SQLPlus: STR12_Show_Long_Running_TRX_P.sql Note: Ignore it for the test case, this is only required if: 1. Transactions was running before GoldenGate Capture started and 2. These transaction are subject of replication 5. Change COMMIT_SERIALIZATION to FULL SQLPlus: STR12_Set_Commit_Serialization_P.sql Note: This is only required if you replicate many transactions with dependences. In this test case you can ignore it! 6. Stop and check Streams Apply process and find last applied SCN (Target: NOCDBS) SQLPlus: STR12_Stop_Apply_S.sql

STR12_Show_Apply_Errors_S.sql

STR12_Show_last_applied_SCN_S.sql

Check that are no Apply errors in the error queue and pick up last SCN (In case of Apply errors you must clear the queue, e.g. solve & re-execute or delete.) 7. Start GoldenGate Replicat process using AFTERCSN parameter (Target: NOCDBS) GGSCI: start replicat R_NOCDBS aftercsn <last_scn_step_6>

Check that GoldenGate Replicat is started and running. 8. Stop Streams Capture and Propagation processes on source database NOCDBP SQLPlus: STR12_Stop_Capture_P.sql

STR12_Stop_Propagation_P.sql

9. Remove migrated Streams processes in primary and secondary databases (see note 1383303.1, pages 10+11 before) SQLPlus: NOCDBP: STR12_Remove_Cap_Pro_P.sql

STR12_Remove_Capture_Queues_P.sql

NOCDBS: STR12_Remove_App_S.sql

STR12_Remove_Apply_Queues_S.sql

Note: Remove of Capture and Apply (Delete of unused rulesets included). Remove of Capture and Apply queues includes delete of queue tables.

Page 14: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

4.1.4. GoldenGate and Streams processes after migration of direction 1

Oracle Streams and Oracle GoldenGate environment after migration of direction 1

Primary database NOCDBP

Secondary database NOCDBS

Note: Please take a look at the Column "QUEUE_OWNER" and you can recognize where the owner of the process is Streams or GoldenGate. Here you see it is helpful to define different admin user for Streams and GoldenGate.

Page 15: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

4.2. Direction 2 - From NOCDBS to NOCDBP 4.2.1. Check and modify the GoldenGate parameter files Here the modifications of the files for the second migration direction: MGR.prm - done (see 4.1.1.) NOCDBP_OGGADMIN.prm - done (see 4.1.1.) GGCONFIG.oby - GoldenGate config commands outcommended (Please see also 4.1.1.) OGG instance 1 (NOCDBP) - Commands for Capture and Datapump processes OGG instance 2 (NOCDBS) - Commands for Apply processes

4.2.2. Transition Steps from OS to OGG for direction 2 1. Create the GoldenGate Extract and Pump processes (Source: NOCDBS) GGSCI: obey ggconfig.oby 2. Start the GoldenGate Extract and Pump processes (Source: NOCDBS) GGSCI: start manager (if not yet running) start e1nocdbs

start p1nocdbs

3. Create the GoldenGate Replicat process (Target: NOCDBP) GGSCI: obey ggconfig.oby

4. Check source database for long running transactions (NOCDBS) SQLPlus: STR12_Show_Long_Running_TRX_S.sql

Note: This is only required if 1. Transactions was running before GoldenGate Capture started and 2. These transactions are part of replication 3. In this test case you can ignore it! 5. Change COMMIT_SERIALIZATION to FULL SQLPlus: STR12_Set_Commit_Serialization_S.sql

Note: This is only required if you replicate many transactions with dependences. In this test case you can ignore it!

Page 16: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

6. Stop and check Streams Apply process and find last applied SCN (Target: NOCDBP) SQLPlus: STR12_Stop_Apply_P.sql

STR12_Show_Apply_Errors_P.sql

STR12_Show_last_applied_SCN_P.sql

Check that are no Apply errors in the error queue and pick up last SCN (In case of Apply errors you must clear the queue, e.g. solve & re-execute or delete.) 7. Start GoldenGate Replicat process using AFTERCSN parameter (Target: NOCDBP) GGSCI: start replicat R_NOCDBP aftercsn <last_scn_step_6>

Check that GoldenGate Replicat is started and running. 8. Stop Streams Capture and Propagation processes on source database NOCDBS SQLPlus: STR12_Stop_Capture_S.sql

STR12_Stop_Propagation_S.sql

9. Remove migrated Streams processes in primary and secondary databases

(see also 4.1.3 step 9) SQLPlus: NOCDBS: STR12_Remove_Cap_Pro_S.sql

STR12_Remove_Capture_Queues_S.sql

NOCDBP: STR12_Remove_App_P.sql

STR12_Remove_Apply_Queues_P.sql

Page 17: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

4.2.3. GoldenGate and Streams processes after migration was finished

Oracle Streams and Oracle GoldenGate environment after finished both migration directions

Primary database NOCDBP

Secondary database NOCDBS

Note: "QUEUE_OWNER" for all processes is now "OGGADMIN". With other words all Streams components was removed successfuly.

Page 18: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

5. Scripts and Parameter Files Summary 5.1. SQL-Scripts

Name Description Both databases (NOCDBP & NOCDBS)

STR12_Create_TS_Streams.sql Create Tablespace TS_STREAMS in both databases

STR12_Create_STRADMIN.sql Create and authorize user STRADMIN in both databases

STR12_Create_ADMIN_DB_Links.sql Create database links between both databases (link name = db name)

STR12_Create_TSTSTR.sql Create user TSTSTR in both databases

STR12_Create_HB_Tables.sql Create table TSTSTR.STR_HEARTBEAT_TABLE (The replication object)

STR12_Create_PK.sql Create primary key PK_DB_NAME on column DB_NAME

STR12_Create_OGGADMIN.sql Create and authorize user OOGADMIN in both databases

STR12_Set_Database_Logging.sql Setup database SUPPLEMENTAL LOG DATA and FORCE LOGGING

STR12_Set_Table_Logging.sql Setup table SUPPLEMENTAL LOG DATA (ALL) COLUMNS

Automatic update configuration HB table in NOCDBP

STR12_Create_Job_P.sql Create database job, that executes an update procedure (NOCDBP)

STR12_Create_PROC_P.sql Create update procedure (Job executes it one time per minute) Automatic update configuration HB table in NOCDBS

STR12_Create_Job_S.sql Create database job, that executes an update procedure (NOCDBS)

STR12_Create_PROC_S.sql Create update procedure (Job executes it one time per minute) Streams setup primary to secondary database

STR12_P-S_01_Define_Script_NoInst.sql Streams define script (Build the Streams install script) P-S Direction

STR12_P-S_02_Install_Streams_NoInst.SQL Streams Install script (Setup replication components, P-S direction)

STR12_P-S_03_Table_Instantiation.sql Explicit table instantiation (Because not made by install script)

STR12_P-S_04_Disable_on_Error.sql Set parameter DISABLE_ON_ERROR to FALSE (Tolerate Apply Errors)

STR12_P-S_05_Apply_Conflict_Handler.sql Set an Apply conflict handler (Conflict resolution) in NOCDBS

STR12_P-S_06_Execute_all_Errors.sql Re-execute all Apply errors after conflict handler is activated

STR12_Start_Processes_P-S.sql Start Streams processes Capture, Propagation and Apply (Direction 1)

STR12_Stop_Processes_P-S.sql Stop Streams processes Capture, Propagation and Apply (Direction 1)

STR12_Show_Streams_Queues_P-S.sql Show the Capture and Apply queues of replication direction 1

Streams setup secondary to primary database

STR12_S-P_01_Define_Script_NoInst.sql Streams define script (Build the Streams install script) S-P Direction

STR12_S-P_02_Install_Streams_NoInst.SQL Streams Install script (Setup replication components, S-P direction)

STR12_S-P_03_Table_Instantiation.sql Explicit table instantiation (Because not made by install script)

STR12_S-P_04_Disable_on_Error.sql Set parameter DISABLE_ON_ERROR to FALSE (Tolerate Apply Errors)

STR12_S-P_05_Apply_Conflict_Handler.sql Set an Apply conflict handler (Conflict resolution) in NOCDBP

STR12_S-P_06_Execute_all_Errors.sql Re-execute all Apply errors after conflict handler is activated

STR12_Start_Processes_S-P.sql Start Streams processes Capture, Propagation and Apply (Direction 2)

STR12_Stop_Processes_S-P.sql Stop Streams processes Capture, Propagation and Apply (Direction 2)

STR12_Show_Streams_Queues_S-P.sql Show the Capture and Apply queues of replication direction 2

Show Streams information

STR12_Show_Streams_Processes_short.sql Show specific Streams processes of both databases (HTML-Format)

STR12_Show_Streams_Processes.sql Show Streams processes of both databases (HTML-Format)

STR12_Show_Streams_Parameters_P.sql Show the Streams Parameter (Capture, Apply) of database NOCDBP

STR12_Show_Streams_Parameters_S.sql Show the Streams Parameter (Capture, Apply) of database NOCDBS

Page 19: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

SQL-Scripts (Cont.)

Name Description Check Oracle Streams configuration

STR12_Streams_HC_121_NOCDBP (HTML-Format) Streams Healthcheck 12.1 for database NOCDBP

STR12_Streams_HC_121_NOCDBS (HTML-Format) Streams Healthcheck 12.1 for database NOCDBS Show database object contents / status

STR12_Show_Heartbeat_Tables.sql Contents of the both heartbeat tables

STR12_Show_Heartbeat_Jobs.sql Status of the both heartbeat jobs (enabled/disabled)

STR12_Enable_Job_x.sql (x=P primary DB, x=S secondary DB) Start heartbeat job in database NOCDBP or NOCDBS

STR12_Disable_Job_x.sql (x=P primary DB, x=S secondary DB) Stop heartbeat job in database NOCDBP or NOCDBS Maintain Streams primary database NOCDBP

STR12_Start_Capture_P.sql Start Streams Capture process for primary database

STR12_Start_Propagation_P.sql Start Streams Propagation process for primary database

STR12_Start_Apply_P.sql Start Streams Apply process for primary database

STR12_Stop_Capture_P.sql Stop Streams Capture process for primary database

STR12_Stop_Propagation_P.sql Stop Streams Propagation process for primary database

STR12_Stop_Apply_P.sql Stop Streams Apply process for primary database

Maintain Streams secondary database NOCDBS

STR12_Start_Capture_S.sql Start Streams Capture process for secondary database

STR12_Start_Propagation_S.sql Start Streams Propagation process for secondary database

STR12_Start_Apply_S.sql Start Streams Apply process for secondary database

STR12_Stop_Capture_S.sql Stop Streams Capture process for secondary database

STR12_Stop_Propagation_S.sql Stop Streams Propagation process for secondary database

STR12_Stop_Apply_S.sql Stop Streams Apply process for secondary database

Show migration information

STR12_Show_last_applied_SCN_P Show last applied Streams SCN from database NOCDBP

STR12_Show_last_applied_SCN_S Show last applied Streams SCN from database NOCDBS

STR12_Show_Long_Running_TRX_P Show long running transactions for database NOCDBP

STR12_Show_Long_Running_TRX_S Show long running transactions for database NOCDBS

Remove Streams processes of direction 1

STR12_Remove_Cap_Pro_P.sql Stop & Drop Capture & Propagation of database NOCDBP

STR12_Remove_App_S.sql Stop & Drop Apply of database NOCDBS

STR12_Remove_Capture_Queues_P.sql Remove Capture Queues (Normal & Exception) of NOCDBP

STR12_Remove_Apply_Queues_S.sql Remove Apply Queues (Normal & Exception) of NOCDBS

Remove Streams processes of direction 2

STR12_Remove_Cap_Pro_S.sql Stop & Drop Capture & Propagation of database NOCDBS

STR12_Remove_App_P.sql Stop & Drop Apply of database NOCDBP

STR12_Remove_Capture_Queues_S.sql Remove Capture Queues (Normal & Exception) of NOCDBS

STR12_Remove_Apply_Queues_P.sql Remove Apply Queues (Normal & Exception) of NOCDBP

Page 20: streams2ogg - Oracle Data Warehouse Community Seite. Create an Oracle 12c Streams test environment Primary Database name: NOCDBP Secondary Database name: NOCDBS Oracle Streams environment

5.2. OBEY-Scripts (GGSCI commands)

Name Description OBEY script for config OGG at primary database NOCDBP

GGCONFIG.oby Direction 1: Configure only Capture and Datapump processes Direction 2: Configure only Apply process

GGCONFIG_TRANDATA.oby GGSCI command: ADD SCHEMATRANDATA

OBEY script for config OGG at secondary database NOCDBS

GGCONFIG.oby Direction 1: Configure only Apply pocess Direction 2: Configure only Capture and Datapump processes

GGCONFIG_TRANDATA.oby GGSCI command: ADD SCHEMATRANDATA

Processes for Replication Direction 1 (from NOCDBP to NOCDBS)

Processes for Replication Direction 2 (from NOCDBS to NOCDBP)

5.3. OGG Parameter-Files

Name Description

OGG Processes primary OGG instance (Database NOCDBP) mgr.prm Manager process

e1nocdbp.prm Capture pocess

p1nocdbp.prm Datapump process r_nocdbp.prm Apply process

nocdbp_oggadmin.prm Database login data

OGG Processes secondary OGG instance (Database NOCDBS) mgr.prm Manager process

e1nocdbs.prm Capture pocess

p1nocdbs.prm Datapump process r_nocdbs.prm Apply process

nocdbs_oggadmin.prm Database login data