Oracle Goldengate重新初始化的 3種方法

shytodear發表於2014-10-15
方法一:透過DBLINK進行重新初始化

1.停複製程式
GGSCI (ljodsdb1) > stop TREPLVA

2.檢視源端CURRENT_SCN
select CURRENT_SCN from v$database@jjgc_yyjc; --12748737956750

3.編輯複製程式,修改對應CSN
edit params TREPLVA
MAP FMIS1100.XTBILLMX2014 , TARGET ODS_YYJC_BUF.XTBILLMX2014 ,
      COLMAP (USEDEFAULTS,year="2014",updatetime=@DATENOW()),
         FILTER (@GETENV ("TRANSACTION","CSN") > 12748737956750);

4.同步表的資料truncate+insert
--truncate table T_GATHER_PROJECT_GROUP_DX;

insert into T_GATHER_PROJECT_GROUP_DX
select a.*,sysdate from STDPM.T_GATHER_PROJECT_GROUP_DX@jjgc_yyjc as of scn 12748737956750 a;

5.啟動複製程式
GGSCI (ljodsdb1) > start TREPLVA



方法二:透過資料泵impdp重新初始化

$vi impdp_table.par
userid=ODS_YYJC_BUF/ODS_YYJC_BUF@yyjc1
directory=trans_work
logfile=impdp_table.log
REMAP_SCHEMA=STDPM:ODS_YYJC_BUF
tables=STDPM.T_GATHER_PROJECT_GROUP_DX
content=data_only
network_link=jjgc_yyjc
FLASHBACK_SCN=2285907

$nohup impdp parfile=impdp_table.par &

expdp ogguser/ogg@orcl directory=oggdump file=nanhai.dmp tables=scott.emp grants=n statistics=none sriggers=n compress=n FLASHBACK_SCN=1176681
impdp odsf/odsf@orcl directory=guowangp file=nanhai.dmp PARALLEL=4 logfile=c.log remap_schema=FMIS:ODS remap_tablespace=FMIS2500:ODSVIEW INCLUDE=TABLE_DATA


方法三:透過exp+imp重新初始化
exp ods_yyjc_buf/ods_yyjc_buf@orcl file=e:\oracl\ods_yyjc_buf.dmp FLASHBACK_SCN=2285907 TABLES=aa,bb
imp ods_yyjc_oggfj/ods123@orcl file=e:\ods_yyjc_buf.dmp fromuser=ods_yyjc_buf touser=ods_yyjc_oggfj tables=aa,bb ignore=y




資料比對:
select DXID , DXMC ,DXTYBZ,CPR , SKR ,PMJE,PJZT ,CPRQ ,DQR , COMPID,HOLDERACCNAME from  FMIS1100.XTGLDX5015@cwgk_yyjc
minus
select DXID , DXMC ,DXTYBZ,CPR , SKR ,PMJE,PJZT ,CPRQ ,DQR , COMPID,HOLDERACCNAME from ODS_YYJC_BUF.XTGLDX5015;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27126919/viewspace-1299422/,如需轉載,請註明出處,否則將追究法律責任。

相關文章