1.前提安装好数据库,本文数据库版本为11.2.0.4;ogg软件解要到相应的目录,本文解压在/home/n目录下
2.创建一个操作系统用户n,属于oinstall组(为了登录数据库)
3.a.检查数据库最小附加日志是否打开
SELECT SUPPLEMENTAL_LOG_DATA_MIN FROM V$DATABASE;
b.打开数据库最小附加日志开关
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
c.切换归档日志,使附加日志开关生效
ALTER SYSTEM SWITCH LOGFILE;
开归档(目标端可以不开归档)
4.配置环境变量:
[n@test1 ~]$ vim ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
export TEMP=/oradata/tmp
export TMPDIR=/oradata/tmp
export ORACLE_BASE=/oradata/app/oracle
export ORACLE_HOME=/oradata/app/oracle/11.2.0/db
export ORACLE_SID=source2
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib //一定要
源端配置:
1.配置ogg用户:
SQL>Create user scofy identified by scofy ;
SQL>grant dba to scofy;
GGSCI (test1) 1> dblogin userid scofy,password scofy;
Successfully logged into database.
2.配置提取进程:
GGSCI (test1) 2> REGISTER EXTRACT ext_pdg database ///不需要;
2015-12-07 09:25:33 INFO OGG-02003 Extract EXT_PDG successfully registered with database at SCN 500815.
GGSCI (test1) 5> create subdirs
Creating subdirectories under current directory /home/n
Parameter files /home/n/dirprm: already exists
Report files /home/n/dirrpt: created
Checkpoint files /home/n/dirchk: created
Process status files /home/n/dirpcs: created
SQL script files /home/n/dirsql: created
Database definitions files /home/n/dirdef: created
Extract data files /home/n/dirdat: created
Temporary files /home/n/dirtmp: created
Stdout files /home/n/dirout: created
GGSCI (test1) 6> ADD EXTRACT ext_pdg INTEGRATED TRANLOG, BEGIN NOW
EXTRACT added.
GGSCI (test1) 7> ADD EXTTRAIL ./dirdat/it, EXTRACT ext_pdg
EXTTRAIL added.
配置ext_pdg参数:
GGSCI (test1) 10> EDIT PARAMS ext_pdg
EXTRACT ext_pdg
USERID scofy, PASSWORD scofy
TRANLOGOPTIONS INTEGRATEDPARAMS (MAX_SGA_SIZE 100)
EXTTRAIL ./dirdat/it
TABLE pdg.test; ///table以;结尾
3.配置传输进程:
GGSCI (test1) 8> ADD EXTRACT ext_dp EXTTRAILSOURCE ./dirdat/it ///本地存放trail的路径
EXTRACT added.
GGSCI (test1) 9> ADD RMTTRAIL ./dirdat/rt, EXTRACT ext_dp ///目标端trail存放的路径
RMTTRAIL added.
配置ext_pd参数:
GGSCI (test1) 12> EDIT PARAMS ext_dp
EXTRACT ext_dp
USERID scofy, PASSWORD scofy
RMTHOST 10.80.18.250, MGRPORT 7839 ///mgrport端口号与mgr的port要一致
RMTTRAIL ./dirdat/rt
TABLE pdg.test;
4.配置管理进程参数:
GGSCI (test1) 14> edit param mgr
PORT 7839
DYNAMICPORTLIST 7840-7939
AUTORESTART EXTRACT *,RETRIES 5,WAITMINUTES 3
PURGEOLDEXTRACTS ./dirdat/*,usecheckpoints, minkeepdays 3
LAGREPORTHOURS 1
LAGINFOMINUTES 30
LAGCRITICALMINUTES 45
GGSCI (test1) 20> start mgr
GGSCI (test1) 21>start ext_pdg
GGSCI (test1) 22>start ext_pd
GGSCI (test1) 25> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
EXTRACT RUNNING EXT_DP 00:00:00 00:12:19
EXTRACT RUNNING EXT_PDG 00:00:00 00:44:42
配置目标端:
1.创建ogg用户
SQL> create user ogg identified by ogg;
User created.
SQL> grant dba to ogg;
Grant succeeded.
GGSCI (test3) 1> dblogin userid ogg ,password ogg
Successfully logged into database.
2.配置复制进程:
创建目录:
GGSCI (test3) 4> create subdirs
Creating subdirectories under current directory /home/n
Parameter files /home/n/dirprm: already exists
Report files /home/n/dirrpt: created
Checkpoint files /home/n/dirchk: created
Process status files /home/n/dirpcs: created
SQL script files /home/n/dirsql: created
Database definitions files /home/n/dirdef: created
Extract data files /home/n/dirdat: created
Temporary files /home/n/dirtmp: created
Stdout files /home/n/dirout: created
创建检查点表:
GGSCI (test3) 2> ADD CHECKPOINTTABLE ogg.ckpt
Successfully created checkpoint table ogg.ckpt.
复制进程:
GGSCI (test3) 5> add replicat rep_pdg, exttrail ./dirdat/rt checkpointtable ogg.ckpt
REPLICAT added. ///目标端存放trail文件目录
复制进程参数配置:
GGSCI (test3) 9> edit param rep_pdg
REPLICAT rep_pdg
ASSUMETARGETDEFS
setenv (ORACLE_SID="target2")
USERID ogg, PASSWORD ogg
map pdg.test ,target hc.test;
2.配置管理进程参数:
GGSCI (test3) 10> edit param mgr
PORT 7839
DYNAMICPORTLIST 7840-7939
AUTORESTART EXTRACT *,RETRIES 5,WAITMINUTES 3
PURGEOLDEXTRACTS ./dirdat/*,usecheckpoints, minkeepdays 3
LAGREPORTHOURS 1
LAGINFOMINUTES 30
LAGCRITICALMINUTES 45
GGSCI (test3) 12> start mgr
Manager started.
配置GLOBALS参数(一定要大小)
GGSCI (test3) 14> edit params GLOBALS
GGSCHEMA ogg
CHECKPOINTTABLE ogg.checkpoint
GGSCI (test3) 15> start rep_pdg
Sending START request to MANAGER ...
REPLICAT REP_PDG starting
GGSCI (test3) 16> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
REPLICAT RUNNING REP_PDG 00:00:00 00:00:00
好,以上ogg配置完成。