Professional Documents
Culture Documents
GoldenGate For MS SQL Server 2008 To Oracle GoldenGate For MS SQL
GoldenGate For MS SQL Server 2008 To Oracle GoldenGate For MS SQL
Objective
Upon completion of this lesson, you will be able to configure GoldenGate to provide MS SQL
Server to Oracle synchronization.
Source
<schema> Network
Trails
Oracle
Replicat Target
<owner/schema>
Page 1
GoldenGate for MS SQL Server 2008 to Oracle
Overview of Tasks
Prepare the 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
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 other
processes may be configured and started. And finally, source definitions are generated and
transfer to the target system.
This lesson demonstrates using Extract to pull data from the source files and send it directly
to the Replicat component on the target system.
MS SQL Server
Oracle
<dsn> Network
This lesson demonstrates extracting the data with Extract and sending the data directly to the
Replicat process. This is known as the direct load method.
Page 2
Exercise Name
Exercise 1.
Prepare the Environment
Objective
The goals of this exercise are to:
Prerequisites
This lab assumes that the GLOBALS parameters have been created with a <mgr service> name
and that the Manager service has been added. This should have been done when installing
GoldenGate for Windows.
Install Manager
1. Configure Manager process on the source
Note! The port numbers must be unique if you are installing GoldenGate more than once on
the same server.
Shell> ggsci
GGSCI> EDIT PARAMS MGR
In the parameter file, enter the following parameter, then save and close the file.
PORT <port>
Start Manager.
Page 3
Exercise Name
Enter the name of the local SQL Server instance, then click connect.
Note: These instructions assume SQL Server Authentication which requires the
more complex, double layer, of authentication. SQL Server Authentication is an
option only if it is permitted at the server level, and only Windows Authentication is
enabled by default. If you are using Windows Authentication, you can leave out
most of the login and password entries.
This displays the main SQL Server Management Studio dialog box. Right, right-click
Database and select the New Database option.
Page 4
Exercise Name
The New Database dialog box appears. In the Name box, type the <database> from
the Lab Preparation worksheet.
Page 5
Exercise Name
Page 6
Exercise Name
Page 7
Exercise Name
If you selected SQL Server Authentication, type the <password> in the two
Password fields.
Under Defaults, select your <database> for Database, and leave Language set to the
default.
Do not click OK. Instead, from Select a page in the upper left-hand box, double click
Server Roles.
Under Server Role, check the box for the System Administrators role.
Click OK to 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 main
menu.
The right side of the dialog displays the SQL Query interface. Type in:
Page 8
Exercise Name
Now you need to associate the new user with the login and the schema that you have created
with the new database.
Page 9
Exercise 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 GoldenGate
require that a system data source name (DSN) be established, which stores the information
about how to connect to the SQL Server.
Double-click Data Sources (ODBC) to open the ODBC Data Source Administrator
dialog box.
Click the System DSN tab, and then click the Add button. The Create New Data
Source dialog box appears.
Page 10
Exercise Name
Select the SQL Server Native Client 10.0 driver and then click Finish. The Create a
New Data Source to SQL Server dialog box appears.
Page 11
Exercise Name
For Which SQL Server do you want to connect to, select local if SQL Server is on
the local system, or enter the server name at your SQL Server location.
Click Next.
Answer the question about how SQL Server should verify the login by selecting the
option that you entered when creating the <login>. Then type <login> in Login ID and
<password> in Password.
Click Next.
Make certain the default database is set to the database that you created; otherwise
select Change the default database to: and select it. Leave the other settings to their
defaults to use ANSI.
Page 12
Exercise Name
Click Next.
Leave the next dialog box set to the defaults, and click Finish.
Close the confirmation dialog box and the Create a New Data Source box.
You can leave the SQL Server Management Studio running on the source system,
because you will be using it later.
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, click on the arrow and
select it from the list.
Click the File > Open and navigate to the demo_mss_create.sql script.
Execute the script by clicking the Execute Query button on the toolbar.
Page 13
Exercise Name
Verify the results using the following commands in the input window:
sp_help tcustmer
go
sp_help tcustord
go
Click the X button to close the input tab. Click New Query whenever you need to run
another SQL command.
Following the steps you used to execute the table create script, run the
demo_mss_insert.sql script to insert source data into the source tcustmer and
tcustord tables.
Page 14
Exercise Name
In SQL Management Studio on the source system perform the following steps to turn off log
truncation and bulk copy.
Clear the input window and then use the following command to check the status of
the log truncation option. Type the command in the input window (upper window),
then click the F5 key to execute it.
The following response appears in the results (lower) window with a status of either
ON or OFF.
Check the status of the non-logged bulk copy option by executing the following
command:
7. Execute backup
Page 15
Exercise Name
In the console tree, right-click the database name and select Tasks > Backup.
The Back Up Database dialog box displays. If the backup destination is correct, skip
the next two bulleted steps and initiate the backup as explained in the last step. If it is
not correct, change the backup destination and click ADD.
The Select Backup Destination appears, where you can select File Name and then
click the navigation (...) button to navigate to a directory and specify the backup file
name.
Click OK to close the Select Backup Destination dialog box. The backup file is
added to the Destination list box in the SQL Server Backup dialog box.
Click OK to start the backup. This procedure ensures that no transaction log
information is lost when GoldenGate starts up.
Perform the following steps on the source system to configure the database to log full before
and after images for each update operation.
Issue the following commands to force the logging of the full before and after image
for updates.
Verify that supplemental logging has been turned on for these tables.
Page 16
Exercise Name
Execute the source definition generator from the Windows command prompt.
Shell> defgen paramfile .\dirprm\defgen.prm
Execute the following commands on the <source> system to transfer the definition file to the
<target> system.
The cd command should be set to the <target> location and the lcd to the <source> location.
Shell> ftp <target>
Name (<target>:<login>): <login>
Password: <password>
ftp> ascii
ftp> cd <install loc>/dirdef
ftp> lcd <install loc>/dirdef
ftp> put source.def
ftp> bye
Note: To avoid overlaying existing definition files, always put the file as <db type>.def
instead of source.def (e.g. MSSQL.def).
Page 17
Exercise Name
Start Manager
GGSCI> START MANAGER
Verify the results:
GGSCI> INFO MANAGER
Execute the following commands on the <target> system to run the script that creates the
tables.
Shell> cd <install location>
Shell> sqlplus <login>/<password>
SQL> @demo_ora_create
Page 18
Initial Data Load
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 target
tables.
Execute the following commands on the <source> system to add an Extract process called
EINI<unique id>1.
--
-- GoldenGate Initial Data Capture
-- for TCUSTMER and TCUSTORD
--
EXTRACT EINI<unique id>
SOURCEDB <dsn>, USERID <login>, PASSWORD <password>
RMTHOST <target>, MGRPORT <port>
RMTTASK REPLICAT, GROUP RINI<unique id>
TABLE <owner/schema>.TCUSTMER;
TABLE <owner/schema>.TCUSTORD;
The process names used in lab exercises, for example EINIBD, are made up of 1) one character for the
GoldenGate process (E for Extract, R for Replicat); 2) three or four to describe the process type (INI for
initial 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).
Page 19
Initial Data Load
Note: Remember to use <db type>.def if you renamed the source.def when you transferred it
to the <target>.
Execute the following command to start the initial data load process.
Page 20
Initial Data Load
GGSCI> EXIT
Page 21
Configure Change Capture
Exercise 3.
Configure Change Capture
Objective
The goals of this exercise are to:
Execute the following commands on the <source> system to create the Extract group.
GGSCI> ADD EXTRACT EMSS<unique id>, TRANLOG, BEGIN NOW
--
-- Parameter file to capture
-- TCUSTMER and TCUSTORD Changes
--
EXTRACT EMSS<unique id>
TRANLOGOPTIONS MANAGESECONDARYTRUNCATIONPOINT
SOURCEDB <dsn>, USERID <login>, PASSWORD <password>
RMTHOST <target>, MGRPORT <port>
RMTTRAIL ./dirdat/<trail id>
TABLE <owner/schema>.TCUSTMER;
TABLE <owner/schema>.TCUSTORD;
Note: Record the two characters selected for your <trail id>: ______. You will need this in
the next step and when you set up the Replicat.
Page 22
Configure Change Capture
On the <source> system, issue the following command in GGSCI to start the Extract process.
GGSCI> START EXTRACT EMSS<unique id>
Page 23
Configure Change Delivery
Exercise 4.
Configure Change Delivery
Objective
The goals of this exercise are to:
Set up checkpoints
1. Edit a GLOBALS file on the target system
CHECKPOINTTABLE <owner/schema>.ggschkpt
Record the checkpoint table owner and name, then save and close the file.
Note: You could name the table anything you want, but for training purposes we are
using ggschkpt.
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
Page 24
Configure Change Delivery
This step adds the checkpoint table that you specified when you created the GLOBALS
parameter file. It will be created in the <dsn> database.
Configure delivery
4. Add the Replicat checkpoint group
Execute the following commands on the <target> system to create the Replicat group named
RMSS<unique id>.
Note: Refer to your Extract set up for the correct two-character <trail id>.
Execute the following command on the <target> system to edit the Replicat
parameter file.
Note: Remember to use <db type>.def if you renamed the source.def when you transferred it
to the the <target>.
Page 25
Configure Change Delivery
Discussion points
Search in the Windows//UNIX Reference Guide for the information on the following
questions.
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
Page 26
Generate Activity and Verify Results
Exercise 5.
Generate Activity & Verify Results
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.
Go to SQL Server Management Studio, select your database and press New Query.
If the correct database is not displayed in the drop down box, click on the arrow and
select it from the list.
Click the File > Open and navigate to the demo_mss_misc.sql script and click Open
to open it in the input window.
Execute the script by clicking the Execute Query button on the toolbar.
Verify and record processing statistics with the following command in GGSCI.
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
___________________________________________________________________
Verify the data by executing the following commands in the New Query window of
SQL Server Management Studio on the source:
Page 27
Generate Activity and Verify Results
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;
SQL> select * from tcustord;
SQL> exit
Shell> ggsci
GGSCI> SEND REPLICAT RMSS<unique id>, REPORT
GGSCI> VIEW REPORT RMSS<unique id>
Page 28
Exercise Name
Page 29