GoldenGate for DB2 to Oracle

GoldenGate for DB2 to Oracle
Objective
Upon completion of this lesson, you will be able to configure GoldenGate to provide DB2 to Oracle synchronization. During this lesson, you will learn how to: Prepare your user environment. Configure and execute the initial data synchronization process. Configure and start the change capture process of database operations. Configure and start the change delivery process of database operations.

Unix DB2 to Oracle configuration
The following diagram illustrates a GoldenGate configuration for log-based replication from DB2 source data on UNIX to an Oracle target database on UNIX.
server <source> DB2 <database> Manager Source
<owner/schema>

server <target>

Manager

Network Extract Collector

Log

Trails

Oracle

Replicat

Target
<owner/schema>

Page 1

source definitions are generated and transfer to the target system. Configure Change Delivery Once the tables have been initially loaded with data. And finally. the GoldenGate application must be installed on both the source and target systems. you have limited choices. The source and target tables are created and loaded with initial data. Extract captures database changes directly from the DB2 logs and distributes them to files known as GoldenGate trails. Configure Initial Data Synchronization Initial database synchronization is almost always required. the Delivery process is configured to deliver the captured change data into the target database. The installation includes a sample database and scripts to generate initial data as well as subsequent update operations. To initially load data across heterogeneous databases. Page 2 . GoldenGate provides the ability to perform initial data synchronization while your application remains active.GoldenGate for DB2 to Oracle Overview of Tasks Prepare the Environment In order to execute this lesson. The GoldenGate Manager processes are also started so that other processes may be configured and started. This lesson demonstrates using Extract to pull data from the source files and send it directly to the Replicat component on the target system. <source> server DB2 <database> Network Source <owner/schema> <target> server Oracle Initial Extract Replicat Target <owner/schema> Configure Change Capture For log-based DB2.

sql scripts to ensure that the database connection information matches your system. Prepare the Environment Objective The goals of this exercise are to: Configure and start the Manager processes Prepare source and target sample databases Configure database connections Prepare the source UNIX DB2 environment 1.sql on the <source> system to create the source tables and load with data. Start the command interface Shell> cd <install location> Shell> ggsci Specify the port that the Manager should use. GGSCI> EDIT PARAMS MGR -. Configure the Manager process on the source Execute the following commands on the <source> system. Note: It is advisable to update the demo_db2_create.Exercise Name Exercise 1. Create source tables and load with initial data Execute the scripts demo_db2_create.GoldenGate Manager Parameter file PORT <port> Start Manager GGSCI> START MANAGER Verify the results: GGSCI> INFO MANAGER 2.sql and demo_db2_insert.sql and demo_db2_insert. Page 3 .

the data capture changes must be turned on by column and data type. Start the command interface Shell> cd <install location> Shell> ggsci Specify the port that the Manager should use. GGSCI> EDIT PARAMS MGR Page 4 . Shell> ggsci GGSCI> DBLOGIN SOURCEDB <database>.sql Shell> db2 –tf demo_db2_insert.Exercise Name Shell> cd <install location> Shell> db2 –tf demo_db2_create.sql Verify the results: Shell> db2 => db2 => db2 => db2 => db2 => db2 => db2 connect to <database> describe table tcustmer describe table tcustord select * from tcustmer select * from tcustord quit 3.TCUST* Prepare your target Oracle environment Configure the Manager 1. PASSWORD <password> GGSCI> ADD TRANDATA <owner/schema>.TCUSTMER GGSCI> ADD TRANDATA <owner/schema>. log in to the database on the <source>. Note: This will turn on the change capture for table columns except large objects. USERID <login>. Use the following command to turn on change capture for the TCUSTMER and TCUSTORD tables. GGSCI> INFO TRANDATA <owner/schema>. For large objects.TCUSTORD Verify that supplemental logging has been turned on for these tables. Configure the Manager process on the target system Execute the following commands on the <target> system. Add supplemental logging Using GGSCI.

GoldenGate Manager Parameter file PORT <port> Start Manager GGSCI> START MANAGER Verify the results: GGSCI> INFO MANAGER Create the tables 2. Shell> cd <install location> Shell> sqlplus <login>/<password> SQL> @demo_ora_create Verify the results: SQL> desc tcustmer. SQL> exit Page 5 . SQL> desc tcustord. Create target Oracle tables Execute the following commands on the <target> system to run the script that creates the tables.Exercise Name -.

Configure initial load capture 1.Initial Data Load Exercise 2. for example EINIBD. The process names used in lab exercises. GROUP RINI<unique id> TABLE <owner/schema>. 11 Page 6 .for TCUSTMER and TCUSTORD -EXTRACT EINI<unique id> SOURCEDB <database>. Configure the delivery of the data to the target system.GoldenGate Initial Data Capture -. Initial Data Load using Direct Load Method Objective The goals of this exercise are to: Configure the initial load capture task. R for Replicat). are made up of 1) one character for the GoldenGate process (E for Extract. GGSCI> EDIT PARAMS EINI<unique id> --. GGSCI> ADD EXTRACT EINI<unique id>. TABLE <owner/schema>. SOURCEISTABLE Verify the results: GGSCI> INFO EXTRACT *.) and 3) two characters to create a unique identifier (usually your initials). MGRPORT <port> RMTTASK REPLICAT.TCUSTORD. 2) three or four to describe the process type (INI for initial data load. Execute and verify the initial load of data. TASKS 2.TCUSTMER. Add the initial load Extract batch task group Execute the following commands on the <source> system to create an Extract process called EINI<unique id>1. PASSWORD <password> RMTHOST <target>. Configure the initial load Extract parameter file Execute the following commands on the <source> system to create an initial load Extract parameter file with the listed parameters. etc. ORA for capture from or delivery to an Oracle database. USERID <login>.

GGSCI> ADD REPLICAT RINI<unique id>. MAP <owner/schema>. 4. Configure the initial load Replicat parameter file Execute the following commands on the <target> system to create the initial load Replicat parameter file with the listed parameters.def if you renamed the source. TARGET <owner/schema>.def MAP <owner/schema>. Note: Remember to use <db type>.GoldenGate Initial Load Delivery for TCUSTMER -REPLICAT RINI<unique id> USERID <login>. TARGET <owner/schema>.TCUSTORD.TCUSTMER.def when you transferred it to the <target>. Add the initial load Replicat batch task group Execute the following commands on the <target> system. Execute the initial load process Execute the following commands on the <source> system.TCUSTMER. GGSCI> EDIT PARAMS RINI<unique id> --.Initial Data Load GGSCI> EXIT Configure initial load delivery 3. GGSCI> START EXTRACT EINI<unique id> Verify the results: GGSCI> VIEW REPORT EINI<unique id> On the <target> system: GGSCI> VIEW REPORT RINI<unique id> Page 7 . TASKS 5.TCUSTORD. PASSWORD <password> SOURCEDEFS <install location>/dirdef/source. SPECIALRUN Verify the results: GGSCI> INFO REPLICAT *.

Add the Extract group Execute the following commands on the <source> DB2 system to create the Extract group. Note: Record the two characters selected for your <trail id>: ______. GGSCI> EDIT PARAM EDB2<unique id> --.TCUSTMER and TCUSTORD changes -EXTRACT EDB2<unique id> SOURCEDB <database>. Close the parameter file and verify the results.TCUSTMER./dirdat/<trail id> TABLE <owner/schema>. BEGIN NOW Verify the results: GGSCI> INFO EXTRACT EDB2<unique id> 2. TABLE <owner/schema>. You will need this in the next step and when you set up the Replicat. MGRPORT <port> RMTTRAIL . Configure Change Capture Objective The goals of this exercise are to: Add the Extract process that will capture changes.TCUSTORD. USERID <login>. GGSCI> ADD EXTRACT EDB2<unique id>. Page 8 . PASSWORD <password> TRANLOGOPTIONS NOUSEREXIT RMTHOST <target>. Configure change capture 1.Change capture parameter file to capture -. Create the Extract parameter file Execute the following commands on the <source> system.Configure Change Capture Exercise 3. Start the Extract process. Add the trail that will store the changes. TRANLOG.

DETAIL GGSCI> VIEW REPORT EDB2<unique id> Discussion Points 1. Define the GoldenGate trails Execute the following on the <source> system. GGSCI> START EXTRACT EDB2<unique id> Verify the results: GGSCI> INFO EXTRACT EDB2<unique id>. Start the capture process Execute the following on the <source> system.Configure Change Capture GGSCI> VIEW PARAMS EDB2<unique id> 3./dirdat/<trail id>. Identifying a remote system What parameter is used to identify the remote target system? _________________________________________________________________________ _________________________________________________________________________ 2. Reading the transaction log What parameter is used to set the options for reading the transaction log? _________________________________________________________________________ What options is this lab using? What do they control? _________________________________________________________________________ _________________________________________________________________________ Page 9 . EXTRACT EDB2<unique id>. MEGABYTES 5 Verify the results: GGSCI> INFO RMTTRAIL * 4. GGSCI> ADD RMTTRAIL .

/GLOBALS In the text editor. Activate the GLOBALS parameters For the GLOBALS configuration to take effect. Configure the Replicat group by adding parameters. Create a GLOBALS file on the target system Execute the following commands on the <target> system. Create a named group that includes the Replicat process and the checkpoint tables. Table owner ____________________ name ___________________ Note: You could name the table anything you want. Page 10 . 2. type: CHECKPOINTTABLE <owner/schema>. Configure Change Delivery Objective The goals of this exercise are to: Set up the checkpoint table on the target system. Execute the following command to exit GGSCI. Set up the checkpoint table 1. and remove any file extension that was added. Shell> cd <install location> Shell> ggsci GGSCI> EDIT PARAMS . Verify that the GLOBALS file was created in the root GoldenGate directory. but for training purposes we are using ggschkpt. Start the Replicat group. then save and close the file. Create and edit the GLOBALS parameter file to add the checkpoint table. you must exit the session in which the changes were made.Configure Change Delivery Exercise 4.ggschkpt Record the checkpoint table owner and name.

DSC. EXTTRAIL .tcustord.TCUSTMER and TCUSTORD Changes -REPLICAT RORA<unique id> USERID <login>. GGSCI> EDIT PARAM RORA<unique id> Type in the following parameters --.def when you transferred it to the <target>. TARGET <owner/schema>. Page 11 .TCUSTORD. Add a Replicat checkpoint table On the <target> system. GGSCI> ADD REPLICAT RORA<unique id>.def if you renamed the source. PASSWORD <password> HANDLECOLLISIONS SOURCEDEFS . Create Replicat parameter file Execute the following commands on the <target> system to bring up the parameter file in the editor.tcustmer.def DISCARDFILE . TARGET <owner/schema>./dirrpt/RORA<unique id>. execute the following commands in GGSCI: Shell> Shell> GGSCI> GGSCI> cd <install location> ggsci DBLOGIN USERID <login>.Configure Change Delivery GGSCI> EXIT 3. Note: Remember to use <db type>.Change Delivery parameter file to apply -. 5. PURGE MAP <owner/schema>. MAP <owner/schema>.TCUSTMER. Add the Replicat group Execute the following command on the <target> system to add a delivery group named RORA<unique id>. PASSWORD <password> ADD CHECKPOINTTABLE Configure Change Delivery 4. Note: Enter the schema and table names in the correct case and place double quotes around them if you delivering changes from a case sensitive system./dirdef/source./dirdat/<trail id> Note: Refer to your Extract set up for the correct two-character <trail id>.

Start the Replicat process GGSCI> START REPLICAT RORA<unique id> Verify the results: GGSCI> INFO REPLICAT RORA<unique id> Discussion points 1. When to use HANDLECOLLISIONS When would you use HANDLECOLLISIONS? What does it do? _________________________________________________________________________ _________________________________________________________________________ 2. What is the purpose of the DISCARDFILE? _________________________________________________________________________ _________________________________________________________________________ Page 12 . What information is supplied by SOURCEDEFS? _________________________________________________________________________ _________________________________________________________________________ 3.Configure Change Delivery 6.

Verify the delivery of the changes to the target. Generate Activity and Verify Results Objective The goals of this exercise are to: Execute miscellaneous update. Note: It is advisable to update the demo_db2_misc. Verify your results on the source system Execute the following commands on the <source> system. insert. insert. Generate database operations 1.sql script to ensure that the database connection information matches your system.Generate Activity and Verify Results Exercise 5. and delete operations Execute the following commands on the <source> system.sql Verify change capture and delivery 2. Shell> db2 db2> CONNECT TO <database> db2> select * from TCUSTMER db2> select * from TCUSTORD db2> quit Shell> ggsci GGSCI> SEND EXTRACT EDB2<unique id>. Turn off the error handling used for the initial load. REPORT GGSCI> VIEW REPORT EDB2<unique id> Page 13 . Execute miscellaneous update. Shell> cd <install location> Shell> db2 +c –tf demo_db2_misc. and delete operations on the source system.

Remove initial load error handling from the parameter file GGSCI> EDIT PARAMS RORA<unique id> Remove the HANDLECOLLISIONS parameter. Page 14 . Verify your results on the target system Execute the following commands on the <target> system to verify the target data. Shell> cd <install location> Shell> sqlplus <userid>/<password> SQL> select * from tcustmer. REPORT GGSCI> VIEW REPORT RORA<unique id> Turn off error handling 4. Turn off initial load error handling for the running delivery process GGSCI> SEND REPLICAT RORA<unique id>. SQL> select * from tcustord. NOHANDLECOLLISIONS 5.Generate Activity and Verify Results 3. SQL> exit Shell> ggsci GGSCI> SEND REPLICAT RORA<unique id>.

Exercise Name Page 15 .

Sign up to vote on this title
UsefulNot useful