Professional Documents
Culture Documents
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>
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 1
GoldenGate for MS SQL Server 2005 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.
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 2
Exercise Name
Exercise 1.
Prepare the Environment
y y y y y y y y y y y y y y y
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.
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 3
Exercise Name
Enter the name of the local SQL Server instance, then click connect.
This displays the main SQL Server Management Studio dialog box. Right,
right-click Database and select the New Database option.
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 4
Exercise Name
The New Database dialog box appears. In the Name box, type the
<database> from the Lab Preparation worksheet.
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 5
Exercise Name
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 6
Exercise Name
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:
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 7
Exercise Name
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 (…).
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 8
Exercise Name
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.
Click the System DSN tab, and then click the Add button. The Create New
Data Source dialog box appears.
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 9
Exercise Name
Select the SQL Server driver and then click Finish. The Create a New Data
Source to SQL Server dialog box appears.
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.
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 10
Exercise Name
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.
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 11
Exercise Name
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 (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
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 12
Exercise Name
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.
You have installed MicroSoft’s Cumulative Update 6 (CU6) for SQL Server
2005.
You are running GoldenGate version 9.5.1.15 or higher.
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 13
Exercise Name
been installed and configured, perform the workshop SQL Server 2005 Replication
Components before proceeding to the next section.
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:
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 14
Exercise Name
7. Execute backup
In the console tree, right-click the database name and select Tasks > Backup
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 15
Exercise Name
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.
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 16
Exercise Name
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.
Note: With SQL Server 2005 you cannot drop tables that have TRANDATA
set. First you must delete the TRANDATA setting.
Execute the source definition generator from the Windows command prompt.
Shell> defgen paramfile .\dirprm\defgen.prm
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 17
Exercise Name
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).
The Log Reader Agent job cannot run concurrently with the GoldenGate Extract
process. Perform the following steps to stop and disable this job.
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 18
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
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 19
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).
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 20
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.
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 21
Initial Data Load
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 22
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>
--Include the following only for SQL Server 2005
TRANLOGOPTIONS MANAGESECONDARYTRUNCATIONPOINT
-- If SQL Server Replication is also running, choose
-- the NOMANAGESECONDARYTRUNCATIONPOINT option
SOURCEDB <dsn>, USERID <login>, PASSWORD <password>
RMTHOST <target>, MGRPORT <port>
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 23
Configure Change Capture
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.
On the <source> system, issue the following command in GGSCI to start the Extract
process.
GGSCI> START EXTRACT EMSS<unique id>
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 24
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
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 25
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>.
GGSCI> ADD REPLICAT RMSS<unique id>, EXTTRAIL ./dirdat/<trail 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>.
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 26
Configure Change Delivery
Discussion points
Search in the Windows//UNIX Reference Guide for the information on the
following questions.
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
_________________________________________________________________________
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 27
Generate Activity and Verify Results
Exercise 5.
Generate Activity & Verify Results
The goals of this exercise are to:
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 (showing
ggsdata above), 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.
___________________________________________________________________
___________________________________________________________________
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 28
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:
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 RORA<unique id>, REPORT
GGSCI> VIEW REPORT RORA<unique id>
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 29
Exercise Name
y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y y
Page 30