源端:
Win 7 sp1
ogg 12.1
Sql Server 2012
目标端:
Centos 6.3
ogg 12.2
Oracle 11.2.0.4
特别提示 1: 在 start extract 进程之前需要先全备数据库, 否则将报错:
OGG-00868 Oracle GoldenGate Capture for SQL Server, ETA.prm: Supplemental logging is disabled for database 'EMTT'. To enable logging, perform the following: 1) Set 'trunc. log on chkpt.' to false. 2) Create a full backup of the database. Please refer to the "Oracle GoldenGate For Windows and UNIX Administration Guide" for details.
小注:源端sqlserver需要完整的日志链,需要定期全库备份。
特别提示 2:
在 Win中不允许用纯数字的目录, 否则将报错:
ERROR OGG-01044 Oracle GoldenGate Capture for SQL Server, 166.prm: The trail 'D:\ggs\dirdat\E0' is not assigned to extract '166'. Assign the trail to the extract with the command "ADD EXTTRAIL/RMTTRAIL D:\ggs\dirdat\E0, EXTRACT 166".
注: The trail 'D:\ggs\dirdat\E0' 不能正确显示,请看下面截图
本文重点讲解ogg在 sqlserver下的安装配置
----------------------- ogg install for oracle -------------------------------------
略提一下在oracle 下安装ogg 需要注意的相关事项:
必须先设置LD_LIBRARY_PATH,为了安装OGG所用的动态链接库。如果没有配置这个路径的话,在安装OGG的过程中会报找不到动态链接库的错误.
alter database force logging;
alter database archivelog;
select supplemental_log_data_min from v$database;
alter database add supplemental log data;
----------------------- ogg install for sql server 2012 -------------------------------------
OGG 12c is not certified on SQLSERVER 2005 and 2008, OGG 12c only supports 2008 R2 and higher DB version
直接解压安装包即可
C:\Users\Administrator>d:
D:\>cd ggs
D:\ggs>ggsci
Oracle GoldenGate Command Interpreter for SQL Server
Version 12.1.2.1.0 OGGCORE_12.1.2.1.0_PLATFORMS_140920.0203
Windows x64 (optimized), Microsoft SQL Server on Sep 20 2014 04:33:50
Operating system character set identified as GBK.
Copyright (C) 1995, 2014, Oracle and/or its affiliates. All rights res
GGSCI (DBA) 1> CREATE SUBDIRS
Creating subdirectories under current directory D:\ggs
Parameter files D:\ggs\dirprm: already exists
Report files D:\ggs\dirrpt: created
Checkpoint files D:\ggs\dirchk: created
Process status files D:\ggs\dirpcs: created
SQL script files D:\ggs\dirsql: created
Database definitions files D:\ggs\dirdef: created
Extract data files D:\ggs\dirdat: created
Temporary files D:\ggs\dirtmp: created
Credential store files D:\ggs\dircrd: created
Masterkey wallet files D:\ggs\dirwlt: created
Dump files D:\ggs\dirdmp: created
GGSCI (DBA) 2>
查看 D:\ggs目录,是否有相关目录已经生成
删除 Windows 中已经注册的服务(如第一次配置则请跳过):
查看"服务"是否已经存在“GGSMGR”服务
sc delete GGSMGR --删除服务
注册服务:
D:\ggs>INSTALL ADDSERVICE
Service 'GGSMGR' created.
Install program terminated normally.
查看"服务"是否已经存在“GGSMGR”服务(配置自动启动)
------------------------------- config datasource for sql server --------------------------------------------------------
配置ODBC:
Control Panel -> Administrative Tools -> Data Sources (ODBC),添加一个新的系统 DSN。
控制面板--> 管理工具 --> 数据源(ODBC) , 双击开启窗口配置--> 系统 DSN, 添加
数据源名称:SSQL(自定义) ---非常重要(dblogin 登录的时候需要)
要连接的数据库所在的服务器:机器名
选择 “使用用户输入登录ID和密码的SQL SERVER验证”(不是必须的,下面提供了另一种解决办法)
输入用户名和密码:emgg/zero
否则:
OGG-00551 Database operation failed: Couldn't connect to SSQL. ODBC error: SQLSTATE 37000 native database error 4060. [Microsoft][ODBC SQL Server Driver][SQL Server]无法打开登录所请求的数据库 "EMTT"。
修改默认连接到的数据库名称
测试数据源即可。
若不使用“使用用户输入登录ID和密码的SQL SERVER验证”,解决上述 OGG-00551的另一种方法:
1. If Manager is installed as service. Go to SQL Server Management studio,
Security ->login>select NT AUTHORITY\SYSTEM ->Right Click -->Properties-->Server Role -->Enable sysadmin role
安全性 -> 登录名 -> 右键单击“ NT AUTHORITY\SYSTEM” -> 属性 -> 服务器角色 -> 选中sysadmin
2. ggsci>stop mgr
3. ggsci>stop mgr
4. ggsci>start extract
-----------------------------config extract\pump\replicat -----------------------------------------------
GGSCI (DBA) 2> dblogin sourcedb SSQL, USERID emgg, password zero ---- “SSQL” 上述配置的“数据源名称”
GGSCI (DBA) 2> ADD TRANDATA cran.emp
Logging of supplemental log data is enabled for table cran.emp
GGSCI (DBA) 3> EDIT PARAMS DEFGEN
defsfile D:\ggs\dirdef\emp_defgen.def, purge
sourcedb SSQL, USERID,emgg, password zero
table cran.emp;
GGSCI (DBA) 6> exit
D:\ggs> defgen paramfile d:\ggs\dirprm\defgen.prm
***********************************************************************
Oracle GoldenGate Table Definition Generator for SQL Server
Version 12.1.2.1.0 OGGCORE_12.1.2.1.0_PLATFORMS_140920.0203
Windows x64 (optimized), Microsoft SQL Server on Sep 20 2014 05:15:05
Copyright (C) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
Starting at 2016-08-11 10:09:16
***********************************************************************
Operating System Version:
Microsoft Windows 7 , on x64
Version 6.1 (Build 7601: Service Pack 1)
Process id: 6436
***********************************************************************
** Running with the following parameters **
***********************************************************************
defsfile D:\ggs\dirdef\emp_defgen.def, purge
sourcedb SSQL
2016-08-11 10:09:16 WARNING OGG-05236 ODBC Warning: The specified DSN 'SSQL' u
ses a client driver that may be incompatible with the database server. Microsoft
SQL Server 2012 requires SQLNCLI11.DLL or a more recent version.
2016-08-11 10:09:16 INFO OGG-03036 Database character set identified as win
dows-936. Locale: zh_CN.
2016-08-11 10:09:16 INFO OGG-03037 Session character set identified as GBK.
table cran.emp;
Retrieving definition for cran.emp.
Definitions generated for 1 table in D:\ggs\dirdef\emp_defgen.def.
将def 文件copy 到目标端
目标端创建相应的表:
select username from dba_users where username='CRAN'
create table cran.emp (id number not null, first_name varchar2(50), last_name varchar2(50));
源端配置:
edit params mgr
PORT 7801
DYNAMICPORTLIST 7810-7820
PURGEOLDEXTRACTS D:\ogg\dirdat\* MINKEEPDAYS 30
AUTOSTART ER *
AUTORESTART ER *, RETRIES 3, WAITMINUTES 5, RESETMINUTES 30
edit params 166
extract 166
discardfile D:\ggs\dirrpt\E166.dsc,purge
exttrail D:\ggs\dirdat\E166\E0
TRANLOGOPTIONS MANAGESECONDARYTRUNCATIONPOINT ----必须加,否则进程报错
SOURCEDB SSQL, USERID emgg,PASSWORD zero
table cran.emp;
add extract 166,tranlog,begin now
add exttrail D:\ggs\dirdat\E166\E0,extract 166 ,megabytes 30
start 166
edit params 166P1
extract 166P1
rmthost 172.16.70.154, mgrport 7801, compress
rmttrail /u01/app/oracle/products/ogg/dirdat/166P1/R0
passthru
table *.*;
nopassthru
add extract 166P1,exttrailsource D:\ggs\dirdat\E166\E0,begin now
add rmttrail /u01/app/oracle/products/ogg/dirdat/166P1/R0,extract 166P1,megabytes 30
start 166P1
目标端配置:
mgr
PORT 7801
1、登录ggsci, 在./GLOBALS文件里添加 checkpoint 表名
edit params ./GLOBALS
ggschema ggs
checkpointtable ggs.rep_ckt
2、连上DB创建 checkpoint table
dblogin userid ogg, password zero
add checkpointtable ggs.rep_ckt
view params 166P1R1
replicat 166P1R1
SETENV (NLS_LANG='AMERICAN_AMERICA.ZHS16GBK')
sourcedefs /u01/app/oracle/products/ogg/dirdef/emp_defgen.def -------defgen文件
DBOPTIONS INTEGRATEDPARAMS(parallelism 6)
AssumeTargetDefs
--HANDLECOLLISIONS
DiscardFile /u01/app/oracle/products/ogg/dirrpt/166P1R1.dsc,purge
userid ggs, password zero
map cran.emp, target cran.emp;
add replicat 166P1R1, integrated, exttrail /u01/app/oracle/products/ogg/dirdat/166P1/R0,begin now,checkpointtable ogg.rep_ckt
start 166P1R1
trail.png
(8.55 KB, 下载次数: 17)
2016-10-1 15:17 上传