GoldenGate 11g 简要配置步骤
描述:源端和目标端为Oracle 10gR2数据库,将scott数据库导出,在源端与目标端新增test用户,并导入scott的逻辑备份,来实现两个数据库之间test下数据同步。两个数据库的实例均为db01。
— scott 资源导入导出命令
expdp scott/tiger schemas=scott dumpfile=scott.dmp directory=backup;
impdp scott/tiger schemas=scott dumpfile=scott.dmp directory=backup;
— 创建GoldenGate用户并授权(S&T)
CREATE USER ogg IDENTIFIED BY ogg
DEFAULT TABLESPACE “USERS”
TEMPORARY TABLESPACE “TEMP”;
GRANT “DBA” TO ogg ;
— 创建数据库用户并授权(S&T)
CREATE USER test IDENTIFIED BY welcome
DEFAULT TABLESPACE “EXAMPLE”
TEMPORARY TABLESPACE “TEMP”;
GRANT “DBA” TO test ;
— 导入scott到test中(S&T)
impdp test/welcome remap_schema=scott:test dumpfile=scott.dmp directory=backup;
— 检查附加日志并打开(S&T)
SQL> archive log list;
SQL> alter database add supplemental log data;
SQL> alter system archive log current;
SQL> alter database force logging;
SQL> select log_mode,supplemental_log_data_min,force_logging from v$database;
LOG_MODE SUPPLEME FOR
———— ——– —
ARCHIVELOG YES YES
— 环境变量 (S&T)
export GG_HOME=/opt/ggs
— 创建目录(S&T)
GGSCI > create subdirs
Creating subdirectories under current directory /opt/ggs
Parameter files /opt/ggs/dirprm: already exists
Report files /opt/ggs/dirrpt: created
Checkpoint files /opt/ggs/dirchk: created
Process status files /opt/ggs/dirpcs: created
SQL script files /opt/ggs/dirsql: created
Database definitions files /opt/ggs/dirdef: created
Extract data files /opt/ggs/dirdat: created
Temporary files /opt/ggs/dirtmp: created
Stdout files /opt/ggs/dirout: created
— 配置并启动MGR
GGSCI > view params mgr
port 7809
GGSCI > start mgr
— 创建抽取进程(S)
GGSCI > dblogin userid ogg,password ogg
GGSCI > add extract ext1,tranlog,begin now
GGSCI > add exttrail /opt/ggs/dirdat/ke, extract ext1
GGSCI > view params ext1
extract ext1
setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
userid ogg@db01,password ogg
exttrail /opt/ggs/dirdat/ke
dynamicresolution
table test.*;
— 创建投递进程(S)
GGSCI > dblogin userid ogg,password ogg
GGSCI > add extract exp1,exttrailsource /opt/ggs/dirdat/ke, begin now
GGSCI > add rmttrail /opt/ggs/dirdat/ke, extract exp1
GGSCI > view params exp1
extract exp1
setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
rmthost 192.168.56.13, mgrport 7809
rmttrail /opt/ggs/dirdat/ke
passthru
table test.*;
— 创建写入进程(T)
GGSCI > dblogin userid ogg,password ogg
GGSCI > add checkpointtable ogg.checkpointtable
GGSCI > add replicat rep1,exttrail /opt/ggs/dirdat/ke,checkpointtable ogg.CHECKPOINTTABLE
GGSCI > view params rep1
replicat rep1
setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
assumetargetdefs
userid ogg@db01,password ogg
discardfile ./dirrpt/rep1.dsc,purge
map test.*, target test.*;
— 启动各进程
GGSCI > start ext1
GGSCI > start exp1
GGSCI > start rep1