Oracle Golden Gate基本配置

>> from zhuhaiqing.info

[oracle@localhost ogg]$ cat ~/.bash_profile

GG_HOME=/opt/ogg
PATH=$PATH:$ORACLE_HOME/bin:$GG_HOME
LD_LIBRARY_PATH=$GG_HOME:$ORACLE_HOME/lib:/usr/lib:/lib

[oracle@localhost ogg]$ ./ggsci
GGSCI (localhost.localdomain) 1> create subdirs
Creating subdirectories under current directory /opt/ogg
Parameter files /opt/ogg/dirprm: already exists
Report files /opt/ogg/dirrpt: created
Checkpoint files /opt/ogg/dirchk: created
Process status files /opt/ogg/dirpcs: created
SQL script files /opt/ogg/dirsql: created
Database definitions files /opt/ogg/dirdef: created
Extract data files /opt/ogg/dirdat: created
Temporary files /opt/ogg/dirtmp: created
Stdout files /opt/ogg/dirout: created

[oracle@localhost ogg]$ sqlplus / as sysdba
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter database archivelog;
SQL> alter database open;
SQL> alter database add supplemental log data;  --添加补充日志
SQL> alter database add supplemental log data (primary key,unique,foreign key) columns;
SQL> alter system switch logfile;
SQL> alter database force logging;         --启动强制归档
SQL> create tablespace ogg datafile '/opt/app/oracle/oradata/starboss/ogg01.dbf' size 300M;
SQL> create user ogg identified by ogg default tablespace ogg;
SQL> grant resource, connect, dba to ogg;

[oracle@localhost ogg]$ ./ggsci
GGSCI (localhost.localdomain) 1> edit params ./globals
GGSCHEMA ogg

GGSCI (localhost.localdomain) 3> edit params mgr
PORT 7839
DYNAMICPORTLIST 7840-7860

GGSCI (localhost.localdomain) 4> add extract dpen,tranlog,begin now

GGSCI (localhost.localdomain) 5> edit params dpen
extract dpen
userid sms3@starboss,password sms3
exttrail ./dirdat/rl
dynamicresolution
gettruncates
table sms3.*;

GGSCI (localhost.localdomain) 6> add exttrail ./dirdat/rl, extract dpen

GGSCI (localhost.localdomain) 6> start dpen

GGSCI (localhost.localdomain) 6> add extract pump1, exttrailsource ./dirdat/rl, begin now

GGSCI (localhost.localdomain) 5> edit params pump1
extract pump1
userid sms3, password sms3
rmthost 192.168.92.133, mgrport 7839
rmttrail ./dirdat/r1
PASSTHRU
gettruncates
table sms3.*;

GGSCI (localhost.localdomain) 6> add rmttrail ./dirdat/r1, extract pump1
GGSCI (localhost.localdomain) 6> start pump1
GGSCI (localhost.localdomain) 6> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING DPEN 00:00:00 00:00:08
EXTRACT RUNNING PUMP1 00:00:00 00:48:32


备机配置
GGSCI (localhost.localdomain) 1> edit params ./globals
GGSCHEMA ogg

GGSCI (localhost.localdomain) 2> edit params mgr
PORT 7839
DYNAMICPORTLIST 7840-7860

GGSCI (localhost.localdomain) 3> add replicat repl exttrail ./dirdat/rl,begin now,nodbcheckpoint

GGSCI (localhost.localdomain) 4> edit param repl
replicat repl                          --复制进程名
userid sms3@starboss,password sms3            --目标数据库的帐号密码
assumetargetdefs                   --两台数据库数据结构一致则使用此参数
reperror default,discard                  --如果复制数据出错则忽略
discardfile ./errinfo/repsz.dsc,append,megabytes 100 --错误信息写入XXXX文件,追加模式,最大100m
gettruncates                           --复制truncate操作
map sms3.*, target sms3.*;               --映射关系,注意target前必须留一个空格

GGSCI (localhost.localdomain) 3> star repl

GGSCI (localhost.localdomain) 6> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING REPL 00:00:00 00:00:06


posted @ 2016-05-18 22:36  皮er  阅读(304)  评论(0编辑  收藏  举报