GGS: Sybase to Oracle

Step 1: Start the GGSCI on Source and Target

SourceTarget

Oracle GoldenGate Command Interpreter for Sybase
Version 12.1.2.0.0 17185003 OGGCORE_12.1.2.0.0_PLATFORMS_130924.1316
Linux, x86, 64bit (optimized), Sybase 16

Oracle GoldenGate Command Interpreter for Oracle
Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO
Linux, x86, 64bit  oracle 11g

Tip: Should I use the same version of Oracle GoldenGate on the Source and Target?
Yes, it is recommended to use the same version on both the source and target. However, If the Oracle GoldenGate versions on the source and target database are different, it is a good practice to use the RELEASE option of the EXTFILE/RMTFILE and EXTTRAIL/RMTTRAIL parameter, especially if you have a lower version of Oracle GoldenGate on the target.

Example: EXTFILE  ./dirdat/em, FORMAT RELEASE 11.2

1. Use a defgen paramfile with NOEXTATTR option, or

2. Generate definition file with the same OGG version as the OGG target site version.

$ ./defgen paramfile ./dirprm/defgen.prm reportfile ./dirrpt/defgen.31Jul2013.rptNOEXTATTR

We then need to modify and check the Oracle GoldenGate Manager parameter file to prepare the replication. The following table shows the Oracle GoldenGate Manager setup on the source and target system:

SourceTarget

export DSQUERY=ASE1
GGSCI> edit param mgr

port 15021
purgeoldextracts ./dirdat/em*, usecheckpoints, minkeephours 2

GGSCI> start mgr
GGSCI> info mgr

GGSCI> edit param mgr

port 15021
dynamicportlist 15011-15020
dynamicportreassigndelay 5

GGSCI> start mgr
GGSCI> info mgr 

Step 2: Set up the Source and Target Database

创建city表

Source (Sybase ASE 16)Target (Oracle Database 11.2.0.1)

isql -Uogguser -Pogguser -SASE1
>use pubs2
>go

create table city (id int, name varchar(10)
go

insert into city values (1,'New York')
insert into city values (2,'Boston')
insert into city values (3,'Dallas')
insert into city values (4,'Beijing')
go

> select count(1) from city
> go

connect swat/swat
create table city (id int, name varchar2(10);

insert into city values (1,'New York');
insert into city values (2,'Boston');
insert into city values (3,'Dallas');
insert into city values (4,'Beijing');

> select count(1) from city;

Step 3: Set up the Secondary Truncation Point in Sybase Transaction Log

When using Oracle GoldenGate for Sybase, you need to setup the secondary truncation point.This is because Oracle GoldenGate uses the secondary truncation point to identify data that remains to be processed.

To set up the secondary truncation point, you need to login Sybase database with a user who hassa_role privilege and run the “dbcc settrunc(‘ltm’,valid)” command. The detailed steps are shown as follows:

Source

Shell> isql -Uogguser -Pogguser -SASE1

1> use pubs2

2> go

1> dbcc settrunc('ltm', 'valid')

2> go

 
 

Step 4: Prepare the Source Database and Target Database

Connect to the source DB and add trandata. In addition, confirm that Oracle GoldenGate user can access on the target database shown as follows:

SourceTarget

GGSCI >dblogin sourcedb pubs2@ASE1 userid ogguser password ogguser
GGSCI > list table dbo.city
GGSCI > info trandata dbo.city
Transaction logging disabled for table dbo.city
GGSCI > add trandata dbo.city
Transaction logging enabled for table suser.regions.

GGSCI > dblogin userid swat, password swat
Successfully logged into database.
GGSCI > list table swat.city

Why I get the "ERROR: Cannot use database syd_database. error, no additional information available." error?
Answer: The problem is the parsing issue in Oracle GoldenGate 11.2.1 version if the database has special characters such as “_” in the database and schema name. The current solution is to remove the special characters.

Because we are working on heterogeneous database replication, you have to create the database metadata definition file on the source system and copy the generated definition file to the target.

SourceTarget

emaster.prm:

extract emaster
exttrail ./dirdat/em,FORMAT RELEASE 11.2
sourcedb pubs2@ASE1 userid ogguser password ogguser
statoptions resetreportstats
report at 00:01
reportcount every 60 seconds, rate
table dbo.city;     

rmaster.prm:

replicat rmaster
userid swat, password swat
sourcedefs ./dirout/city.def
discardfile ./dirrpt/rmaster.dsc, purge
map dbo.city, target swat.city;

Adding the Extract:
GGSCI> add extract emaster, tranlog, begin now
GGSCI> add exttrail ./dirdat/em, extract emaster, megabytes 50 

Adding the Replicat:
GGSCI >edit param ./GLOBALS
GGSCHEMA goldengate
CHECKPOINTTABLE goldengate.checkpoint
GGSCI>ADD CHECKPOINTTABLE goldengate.checkpointtable
GGSCI>add replicat rmaster, exttrail ./dirdat/pm

pmaster.prm:

extract pmaster
rmthost 192.168.137.11, mgrport 15021, compress, timeout 30
rmttrail ./dirdat/pm
passthru
table dbo.city;

Adding the Pump:
GGSCI > add extract pmaster, exttrailsource ./dirdat/em
EXTRACT added.
GGSCI > add rmttrail ./dirdat/pm, extract pmaster, megabytes 50
RMTTRAIL added.

Insert a New Record in Sybase
1>  Insert into regions values(5,'Antarctica')
2> go
(1 row affected)

SQL> select * from regions;
REGION_ID REGION_NAME
---- ----------------------
         1 Europe
         2 Americas
         3 Asia
         4 Middle East and Africa
         5 Antarctica

Delete a Record in Sybase
1> delete from regions where region_id=5
2> go
(1 row affected)

SQL> select * from regions;
REGION_ID REGION_NAME
---- ----------------------
         1 Europe
         2 Americas
        3 Asia
         4 Middle East and Africa

Now, we have completed the basic setups of a one-way replication from Sybase ASE database to Oracle Database.Feel free to let me know if you have any questions or comments on the tips I provided above.

Installing Oracle GoldenGate for Sybase:
Step 1: Download Oracle GoldenGate for Sybase
Step 2: Unzip the Oracle GoldenGate zip File.

Unzip the downloaded file with the following commands:

 
 
 
 

Check the shared library path:

 
 
 
 
 
 
 
 
 
 

Add the OGG installation path to the path (PATH) and shared library path (LD_LIBRARY_PATH) environment variables:

 
 
 
 
 
 
 
 
Step 3: Create Oracle GoldenGate

Run the ggsci command in the folder where Oracle GoldenGate files are unzipped:

 
 
 
 
 
 
 
 
Step 4: Create Database User in Sybase for Replication.

In the Sybase database, create a database user for Oracle GoldenGate, and grant the sa_role and thereplication_role to that user:

Isql –Usa –P –SASE1

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Step 5: Start GGSCI
 
 
 
 
 
 
 
 
 

转载于:https://www.cnblogs.com/alexweng/p/4379759.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值