标签:
Step 1: Start the GGSCI on Source and Target
Source | Target |
Oracle GoldenGate Command Interpreter for Sybase | Oracle GoldenGate Command Interpreter for Oracle |
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:
Source | Target |
export DSQUERY=ASE1 port 15021 GGSCI> start mgr | GGSCI> edit param mgr
port 15021 GGSCI> start 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 create table city (id int, name varchar(10) insert into city values (1,‘New York‘) > select count(1) from city | connect swat/swat create table city (id int, name varchar2(10); insert into city values (1,‘New York‘); > 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
ltm_truncpage ltm_trunc_state db_rep_stat gen_id dbid dbname lti_version ------------- --------------- ----------- ----------- ------ ------------ ----------- 524307 1 1 0 5 sydatabase 0
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:
Source | Target |
GGSCI >dblogin sourcedb pubs2@ASE1 userid ogguser password ogguser
|
GGSCI > dblogin userid swat, password swat
|
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.
Source | Target |
emaster.prm: extract emaster
|
rmaster.prm:
replicat rmaster
|
Adding the Extract:
|
Adding the Replicat:
|
pmaster.prm: extract pmaster
|
|
Adding the Pump:
|
|
Insert a New Record in Sybase
|
SQL> select * from regions;
|
Delete a Record in Sybase
|
SQL> select * from regions;
|
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.
Unzip the downloaded file with the following commands:
unzip V32422-01.zip
tar xvf ggs_Linux_x86_sybase15_5_32bit.tar
Check the shared library path:
env |grep LD_LIBRARY_PATH
LD_LIBRARY_PATH=/home/sybase/ASE-15_0/lib:/home/sybase/DataAccess/ODBC/lib:
/home/sybase/OCS-15_0/lib:/home/sybase/OCS-15_0/lib3p:/home/sybase/ASE-15_0/lib:
/home/sybase/DataAccess/ODBC/lib:/home/sybase/OCS-15_0/lib:
/home/sybase/OCS-15_0/lib3p:
Add the OGG installation path to the path (PATH) and shared library path (LD_LIBRARY_PATH) environment variables:
export PATH=/home/ogg_for_sybase:$PATH
export LD_LIBRARY_PATH=/home/ogg_for_sybase:$LD_LIBRARY_PATH
Note:
LD_LIBRARY_PATH= /opt/sybase/ASE-16_0/lib: /opt/sybase/OCS-16_0/lib: /opt/sybase/OCS-16_0/lib3p: /opt/sybase/OCS-16_0/lib3p64: /opt/sybase/DataAccess/ODBC/lib: /opt/sybase/DataAccess64/ODBC/lib:
Run the ggsci command in the folder where Oracle GoldenGate files are unzipped:
./ggsci
GGSCI> create subdirs
...
GGSCI>Exit
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
1> sp_addlogin ogguser,ogguser
2> go
Password correctly set.
Account unlocked.
New login created.
(return status = 0)
1> sp_adduser ogguser
2> go
New user added.
(return status = 0)
1> sp_role ‘grant‘, replication_role, ogguser
2> go
Authorization updated.
(return status = 0) 1> sp_role ‘grant‘, sa_role, ogguser
2> go
Authorization updated.
(return status = 0)
export DSQUERY=ASE1
>./ggsci
GGSCI> edit param mgr port 15002 GGSCI> start mgr GGSCI> info mgr Manager is running (IP port syslab.us.oracle.com.15002)
Tip:Why do I get the "unrecognized parameter (SOURCEDB)" error?
Make sure you set the DSQUERY environment variable, you can also include the source DB server in the dblogin command shown as follows:
dblogin sourcedb sydatabase@ASE1 userid ogguser password ogguser
标签:
原文地址:http://www.cnblogs.com/alexweng/p/4379759.html