8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
1/24
GoldenGate for Oracle to MS SQL Server
Page 1
GoldenGate for Oracle to MS SQL Server
Objective
Upon completion of this lesson, you will be able to configure GoldenGate to provide Oracleto SQL Server transactional data management using log-based extraction.
During this lesson, you will learn how to:
Prepare your user environment
Prepare the database
Configure and start the change capture process of database operations
Configure and execute the initial data load process
Configure and start the change delivery process of database operations
Configuration for Oracle to MS SQL Server
The following diagram illustrates an Oracle source system replicating to a Windows MS SQL
Server.
Overview of Tasks
Prepare the GoldenGate Environment
In order to execute this lesson, the GoldenGate application must be installed on both the
source and target systems. The installation includes a sample database and scripts to generate
Windows server
MS SQL Server
Target
Replicat
Collector
Trails
Manager
server
Oracle
Source
Extract
Manager
Log
Network
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
2/24
GoldenGate for Oracle to MS SQL Server
Page 2
initial data as well as subsequent update operations. The source and target tables are created
and loaded with initial data. The GoldenGate Manager processes are also started so that otherprocesses may be configured and started.
Configure Initial Data Load
Initial database synchronization is almost always required. To initially load data acrossactively changing databases, you have limited choices. GoldenGate provides the ability to
perform initial data synchronization while your application remains active. There are severaltechniques available, including sending data to files to be loaded by Replicat or by Microsoft
BCP/DTS bulk-load utility, or sending data directly to Replicat.
This lesson demonstrates using the direct load method to capture data directly from the
source tables and send it directly to the delivery process on the target system.
Configure Change Capture
For log-based Oracle capture, the Extract process is configured to capture change datadirectly from the Oracle online redo logs or archive logs and store the changes in data queuesknown as GoldenGate remote trails.
Configure Change Delivery
Once the tables have been initially loaded with data, the Replicat process is configured to
deliver the captured change data into the target database.
server
Initial
Replicat
MS SQL Server
Target
server
Oracle
Source
Initial
Extract
Network
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
3/24
Prepare the Environment
Page 3
Exercise 1.
Prepare the Environment
Objective
The goals of this exercise are to:
Configure and start the Manager processes
Create sample tables and load data into source tables
Add supplemental logging
Generate source definitions file
Prepare your Oracle source environment
1. Configure the Manager process on the source
On the system, create the Manager parameter file and specify the port it should use.
Create the Manager parameter file.
Shell> cd Shell> ggsciGGSCI> EDIT PARAMS MGR
Use the editor to assign a port.
--GoldenGate Manager parameter filePORT
Start the Manager.
GGSCI> START MGR
Verify that the Manager has started.
GGSCI> INFO MGR
2. Create the source tables and load the initial data.
Using SQL*Plus, create and populate the TCUSTMER and TCUSTORD tables by running the
demo_ora_create.sql and demo_ora_insert.sql files found in the install directory.
Execute the following commands on the system.
Shell> cd Shell> sqlplus /SQL> @demo_ora_create
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
4/24
Prepare the Environment
Page 4
SQL> @demo_ora_insert
Verify the results:
SQL> select * from tcustmer;
SQL> select * from tcustord;SQL> exit
3. Add supplemental logging
Using GGSCI, log in to the database on the and turn on supplemental logging for theTCUSTMER and TCUSTORD tables.
Shell> ggsciGGSCI> DBLOGIN USERID GGSCI> ADD TRANDATA .TCUSTMERGGSCI> ADD TRANDATA .TCUSTORD
Verify that supplemental logging has been turned on for these tables.
GGSCI> INFO TRANDATA .TCUST*
4. Configure source definition generator
Execute the following commands on the system to create the DEFGEN parameter
file and add the listed parameters.
Shell> cd Shell> ggsciGGSCI> edit param defgen
DEFSFILE ./dirdef/source.def, PURGEUSERID , PASSWORD TABLE .TCUSTMER;TABLE .TCUSTORD;
GGSCI> exit
5. Execute the source definition generator
Execute the following commands on the system.
Shell> defgen paramfile dirprm/defgen.prm
6. Transfer the source definition file to the target system
Execute the following commands to transfer the souce.deffile to the system.
Shell> ftp Name (:): Password: passwordftp> asciiftp> cd /dirdef
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
5/24
Prepare the Environment
Page 5
ftp> lcd /dirdef
ftp> put source.def (see note below)ftp> bye
Note: To avoid overlaying existing definition files, always put the file as .def
instead ofsource.def(e.g. Oracle.def).
Prepare the SQL Server 2005 target system
Install Manager
1. Configure Manager process on the target
Execute the following commands on the system.
Note! The port numbers must be unique if you are installing GoldenGate more than once on
the same server.
Shell> cd Shell> ggsciGGSCI> EDIT PARAMS MGR
In the parameter file, enter the following parameter, then save and close the file.
-- GoldenGate Manager Parameter filePORT
Start Manager.
GGSCI> START MANAGER
Verify the results:
GGSCI> INFO MANAGER
Steps to create the database
2. Create the database
From Start>Programs, run SQL Server Management Studio.
Enter the name of the local SQL Server instance, then click connect.
Note: These instructions assume SQL Server Authentication which requires themore complex, double layer, of authentication. For only Windows Authentication,you can leave out most of the login and password entries.
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
6/24
Prepare the Environment
Page 6
This displays the main SQL Server Management Studio dialog box. Right, right-clickDatabase and select the New Database option.
The New Database dialog box appears. In the Name box, type the fromthe Lab Preparation worksheet.
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
7/24
Prepare the Environment
Page 7
ClickOKto add the database.
The main SQL Server Management Studio dialog box reappears.
3. Create SQL Server logins and users
Right-clickSecurity and select the New > Login.
The New Login dialog box appears.
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
8/24
Prepare the Environment
Page 8
ForName, type the .
Select Authentication,
If you selected SQL Server Authentication, type the in the two
Password fields.
UnderDefaults, select your forDatabase, and leave Language set to thedefault.
Do not clickOK. Instead, from Select a page in the upper left-hand box, double clickUser Mapping.
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
9/24
Prepare the Environment
Page 9
In the upperUsers mapped to this login area,activate the checkmark next to yourdatabase.
In the lowerDatabase role membership for area,, check the box for thedb_owner role.
ClickOKto exit.
The next step creates a schema that you will associate with the new user.
While you have the database selected, click on the New Query button in the mainmenu.
The right side of the dialog displays the SQL Query interface. Type in:
create schema ;
And press the Execute button from the toolbar.
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
10/24
Prepare the Environment
Page 10
Now you need to associate the new user and the schema that you have created with the newdatabase.
Right click on the Security option that is under the database and select New > User.
The New Database User dialog box appears. Enter the name of your user and pressthe browse button labeled with three dots ().
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
11/24
Prepare the Environment
Page 11
The Select Login dialog displays. Press the Browse button.
Select your new user from the list. Then press OK.
Your selected user now displays in the object names box. Press OKto exit fromSelect Login.
Back in the New Database User dialog, enter the you added as the defaultschema and press OK.
4. Create the ODBC system data source name
The GoldenGate Extract process connects to a SQL Server database through an ODBC (Open
Database Connectivity) connection. Both the Extract and Replicat components of GoldenGaterequire that a system data source name (DSN) be established, which stores the information
about how to connect to the SQL Server.
ClickStart > Settings > ControlPanel.
Double-clickAdministrative Tools.
Double-clickDataSources (ODBC) to open the ODBCDataSourceAdministratordialog box.
Click the System DSN tab, and then click the Add button. The Create New DataSource dialog box appears.
Note: For SQL Server 2000, you may use any ODBC driver supported by thedatabase. For SQL Server 2005, however, you must use the ODBC driver that isincluded with Microsoft Data Access Components (MDAC). Both Extract andReplicat will abend if the SQL Native Client ODBC driver that is provided with SQL
Server 2005 is used.
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
12/24
Prepare the Environment
Page 12
Select the SQL Server driver and then clickFinish. The Create a New Data Source
to SQL Server dialog box appears.
ForName, type .
For a description, type "GG Training Data source" when creating this source DSN.This field is optional.
ForWhich SQL Server do you want to connect to, select the server name.
ClickNext.
Answer the question about how SQL Server should verify the login by selecting theoption that you entered when creating the . Then type in Login IDand in Password.
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
13/24
Prepare the Environment
Page 13
ClickNext.
Make certain the default database is set to the database that you created; otherwiseselect Change the default database to: and selectit. Leave the other settings to theirdefaults to use ANSI.
ClickNext.
Leave the next dialog box set to the defaults, and clickFinish.
In the confirmation, clickTest Data Source to test the connection.
Close the confirmation dialog box and the Create a New Data Source box.
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
14/24
Prepare the Environment
Page 14
5. Create the practice tables
Execute the following commands on the system.
Go to SQL Server Management Studio, select your database and select New Query
from the toolbar.
If the correct database is not displayed in the drop down box (showing ggsdataabove), click on the arrow and select it from the list.
Click the File > Open and navigate to the demo_mss_create.sql script.
ClickOpen to open the script in the New Query window.
Execute the script by clicking the Execute Query button on the toolbar.
Verify the results using the following commands in the input window:
sp_help tcustmergosp_help tcustordgo
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
15/24
Initial Data Load
Page 15
Exercise 2.
Initial Data Load using Direct Load Method
Objective
These steps configure initial load groups that copy source data and apply it to the targettables.
Steps to configure initial load
1. Add the initial data load extract batch task group
Execute the following commands on the system to add an Extract process called
EINI1.
Execute the following command in GGSCI to create the batch task.
Shell> cd Shell> ggsciGGSCI> ADD EXTRACT EINI, SOURCEISTABLE
Verify the results:
GGSCI> INFO EXTRACT *, TASKS
2. Configure the initial data load Extract parameter file
Execute the following command in GGSCI to open the editor.
GGSCI> EDIT PARAMS EINI
Add the following lines to the parameter file
---- GoldenGate Initial Data Capture-- for TCUSTMER and TCUSTORD--EXTRACT EINIUSERID , PASSWORD RMTHOST , MGRPORT RMTTASK REPLICAT, GROUP RINI
TABLE .TCUSTMER;TABLE .TCUSTORD;
1 The process names used in lab exercises, for example EINIBD, are made up of 1) one character for theGoldenGate process (E for Extract, R for Replicat); 2) three or four to describe the process type (INI forinitial data load, ORA for capture from or delivery to an Oracle database, etc.) and 3) two characters to
create a unique identifier (usually your initials).
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
16/24
Initial Data Load
Page 16
3. Add the initial data load Replicat batch task group
Execute the following commands on the system.
Execute the following command in GGSCI to create the batch task.
GGSCI> ADD REPLICAT RINI, SPECIALRUN
Verify the results:
GGSCI> INFO RINI*, TASKS
4. Configure the initial data load Replicat parameter file
Execute the following commands on the system.
Execute the following command in GGSCI to open the editor.
GGSCI> EDIT PARAMS RINI
Add the following lines to the parameter file
-- GoldenGate Initial Data Load Delivery--REPLICAT RINITARGETDB , USERID , PASSWORD DISCARDFILE ./dirrpt/RINI.txt, PURGESOURCEDEFS ./dirdef/source.defMAP .TCUSTMER, TARGET .TCUSTMER;MAP .TCUSTORD, TARGET .TCUSTORD;
Note: Remember to use .defif you renamed the source.defwhen you transferred it
to the .
5. Execute the initial data load process
Execute the following commands on the system.
Execute the following command to start the initial data load process.
GGSCI> START EXTRACT EINI
Verify the results:
GGSCI> VIEW REPORT EINI
Execute the following commands on the system.
Verify the results:
GGSCI> VIEW REPORT RINIQuery Analyzer> SELECT * FROM .TCUSTMERQuery Analyzer> SELECT * FROM .TCUSTORD
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
17/24
Configure Change Capture
Page 17
Exercise 3.
Configure Change Capture
Objective
The goals of this exercise are to:
Configure and add the Extract process that will capture changes.
Add the trail that will store the changes.
Start the Extract process.
Configure change capture1. Add the Extract group
Execute the following command on the system to add an Extract group named
EORA.
GGSCI> ADD EXTRACT EORA, TRANLOG, BEGIN NOW, THREADS
Verify the results:
GGSCI> INFO EXTRACT EORA
2. Create the Extract parameter file
Execute the following commands on the system.
GGSCI> EDIT PARAM EORA
---- Change Capture parameter file to capture-- TCUSTMER and TCUSTORD Changes--EXTRACT EORAUSERID , PASSWORD
RMTHOST , MGRPORT RMTTRAIL ./dirdat/TABLE .TCUSTMER;TABLE .TCUSTORD;
Note: Record the two characters selected for your: ______. You will need this in
the next step and when you set up the Replicat.
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
18/24
Configure Change Capture
Page 18
Note: When Oracle Automatic Storage Management (ASM) is in use, the TRANLOGOPTIONS
ASMUSER and ASMPASSWORD must be set in the Extract parameter file. For more information
refer to the GoldenGate for Windows & UNIX AdministratorandReference manuals.
3. Define the GoldenGate trail
Execute the following command on the to add the trail that will store the changes
on the target.
GGSCI> ADD RMTTRAIL ./dirdat/, EXTRACT EORA,MEGABYTES 5
Verify the results:
GGSCI> INFO RMTTRAIL *
4. Start the capture process
GGSCI> START EXTRACT EORA
Verify the results:
GGSCI> INFO EXTRACT EORA, DETAILGGSCI> VIEW REPORT EORA
Discussion points
1. Identifying a remote system
What parameter is used to identify the remote target system?
_________________________________________________________________________
2. Sizing the GoldenGate trail
Where do you set how large a GoldenGate trail file may get before it rolls to the next file?What option do you use?
_________________________________________________________________________
_________________________________________________________________________
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
19/24
Configure Change Delivery
Page 19
Exercise 4.
Configure Change Delivery
Objective
The goals of this exercise are to:
Set up the checkpoint table on the target system.
Create a named group that includes the Replicat process and the checkpoint tables.
Configure the Replicat group by adding parameters.
Start the Replicat group.
Set up checkpoints
1. Edit a GLOBALS file on the target system
Execute the following commands on the system.
Edit the GLOBALS parameter file to add the checkpoint table.
Shell> cd Shell> ggsciGGSCI> EDIT PARAMS ./GLOBALS
In the text editor, type:
CHECKPOINTTABLE .ggschkpt
Record the checkpoint table owner and name, then save and close the file.
Table owner ____________________ name ___________________
Note: You could name the table anything you want, but for training purposes we areusing ggschkpt.
2. Activate the GLOBALS parameters
For the GLOBALS configuration to take effect, you must exit the session in which the changes
were made. Execute the following command to exit GGSCI.
GGSCI> EXIT
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
20/24
Configure Change Delivery
Page 20
3. Add a Replicat checkpoint table
Execute the following commands on the system.
This step adds the checkpoint table that you specified when you created the GLOBALS
parameter file. It will be created in the database.
Run GGSCI on the target.
Shell> cd Shell> ggsci
Execute the following commands in GGSCI.
GGSCI> DBLOGIN SOURCEDB , USERID , PASSWORD
GGSCI> ADD CHECKPOINTTABLE
Configure delivery
4. Add the Replicat checkpoint group
Execute the following commands on the system to create the Replicat group named
RMSS.
GGSCI> ADD REPLICAT RMSS, EXTTRAIL ./dirdat/
Note: Refer to your Extract set up for the correct two-character.
5. Create Replicat parameter file
Execute the following command on the system to edit the Replicatparameter file.
GGSCI> EDIT PARAM RMSS
Add the following lines to the parameter file.
REPLICAT RMSSTARGETDB , USERID , PASSWORD HANDLECOLLISIONS
SOURCEDEFS ./dirdef/source.defDISCARDFILE ./dirrpt/RMSS.DSC, PURGEMAP .TCUSTMER, TARGET .TCUSTMER;MAP .TCUSTORD, TARGET .TCUSTORD;
Note: Remember to use .defif you renamed the source.defwhen you transferred itto the the .
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
21/24
Configure Change Delivery
Page 21
4. Start the Replicat process
Execute the following commands on the system.
Execute the following command in GGSCI to start the Replicat process.
GGSCI> START REPLICAT RMSS
Verify the results:
GGSCI> INFO REPLICAT RMSS
Discussion points
Search in the Windows//UNIX Reference Guide for the information on the followingquestions.
1. When to use HANDLECOLLISIONS
When would you use HANDLECOLLISIONS? What does it do?
_________________________________________________________________________
_________________________________________________________________________
2. What information is supplied by SOURCEDEFS?
_________________________________________________________________________
_________________________________________________________________________
3. What is the purpose of the DISCARDFILE?
_________________________________________________________________________
_________________________________________________________________________
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
22/24
Generate Activity and Verify Results
Page 22
Exercise 5.
Generate Activity and Verify Results
Objective
The goals of this exercise are to:
Execute miscellaneous update, insert, and delete operations on the source system.
Verify the delivery of the changes to the target
Turn off the error handling used for initial load.
Generate database operations1. Execute miscellaneous update, insert, and delete operations
Execute the following commands on the system.
Shell> cd Shell> sqlplus /SQL> @demo_ora_misc
Verify change capture and delivery
2. Verify results on the source system
Execute the following commands on the system.
SQL> select * from tcustmer;SQL> select * from tcustord;SQL> exit
Shell> ggsciGGSCI> SEND EXTRACT EORA, REPORTGGSCI> VIEW REPORT EORA
Verify your target SQL Server 2005 results
3. Verify your results on the SQL Server 2005 target
Verify and record processing statistics on the with the following commandin GGSCI.
GGSCI> SEND REPLICAT RMSS, REPORT
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
23/24
Generate Activity and Verify Results
Page 23
GGSCI> VIEW REPORT RMSS
Verify the data by executing the following commands in the New Query window ofSQL Server Management Studio on the source:
select * from TCUSTMER;select * from TCUSTORD;
Turn off error handling
4. Turn off initial load error handling for the running delivery process
Execute the following commands on the system.
GGSCI> SEND REPLICAT RMSS, NOHANDLECOLLISIONS
5. Remove initial load error handling from the parameter file
GGSCI> EDIT PARAMS RMSS
Remove the HANDLECOLLISIONS parameter.
8/6/2019 Ggs Sect Config Winux Ora to Win Mss 2005
24/24
Exercise Name