标签:ogg配置 ogg搭建 ogg安装配置 goldengate搭建配置
GOLDENGATE安装与数据复制流搭建配置
(源库为实例,支持ASM,不含DDL抽取版)
2、OGG软件安装
#mkdir /u01/ogg
#chown –R oracle:oinstall/u01/ogg
#chmod –R 777/u01/ogg
#su – oracle
[oracle@server1~]$ vi.bash_profile
添加以下内容:
export OGG=/u01/ogg export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/u01/ogg |
[oracle@server1~]$ source.bash_profile
(1) 将ogg112101_fbo_ggs_Linux_x64_ora11g_64bit.zip软件复制到/u01/ogg目录内
(2) 解压缩软件
[oracle@server1 ~]$unzip ogg112101_fbo_ggs_Linux_x64_ora11g_64bit.zip
[oracle@server1 ~]$tar xvf fbo_ggs_Linux_x64_ora11g_64bit.tar
(如果是生产环境,此步可以跳过)
(1) 创建测试表TABLE GOLDENGATE.OGG_UPG
create table GOLDENGATE.OGG_UPG ( pr_id NUMBER(10)notnull, t_name VARCHAR2(20), sal NUMBER(10), insert_time DATE primary key ) tablespace GOLDENGATE |
(2) 创建测试用的sequence
create sequence GOLDENGATE.SEQ_OGG_T01 minvalue1 maxvalue9999999999999999999999999999 startwith1 incrementby1 cache 20; |
(3)插入数据
i number:=1; begin loop inser tinto goldengate.OGG_UPGvalues (goldengate.seq_ogg_t01.nextval,‘ogg_test1‘,i,sysdate); commit; i:=i+1; exit when i=10001; end loop; end; / |
SQL>alter database add supplemental log data;
SQL>altersystem switch logfile;
SQL>exit
[oracle@server1~]$./ggsci
GGSCI>dbloginuserid goldengate, password goldengate
GGSCI>addtrandata goldengate.ogg_upg
GGSCI>create subdirs
GGSCI> editparams mgr
dynamicportlist 7800-8000 --autorestart extract *,waitminutes 30,resetminutes 5 lagreporthours 1 laginfominutes 20 lagcriticalminutes 60 purgeoldextracts ./dirdat/tr*,usecheckpoints,minkeepdays 10 |
GGSCI>start mgr
GGSCI>add ext exttr,tranlog, begin now
GGSCI>addexttrail ./dirdat/tr, ext exttr, megabytes 200
GGSCI>editparams exttr
setenv (NLS_LANG = AMERICAN_AMERICA.AL32UTF8) userid goldengate, password goldengate REPORT AT 01:59 reportrollover at 02:00 TRANLOGOPTIONS CONVERTUCS2CLOBS THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 90000 IOLATENCY 100000 tranlogoptions altarchivelogdest primary instance orcl /u01/archive discardfile ./dirrpt/exttr.dsc, append, megabytes 1000 --warnlongtrans 2h, checkintervals 3m exttrail ./dirdat/tr numfiles 2000 dynamicresolution |
GGSCI>add extdpetr, exttrailsource ./dirdat/tr
GGSCI>add rmttrail ./dirdat/tr, extdpetr, megabytes 200
setenv (NLS_LANG = AMERICAN_AMERICA.AL32UTF8) userid goldengate, password goldengate REPORT AT 01:59 reportrollover at 02:00 rmthost 192.168.1.220, mgrport 7809, compress rmttrail ./dirdat/tr dynamicresolution numfiles 2000 gettruncates TABLE GOLDENGATE.OGG_UPG; |
GGSCI>start param dpetr
GGSCI>create subdirs
GGSCI> edit params mgr
Port 7809 dynamicportlist 7800-8000 autorestart replicat *,waitminutes 5,resetminutes 5 lagreporthours 1 laginfominutes 20 lagcriticalminutes 60 purgeoldextracts ./dirdat/tr*,usecheckpoints,minkeepdays 10 |
GGSCI>start mgr
GGSCI>dblogin userid goldengate, password goldengate
GGSCI>add checkpointtable goldengate.checkpoint_reptr_01
GGSCI>add replicat reptr, exttrail ./dirdat/tr, checkpointtablegoldengate.checkpoint_reptr_01
GGSCI>edit params reptr
setenv (NLS_LANG = AMERICAN_AMERICA.AL32UTF8) userid goldengate, password goldengate sqlexec "Alter session set constraints=deferred" REPORT AT 01:59 reportrollover at 02:00 discardrollover on friday --handlecollisions reperror default,abend discardfile ./dirrpt/reptr.dsc,append, megabytes 1000 assumetargetdefs checksequencevalue dynamicresolution numfiles 2000 batchsql BATCHESPERQUEUE 100, OPSPERBATCH 8000 grouptransops 10000 maxtransops 10000 MAP GOLDENGATE.OGG_UPG, TARGET GOLDENGATE.OGG_UPG; |
创建完replicat进程后,千万不要启动
Sql>alter system set job_queue_processes=0 scope=both; --先关闭job队列,防止后续的job再启动. Sql>alter system set aq_tm_processes=0 scope=both; --关闭高级队列 Sql>select count(*) from dba_jobs_running; --查看系统是否存在有job正在执行,如果还有JOB在运行,则进行Kill操作 |
6.2 停止前端系统应用
(防止有事务启动后,在取SCN时还未结束,由于GOLDENGATE抽取进程,只会抽取在extract进程启动之后开始的事务,该点很重要。)
6.3 杀掉所有事务
(1)查询还在执行的事务
select * from gv$transaction;
(2)kill 当前正在执行的事务的session
6.4 停掉listener
$lsnrctl stop
(防止新的连接连上来创建新事务操作表数据)
6.5 查询源端数据库的当前SCN号
SQL> selectdbms_flashback.get_system_change_number from dual;
记录下SCN号:2553440
6.6 导出数据
$expdpsystem/XXX directory=expdp_dir dumpfile=tableXXX.dmp filesize=30G logfile=expdp_XXXX.log flashback_scn=2553440 tables=GOLDENGATE.OGG_UPG
6.7 恢复源端数据库的JOB参数
Sql>alter system set job_queue_processes=20 scope=both; --根据实际值进行恢复. Sql>alter system set aq_tm_processes=1 scope=both; |
6.8 目标端数据库导入数据
$imppdp system/XXX directory=expdp_dir dumpfile=tableXXX.dmp logfile=impdp_XXXX.log |
GGSCI> startreptr,aftercsn 2553440
8.1 在目标数据库中查询GOLDENGATE.OGG_UPG表数据量
SQL> select count(*) from goldengate.ogg_upg;
COUNT(*) ---------- 10000 |
8.2 在源端数据库上的GOLDENGATE.OGG_UPG表中再插入一万行数据
declare i number:=1; begin loop insertinto goldengate.OGG_UPGvalues (goldengate.seq_ogg_t01.nextval,‘ogg_test1‘,i,sysdate); commit; i:=i+1; exitwhen i=10001; end loop; end; / |
8.2 在目标数据库上查询GOLDENGATE.OGG_UPG表数据是否增长
SQL> select count(*) from goldengate.ogg_upg;
COUNT(*) ---------- 20000 |
配置成功,并可以正常同步。
本文作者:黎俊杰(网名:踩点),从事”系统架构、操作系统、存储设备、数据库、中间件、应用程序“六个层面系统性的性能优化工作
欢迎加入 系统性能优化专业群,共同探讨性能优化技术。群号:258187244GOLDENGATE安装与数据复制流搭建配置_不含DDL抽取版
标签:ogg配置 ogg搭建 ogg安装配置 goldengate搭建配置
原文地址:http://blog.csdn.net/ljunjie82/article/details/43123319