ogg 切换:
1, 主端,目标端 添加对应的 参数(extract,replicat,pump,主备互换) 注意dirdat 目录下文件不要冲突。
目标端:
2, 原目标端 开启forcelogging ,supplemanagelog
SQL > ARCHIVE LOG LIST;
SQL > ALTER DATABASE FORCELOGGING ;
SQL > ALTER DATABASE ADD supplemental log data ;
GGSCI> EDIT PARAMS ./GLOBALS
CHECKPOINTTABLE OGG.CHECKPOINT
这里为测试,参数如下:
切换前: source 端 10.118.242.214
target 端 10.118.242.216
2.1 切换前 - 参数
--MGR (source,target 两端相同)--
GGSCI (sfpay-asmtest) 64> view params mgr
port 7809
dynamicportlist 7810-7900
userid ogg@ogg,password ogg
autorestart extract *,waitminutes 2,retries 7
lagreporthours 1
laginfominutes 30
lagcriticalminutes 45
purgeoldextracts ./dirdat/*,usecheckpoints,minkeepdays 5
purgeddlhistory minkeepdays 3,maxkeepdays 5,frequencyminutes 20
PURGEMARKERHISTORY MINKEEPDAYS 3, MAXKEEPDAYS 5, FREQUENCYMINUTES 20
--EXTRACT(捕获进程-source 端)--
extract exct01
setenv (ORACLE_HOME="/u01/app/oracle/product/11.2.0.4/dbhome_1")
setenv (NLS_LANG="AMERICAN_AMERICA.AL32UTF8")
dynamicresolution
gettruncates
numfiles 5000
userid ogg@ogg,password ogg
tranlogoptions convertucs2clobs
TRANLOGOPTIONS LOGRETENTION DISABLED
TRANLOGOPTIONS DBLOGREADER
tranlogoptions altarchivelogdest primary instance SFPAY1 +dg_arch/sfpay1/archivelog
--TRANLOGOPTIONS ASMUSER sys@ASM,ASMPASSWORD oracle123
--THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 20000
reportcount every 2 minutes,rate
discardfile ./dirrpt/exct01.dsc,append,megabytes 1000
warnlongtrans 2h,checkinterval 3m
exttrail ./dirdat/su
ddl include all
ddloptions addtrandata,report
--add test
TABLE DM_ACT.*;
TABLE DM_MEB.*;
--EXTRACT(PUMP进程-source 端)--
GGSCI (sfpay-asmtest) 68> view params EXPMP01
extract expmp01
passthru
report at 02:00
reportrollover at 02:10
rmthost 10.118.242.216,mgrport 7809
rmttrail /home/gg/gg11.2/dirdat/ta
dynamicresolution
numfiles 2000
--add tables
TABLE DM_ACT.*;
TABLE DM_MEB.*;
--REPLICAT(抽取进程-target 端)--
GGSCI (sfpay.datatest.mysql01) 68> view params REPP01
REPLICAT repp01
SETENV (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)
USERID ogg@ogg, PASSWORD ogg
DISCARDFILE ./dirrpt/repp01.dsc, PURGE, MAXBYTES 104857600
sqlexec "Alter session set constraints=deferred"
REPORT AT 01:59
reportrollover at 02:00
--handlecollisions
reperror default,abend
REPORTCOUNT EVERY 30 MINUTES, RATE
DDL INCLUDE MAPPED, EXCLUDE INSTR 'SHRINK SPACE'
ddloptions report
assumetargetdefs
checksequencevalue
allownoopupdates
dynamicresolution
numfiles 2000
--ERROR IGNORE
DDLERROR 10636 IGNORE
--20151028 add
MAP DM_ACT.*, TARGET DM_ACT.*;
MAP DM_MEB.*,TARGET DM_MEB.*;
--切换操作:
3,GGSCI (sfpay-asmtest) 12> lag extract EXCT01
Sending GETLAG request to EXTRACT EXCT01 ...
Last record lag: 0 seconds.
At EOF, no more records to process.
GGSCI > STOP EXCT01
4, GGSCI (sfpay-asmtest) 13> lag extract expmp01
Sending GETLAG request to EXTRACT EXPMP01 ...
Last record lag: 4 seconds.
At EOF, no more records to process.
GGSCI > STOP EXPMP01
--目标端
5,GGSCI (sfpay.datatest.mysql01) 18> lag replicat repp01
Sending GETLAG request to REPLICAT REPP01 ...
Last record lag: 4 seconds.
At EOF, no more records to process.
GGSCI > STOP REPP01
-----切换后操作----
切换后: source 端 10.118.242.216
target 端 10.118.242.214
参数:
--source端(extract)--
GGSCI (sfpay.datatest.mysql01) 70> view params EXCT02
extract exct02
setenv (ORACLE_HOME="/u01/app/oracle/product/11.2.0.4/dbhome_1")
setenv (NLS_LANG="AMERICAN_AMERICA.AL32UTF8")
dynamicresolution
gettruncates
numfiles 5000
userid ogg@ogg,password ogg
tranlogoptions convertucs2clobs
TRANLOGOPTIONS LOGRETENTION DISABLED
TRANLOGOPTIONS DBLOGREADER
--tranlogoptions altarchivelogdest primary instance sfpay2 +dg_arch/sfpay1/archivelog
--TRANLOGOPTIONS ASMUSER sys@ASM,ASMPASSWORD oracle123
--THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 20000
reportcount every 2 minutes,rate
discardfile ./dirrpt/exct02.dsc,append,megabytes 1000
warnlongtrans 2h,checkinterval 3m
exttrail ./dirdat/bb
ddl include all
ddloptions addtrandata,report
--add test
TABLE DM_ACT.*;
TABLE DM_MEB.*;
--source端(pump)--
extract expmp02
passthru
report at 02:00
reportrollover at 02:10
rmthost 10.118.242.214,mgrport 7809
rmttrail /home/gg11.2/dirdat/bb
dynamicresolution
numfiles 2000
--add tables
TABLE DM_ACT.*;
TABLE DM_MEB.*;
--target端(replicat)--
GGSCI (sfpay-asmtest) 69> view params repp02
REPLICAT repp02
SETENV (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)
USERID ogg@ogg, PASSWORD ogg
DISCARDFILE ./dirrpt/repp02.dsc, PURGE, MAXBYTES 104857600
sqlexec "Alter session set constraints=deferred"
REPORT AT 01:59
reportrollover at 02:00
--handlecollisions
reperror default,abend
REPORTCOUNT EVERY 30 MINUTES, RATE
DDL INCLUDE MAPPED, EXCLUDE INSTR 'SHRINK SPACE'
ddloptions report
assumetargetdefs
checksequencevalue
allownoopupdates
dynamicresolution
numfiles 2000
--ERROR IGNORE
DDLERROR 10636 IGNORE
--20151028 add
MAP DM_ACT.*, TARGET DM_ACT.*;
MAP DM_MEB.*,TARGET DM_MEB.*;
--这里, 可以拷贝原source端的参数,注意各参数变更,dirdat/xx 最好使用新定义的文件名。
--切换:
--新source端:
GGSCI >add extract EXCT02 , tranlog ,begin now
GGSCI >add exttrail ./dirdat/bb,extract EXCT02,megabytes 500
GGSCI > START EXT02
--新target端:
GGSCI >add replicat REPP02,exttrail ./dirdat/bb,checkpointtable OGG.CHECKPOINT,BEGIN NOW
GGSCI > START REPP02
--新source端:
GGSCI >add extract EXPMP02,exttrailsource ./dirdat/bb,begin now
GGSCI >add rmttrail /home/gg11.2/dirdat/bb,extract expmp02,megabytes 500
GGSCI > START expmp02
--新source端:
GGSCI > add trandata dm_act.*
GGSCI > add trandata dm_meb.*
--检查数据同步:
GGSCI > INFO EXTRACT EXCT02,SHOWCH
GGSCI > INFO EXTRACT EXPMP02,SHOWCH
GGSCI > INFO REPLICAT REPP02,SHOWCH
GGSCI > STATS EXCT02,DAILY ,TABLE DM_ACT.TEST
GGSCI > STATS REPP02,DAILY ,TABLE DM_ACT.TEST
GGSCI > STATS EXPMP02, TOTAL