MARKER SEQUENCE
OK
## 九、配置主库到备库同步(支持DDL)
需求:将源端scott用户下的emp,dept 表通过ogg同步到目的端 ,逻辑同生产ODS
### 1、源端配置
MGR进程配置(源端和目的端都做下面操作,添加的参数也一样):
GGSCI (source) 6> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
GGSCI (source) 7> edit params mgr
–加入下面内容
PORT 7809
DYNAMICPORTLIST 7810-7860
AUTORESTART ER *, RETRIES 3, WAITMINUTES 5
PURGEOLDEXTRACTS ./dirdat/*, USECHECKPOINTS, MINKEEPDAYS 30
lagreporthours 1
laginfominutes 30
lagcriticalminutes 60
–保存退出后,重启管理进程,让配置生效:
GGSCI (source) 8> stop mgr
Manager process is required by other GGS processes.
Are you sure you want to stop it (y/n)?y
Sending STOP request to MANAGER …
Request processed.
Manager stopped.
GGSCI (source) 9> start mgr
Manager started.
GGSCI (source) 10> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
### 2、源端新增抽取进程配置
GGSCI (source) 12> edit params e_sc
–加入如下内容:
extract e_sc
userid ogg,password ogg
setenv(NLS_LANG=AMERICAN_AMERICA.AL32UTF8)
setenv(ORACLE_SID=“orcl”)
reportcount every 30 minutes,rate
numfiles 5000
discardfile ./dirrpt/e_sc.dsc,append,megabytes 1000
warnlongtrans 2h,checkinterval 30m
exttrail ./dirdat/sc
dboptions allowunusedcolumn
tranlogoptions archivedlogonly
tranlogoptions altarchivelogdest primary /u01/arch
ddl include mapped
ddloptions addtrandata,report
notcpsourcetimer
nocompressupdates
fetchoptions USEROWID
NOCOMPRESSDELETES
----------scott.EMP
table SCOTT.EMP,tokens(
TKN-CSN = @GETENV(‘TRANSACTION’, ‘CSN’),
TKN-COMMIT-TS = @GETENV (‘GGHEADER’, ‘COMMITTIMESTAMP’),
TKN-OP-TYPE = @GETENV (‘GGHEADER’, ‘OPTYPE’)
);
----------SCOTT.DEPT
table SCOTT.DEPT,tokens(
TKN-CSN = @GETENV(‘TRANSACTION’, ‘CSN’),
TKN-COMMIT-TS = @GETENV (‘GGHEADER’, ‘COMMITTIMESTAMP’),
TKN-OP-TYPE = @GETENV (‘GGHEADER’, ‘OPTYPE’)
);
### 3、源端配置投递进程配置
GGSCI (source) 13>edit params d_sc
–加入如下内容:
extract d_sc
rmthost 192.168.1.10,mgrport 7809,compress
userid ogg,password ogg
PASSTHRU
numfiles 5000
rmttrail ./dirdat/sc
dynamicresolution
table scott.*;
### 4、源端增加抽取进程
GGSCI (source) 16> add extract e_sc,tranlog,begin now
EXTRACT added.
GGSCI (source) 17> add exttrail ./dirdat/sc,extract e_sc,megabytes 500
EXTTRAIL added.
### 5、源端增加投递进程
add extract d_sc,exttrailsource ./dirdat/sc
add rmttra