GGS: Sybase to Oracle

Step 1: Start the GGSCI on Source and Target

Source Target

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:

Source Target

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

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 [email protected] 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.

Source Target

emaster.prm:

extract emaster

exttrail ./dirdat/em,FORMAT RELEASE 11.2

sourcedb [email protected] 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:

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:
Step 3: Create Oracle GoldenGate
Run the ggsci command in the folder where Oracle GoldenGate files are unzipped:

./ggsci
GGSCI> create subdirs
...
GGSCI>Exit
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

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)
Step 5: Start GGSCI
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 [email protected] userid ogguser password ogguser
时间: 2024-10-29 03:54:44

GGS: Sybase to Oracle的相关文章

sql: sybase 和 oracle 比较

1. sybase 和 oracle 比较 http://blog.itpub.net/14067/viewspace-1030014/ Oracle采用多线索多进程体系结构 Sybase采用单进程多线索体系结构 Oracle和Sybase都采用多线索. 采用多线索的模式,能用较少的线索管理大量的用户进程;并且,线索进程是动态可调整的,当用户数增加时, 线索进程也会阶段性地自动增加;当用户数减少时,线索进程也会自动减少.多线 索结构,大大降低了Oracle和Sybase对系统资源的占用,提高了系

Sybase to Oracle Golden Gate

Sybase 安装Golden Gate: 下载,然后create subdirs.并且在两端配置好mgr,设置好端口7809 创建golden gate用户ogguser,并且给它授权sa和replication [[email protected] ~]# su - sybase [[email protected] ~]$ vi .bash_profile --设置sybase路径还有DSQUERY=ASE1 [[email protected] ~]$ isql -Usa -P11111

Ogg: Sybase to Oracle个人

摘要: sybase版本:Sybase15(源端) Oracle版本:11g(目标端) Goldengate版本:11.2.0.1.0(源端),12c(目标端) 个人博客:www.czhiying.cn Goldengate同步原理: Oracle GoldenGate软件是一种基于日志的结构化数据复制备份软件,它通过解析源数据库在线日志或归档日志获得数据的增量变化,再将这些变化应用到目标数据库,从而实现源数据库与目标数据库同步.参考图如下: 从上图可以知道,Ogg的同步实现方式有两种: 在源端

在eclipse中Java连接Sybase和oracle的例子

1.连接Sybase 1)准备工作: 准备Sybase驱动jconn2.jar,在eclipse中引用这个jar包: 在项目上右键>Build Path>Add External Archives...,找到jconn2.jar,点确定. note:网上有一片文章,把jconn2.jar放到CLASSPATH环境变量中,这种方法在命令行中用javac手工编译可行.在Eclipse中需要把jconn2.jar引入项目才行. 2)一段示例代码 package connDB; import java

Zero Downtime Upgrade of Oracle 10g to Oracle 11g Using GoldenGate — 3

DDL Setup Steps SQL> grant execute on utl_file to ggs; Grant succeeded. Create GLOBALS file [[email protected] ~]$ cd /ggs/ [[email protected] ggs]$ cat GLOBALS GGSCHEMA GGS run marker_setup.sql [[email protected] ggs]$ sqlplus / as sysdba SQL*Plus:

初识 数据库及Oracle数据库

一.数据库基本概念二.数据库举例三.Oracle特点四.Oracle版本五.安装Oracle注意事项六.SQL简介七.Select语句 一.数据库基本概念 数据库(Database,DB)数据库管理系统(Database Management System,DBMS)数据库管理员(Database Administrator,DBA)数据库系统(Database System) 二.数据库举例 Oracle(Oracle) DB2(IBM) SQL/Server(MS) SyBase(SyBas

从Oracle到MySQL,余额宝云实践分享

原文链接:http://www.csdn.net/article/2013-11-/2817426-interview-financial-case-yuerbao-aliyun07 余额宝.百度百发.腾讯财付通谋划的互联网理财工具,吹响了互联网对金融行业的进军节奏.而后,网易.和讯.京东商城.苏宁云商等二线实力企业纷纷涉水.另一边,一众金融精英也在频频转换思路,不仅银行网络中心从副行长牵头的服务部门一跃成为行长主抓的业务部门,而且高调发布互联网金融理财产品与携手互联网企业并行,力图实现金融互联

Oracle的学习一:安装与卸载、sql *plus常用命令、Oracle用户管理

1.为什么学习oracle? 性能优越: 小型数据库 中型数据库 大型数据库 acess.foxbase mysql.sql server.informix sybase.oracle.db2 复杂量小(100人内).成本千元内.对安全性要求不高 日访问量5000--15000.成本在万元内,比如商务网站 负载可以处理.海量数据库 .安全性很高sybase<oracle<db2 数据库的选择标准: 项目的规模:a.负载量有多大:b.成本: c.安全性 需求量大: 2.Oracle认证: DBA

Sybase数据库技术,数据库恢复---分享Sybase数据库知识(博客文章索引@51cto)

Sybase数据库技术,数据库恢复分享Sybase数据库知识 博客文章列表,更新时间:2014-12-14 Sybase数据库技术,数据库恢复 站点地图 最新文章 ASE使用with ignore_dup_row删除重复数据  (评论 0   阅读 50) ASE 16静默方式安装并创建服务器  (评论 0   阅读 80) ASE执行sp_remotesql报错:Msg 11224, Level 16, State 2  (评论 0   阅读 72) Sybase支持浪潮天梭K1系统  (评论