Goldengate Oracle To SQL Server
Goldengate Oracle To SQL Server
Goldengate Oracle To SQL Server
Oracle
Manager Manager
Source
<owner/schema>
Network
Trails
MS SQL Server
<dsn>
Replicat Target
<schema>
Page 1
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
GoldenGate for Oracle to MS SQL Server
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.
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.
<source> server <target> server
MS SQL Server
Oracle
Network <dsn>
Exercise 1.
Prepare the Environment
Page 2
Prepare the Environment
Objective
The goals of this exercise are to:
Page 3
Prepare the Environment
SQL> @demo_ora_insert
Shell> ggsci
GGSCI> DBLOGIN USERID <login>
GGSCI> ADD TRANDATA <owner/schema>.TCUSTMER
GGSCI> ADD TRANDATA <owner/schema>.TCUSTORD
Verify that supplemental logging has been turned on for these tables.
GGSCI> INFO TRANDATA <owner/schema>.TCUST*
GGSCI> exit
Page 4
Prepare the Environment
Note: To avoid overlaying existing definition files, always put the file as <db type>.def
instead of source.def (e.g. Oracle.def).
Install Manager
1. Configure Manager process on the target
Execute the following commands on the <target> system.
Note! The port numbers must be unique if you are installing GoldenGate more than once on the
same server.
Shell> cd <install location>
Shell> ggsci
GGSCI> EDIT PARAMS MGR
In the parameter file, enter the following parameter, then save and close the file.
START MANAGER
Enter the name of the local SQL Server instance, then click connect.
Page 5
Prepare the Environment
Note: These instructions assume SQL Server Authentication which requires the
more complex, double layer, of authentication. For only 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.
The New Database dialog box appears. In the Name box, type the <database> from the
Lab Preparation worksheet.
Page 6
Prepare the Environment
Page 7
Prepare the Environment
Select Authentication,
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
User Mapping.
Page 8
Prepare the Environment
In the upper Users mapped to this login area, activate the checkmark next to your
database.
In the lower Database role membership for <database> area,, check the box for the
db_owner 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:
create schema <owner/schema>;
Page 9
Prepare the Environment
Now you need to associate the new user and the schema that you have created with the new
database.
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 press the
browse button labeled with three dots (…).
Page 10
Prepare the Environment
Select your new user <login> from the list. Then press OK.
Your selected user now displays in the object names box. Press OK to exit from Select
Login.
Back in the New Database User dialog, enter the <schema> you added as the default
schema and press OK.
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.
Note: For SQL Server 2000, you may use any ODBC driver supported by the database.
For SQL Server 2005, however, you must use the ODBC driver that is included with
Microsoft Data Access Components (MDAC). Both Extract and Replicat will abend if
the SQL Native Client ODBC driver that is provided with SQL Server 2005 is used.
Page 11
Prepare the Environment
Select the SQL Server driver and then click Finish. The Create a New Data Source to
SQL Server dialog box appears.
For a description, type "GG Training Data source" when creating this source DSN. This
field is optional.
For Which SQL Server do you want to connect to, select the server name.
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.
Page 12
Prepare the Environment
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.
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.
Page 13
Prepare the Environment
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 ggsdata above),
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.
Verify the results using the following commands in the input window:
sp_help
tcustmer go
sp_help
tcustord go
Page 14
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.
--
-- GoldenGate Initial Data Capture
-- for TCUSTMER and TCUSTORD
--
EXTRACT EINI<unique id>
USERID <login>, PASSWORD <password>
RMTHOST <target>, MGRPORT <port>
RMTTASK REPLICAT, GROUP RINI<unique id>
TABLE <owner/schema>.TCUSTMER;
TABLE <owner/schema>.TCUSTORD;
1
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 15
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.
GGSCI> START EXTRACT EINI<unique id>
Page 16
Query Analyzer> SELECT * FROM <owner/schema>.TCUSTORD
Configure Change Capture
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.
--
-- Change Capture parameter file to capture
-- TCUSTMER and TCUSTORD Changes
--
EXTRACT EORA<unique id>
USERID <login>, PASSWORD <password>
RMTHOST <target>, MGRPORT <port>
RMTTRAIL ./dirdat/<trail id>
TABLE <owner/schema>.TCUSTMER;
TABLE <owner/schema>.TCUSTORD;
Page 17
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.
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 Administrator and Reference manuals.
Discussion points
1. Identifying a remote system
What parameter is used to identify the remote target system?
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
Page 18
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
Execute the following commands 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.
Page 19
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>.
Note: Remember to use <db type>.def if you renamed the source.def when you transferred
it to the the <target>.
Page 20
Configure Change Delivery
Discussion points
Search in the Windows//UNIX Reference Guide for the information on the following
questions.
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
Page 21
Generate Activity and Verify Results
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.
Shell> ggsci
GGSCI> SEND EXTRACT EORA<unique id>, REPORT
GGSCI> VIEW REPORT EORA<unique id>
Page 22
GGSCI> SEND REPLICAT RMSS<unique id>, REPORT
Generate Activity and Verify Results
Verify the data by executing the following commands in the New Query window of
SQL Server Management Studio on the source:
select * from TCUSTMER;
select * from TCUSTORD;
Page 23
Exercise Name
Page 24
Page 25