Preinstall:
1. Alter source database in archive mode( alter the target either if perform. a bidirectional replication ).
2. Add supplemental log to the source database.
database level
table level
3. Create GoldenGate user whose schema stores objects used to enable DDL replication. Grant sufficient privileges to the user to login the source and target database,query,modify or delete data and so on......Or you can grant DBA privilege to the user directly.
4. Turn off the recycle bin if your database is prior 11g.
--默认记录日志的的信息,只记录rowid以及被修改的字段,在GoldenGate还原该事务是,target端的数据块结构可能与源端完全不同,此时就需要借助主键或者唯一键等来准确定位被修改的记录,补全日志根据补全的信息量课对应分为最小附加日志、主键补全、唯一键补全、外键补全及所有补全(排除LOB和LONG类型的字段)。
Install:
1. Download the correct version package for your source and target database( Pay attention about your database and system version ).
2. Create dedicated user for installing the OGG software for later easy-monitoring, easy-maintaining. Notice that the environment configuration in the .bash_profile.
3. Create dedicated installation direction for easy-locating and monitoring later.
4. Untar or unzip the compressed package into the OGG installation direction.
5. Use ggsci command enter OGG command line from the local shell environment.
6. Command CREATE SUBDIRS to create the OGG subdirections, like ./dirdat for store trail files, ./dirprm for parameter files, ./dirrpt for each process report and so on.
--正确的版本号,连接数据库的版本,系统版本;
--使用GoldenGate专有用户进行软件的安装;
--使用独立的安装目录
Configuration:
1. Add supplemental log from the table level:
GGSCI >dblogin userid ***,password ***
--Source side
GGSCI >add trandata scott.*
--Cause DB to log primary-key columns for all update operations on the tables in the schema of Scott .
GGSCI >edit param ./GLOBALS
--Target side
ggschema gguser
checkpointtable gguser.checkpoint
GGSCI >dblogin ***,password ***
GGSCI >add checkpointtable gguser.checkpoint
--Add checkpoint table in the target DB which is used to store the checkpoint information. That makes the checkpoint information part of Replicat process and makes easy-recovery from various disaster.
--源端打开日志补全,目标端创建checkpoint表
2. Edit the Manager parameter file for both source and target and start them:
GGSCI >edit param mgr
--source
port 7801
dynamicportlist 7802-7820
GGSCI >start mgr
--Start the Manager process
GGSCI >info mgr
--Check the Manager status
GGSCI >edit param mgr
--target
port 7901
dynamicportlist 7902-7920
--监听端口默认值7809,动态端口列表可选,但指定有利于性能提升。
3. Extract process group(Source: Local Extract )
GGSCI >edit param lemp1
extract lemp1
dynamicresolution
userid gguser,password gguser
ddl include all
ddloptions addtrandata,report
ReportCount Every 10000 Records, Rate Report at 00:30
DiscardFile /u01/app/gg/dirrpt/lemp1.dsc, Append
DiscardRollover at 02:00
ExtTrail /u01/app/gg/dirdat/l1
Table scott.*;
GGSCI >add ext lemp1, tranlog ,begin now
--tranlog, means that Extract captures changed data from the transaction log( as source data ).
--begin now, means that Extract begins capturing data from the timestamp which the command issues.
GGSCI >add exttrail /u01/app/gg/dirdat/l1,ext lemp1,megabytes 100
GGSCI >start lemp1
4. Data Pump process group( Source)
GGSCI >edit param pemp1
Extract pemp1
dynamicresolution
userid gguser,password gguser
PassThru
ReportCount Every 10000 Records, Rate Report at 00:30
DiscardFile dirrpt/PHREMP2.dsc, Append
DiscardRollover at 02:00
RmtHost 127.0.0.1, MgrPort 7901
RmtTrail /u02/app/gg/dirdat/l2
Table scott.*;
GGSCI >add ext pemp1,exttrailsource /u01/app/gg/dirdat/l1
GGSCI >add rmttrail /u02/app/gg/dirdat/l2,ext pemp1
GGSCI >start pemp1
5. Repliact process group
GGSCI >edit param remp1
Replicat remp1
userid gguser,password gguser
dynamicresolution
AssumeTargetDefs
ddl include mapped ddloptions report
ReportCount Every 10000 Records, Rate Report at 00:30
DiscardFile /u02/app/gg/dirrpt/remp1.dsc, Append
DiscardRollover at 02:00
Map scott.*, Target scott.* ;
--Notice that prefix a space before parameter Target.
GGSCI>add rep remp1,exttrail /u02/app/gg/dirdat/l2,checkpointtable gguser.checkpoint,begin now
GGSCI>start remp1
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26679417/viewspace-749851/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26679417/viewspace-749851/