GoldenGate新增加表進行資料抽取
下面是追加新增加表的操作過程:
OGG版本:OGG_for_unix_11g (V26188-01.zip)
資料庫版本:9.2.0.5(源端)、11.2.0.2(目標端)
源端操作:
GGSCI>info er *
各個程式都正常執行(running)
1.增加表級附加日誌
GGSCI>dblogin userid , password sdb2$fwzk
GGSCI>ADD TRANDATA GFPZ.GF_RENTBOUCHER_T
ADD TRANDATA GFPZ.HISGF_RENTBOUCHER_T
ADD TRANDATA GFPZ.GF_ACCEPT_T
ADD TRANDATA GFPZ.GF_EXPORT_T
ADD TRANDATA GFPZ.GF_LEASEHOLD_T
ADD TRANDATA GFPZ.GF_SOURCE_T
ADD TRANDATA GFPZ.HISGF_LEASEHOLD_T
ADD TRANDATA GFPZ.GF_IMPORT_T
ADD TRANDATA GFPZ.GF_LOCATION_T
ADD TRANDATA GFPZ.HISGF_LOCATION_T
ADD TRANDATA GFPZ.GF_ACCEPT_AUDIT_T
ADD TRANDATA GFPZ.GF_PRIVATEPART_T
ADD TRANDATA GFPZ.HISGF_PRIVATEPART_T
ADD TRANDATA GFPZ.GF_EQUIPMENT_T
ADD TRANDATA GFPZ.GF_PRIVATEEQUIPMENT_T
ADD TRANDATA GFPZ.GF_PUBLICPART_T
ADD TRANDATA GFPZ.HISGF_EQUIPMENT_T
ADD TRANDATA GFPZ.HISGF_PRIVATEEQUIPMENT_T
ADD TRANDATA GFPZ.HISGF_PUBLICPART_T
ADD TRANDATA GFPZ.GF_DATA_LOG_T
ADD TRANDATA GFPZ.GF_PRIVATEBUILD_T
ADD TRANDATA GFPZ.HISGF_PRIVATEBUILD_T
ADD TRANDATA GFPZ.BUILDINGAREA
ADD TRANDATA GFPZ.GF_PRINT_POINT_T
ADD TRANDATA GFPZ.HISGF_R_REALHOUSE_T
ADD TRANDATA GFPZ.CT_DISTRICT
ADD TRANDATA GFPZ.EXCEL
(注:所有新增加的各個表的欄位未超過32個欄位)
檢視錶級別附加日誌是否增加成功:
GGSCI>INFO TRANDATA GFPZ.* #檢視是否開啟了trandata設定,是否會執行初始化同步
2.切換歸檔日誌
SQL>alter system archive log current;
3.停止extract 程式、停止pump程式、停止relicat程式(目標端操作)
GGSCI>stop extract xxxxx
GGSCI>stop extract xxxxx
4.配置舊的extract程式,pump程式
GGSCI>edit params extract程式
新增下面的表進入:
TABLE GFPZ.GF_RENTBOUCHER_T;
TABLE GFPZ.HISGF_RENTBOUCHER_T;
TABLE GFPZ.GF_ACCEPT_T;
TABLE GFPZ.GF_EXPORT_T;
TABLE GFPZ.GF_LEASEHOLD_T;
TABLE GFPZ.GF_SOURCE_T;
TABLE GFPZ.HISGF_LEASEHOLD_T;
TABLE GFPZ.GF_IMPORT_T;
TABLE GFPZ.GF_LOCATION_T;
TABLE GFPZ.HISGF_LOCATION_T;
TABLE GFPZ.GF_ACCEPT_AUDIT_T;
TABLE GFPZ.GF_PRIVATEPART_T;
TABLE GFPZ.HISGF_PRIVATEPART_T;
TABLE GFPZ.GF_EQUIPMENT_T;
TABLE GFPZ.GF_PRIVATEEQUIPMENT_T;
TABLE GFPZ.GF_PUBLICPART_T;
TABLE GFPZ.HISGF_EQUIPMENT_T;
TABLE GFPZ.HISGF_PRIVATEEQUIPMENT_T;
TABLE GFPZ.HISGF_PUBLICPART_T;
TABLE GFPZ.GF_DATA_LOG_T;
TABLE GFPZ.GF_PRIVATEBUILD_T;
TABLE GFPZ.HISGF_PRIVATEBUILD_T;
TABLE GFPZ.BUILDINGAREA;
TABLE GFPZ.GF_PRINT_POINT_T;
TABLE GFPZ.HISGF_R_REALHOUSE_T;
TABLE GFPZ.CT_DISTRICT;
TABLE GFPZ.EXCEL;
GGSCI>edit params pump程式
新增如下的表進入:
TABLE GFPZ.*;
5.開啟舊的extract程式,開啟舊的pump程式
GGSCI>start extract 程式
GGSCI>start pump程式
6.獲得當前系統SCN
SQL>COL SCN FOR 999999999999999999999
SQL>variable SCN number
SQL>exec :scn := dbms_flashback.get_system_change_number
SQL>print scn
30974084141
7.export匯出所有需要抽取的表
exp dbmaintain file=/tmp/gfpz.dmp log=/tmp/gfpz.log tables=GF_RENTBOUCHER_T,HISGF_RENTBOUCHER_T,GF_ACCEPT_T,GF_EXPORT_T,GF_LEASEHOLD_T,GF_SOURCE_T,HISGF_LEASEHOLD_T,GF_IMPORT_T,GF_LOCATION_T,HISGF_LOCATION_T,GF_ACCEPT_AUDIT_T,GF_PRIVATEPART_T,HISGF_PRIVATEPART_T,GF_EQUIPMENT_T,GF_PRIVATEEQUIPMENT_T,GF_PUBLICPART_T,HISGF_EQUIPMENT_T,HISGF_PRIVATEEQUIPMENT_T,HISGF_PUBLICPART_T,GF_DATA_LOG_T,GF_PRIVATEBUILD_T,HISGF_PRIVATEBUILD_T,BUILDINGAREA,GF_PRINT_POINT_T,HISGF_R_REALHOUSE_T,CT_DISTRICT,EXCEL) flashback_scn='30974084141'
目標端操作:
8.新增新使用者(GFPZ)的表空間、使用者賦予許可權
SQL>create tablespace gfpz datafile '+data' size 10g segment space management auto;
SQL>drop user gfpz cascade;
SQL>create user gfpz identified by gfpz_123 default tablespace gfpz quota unlimited on gfpz;
SQL>grant connect,resource to gfpz;
9.配置舊的relicat程式
新增如下語句在舊的relicat程式裡面
GGSCI>map gfpz.GF_RENTBOUCHER_T ,target gfpz.GF_RENTBOUCHER_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.HISGF_RENTBOUCHER_T ,target gfpz.HISGF_RENTBOUCHER_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.GF_ACCEPT_T ,target gfpz.GF_ACCEPT_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.GF_EXPORT_T ,target gfpz.GF_EXPORT_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.GF_LEASEHOLD_T ,target gfpz.GF_LEASEHOLD_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.GF_SOURCE_T ,target gfpz.GF_SOURCE_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.HISGF_LEASEHOLD_T ,target gfpz.HISGF_LEASEHOLD_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.GF_IMPORT_T ,target gfpz.GF_IMPORT_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.GF_LOCATION_T ,target gfpz.GF_LOCATION_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.HISGF_LOCATION_T ,target gfpz.HISGF_LOCATION_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.GF_ACCEPT_AUDIT_T ,target gfpz.GF_ACCEPT_AUDIT_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.GF_PRIVATEPART_T ,target gfpz.GF_PRIVATEPART_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.HISGF_PRIVATEPART_T ,target gfpz.HISGF_PRIVATEPART_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.GF_EQUIPMENT_T ,target gfpz.GF_EQUIPMENT_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.GF_PRIVATEEQUIPMENT_T ,target gfpz.GF_PRIVATEEQUIPMENT_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.GF_PUBLICPART_T ,target gfpz.GF_PUBLICPART_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.HISGF_EQUIPMENT_T ,target gfpz.HISGF_EQUIPMENT_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.HISGF_PRIVATEEQUIPMENT_T ,target gfpz.HISGF_PRIVATEEQUIPMENT_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.HISGF_PUBLICPART_T ,target gfpz.HISGF_PUBLICPART_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.GF_DATA_LOG_T ,target gfpz.GF_DATA_LOG_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.GF_PRIVATEBUILD_T ,target gfpz.GF_PRIVATEBUILD_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.HISGF_PRIVATEBUILD_T ,target gfpz.HISGF_PRIVATEBUILD_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.BUILDINGAREA ,target gfpz.BUILDINGAREA ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.GF_PRINT_POINT_T ,target gfpz.GF_PRINT_POINT_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.HISGF_R_REALHOUSE_T ,target gfpz.HISGF_R_REALHOUSE_T ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.CT_DISTRICT ,target gfpz.CT_DISTRICT ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
map gfpz.EXCEL ,target gfpz.EXCEL ,filter (@GETENV ("TRANSACTION", "CSN")>30974084141);
10.import匯入資料
imp gfpz/gfpz_123 file=gfpz.dmp fromuser=gfpz touser=gfpz log=gfpz_imp.log
11.開啟舊的relicat程式
GGSCI>start replicat 程式
12.刪除repliact程式filter選項內容
當replicat程式將追加部分的資料開始同步並與源庫持平以後,將replicat程式中的filter clause刪除並重啟replicat程式
map gfpz.GF_RENTBOUCHER_T ,target gfpz.GF_RENTBOUCHER_T ;
map gfpz.HISGF_RENTBOUCHER_T ,target gfpz.HISGF_RENTBOUCHER_T ;
map gfpz.GF_ACCEPT_T ,target gfpz.GF_ACCEPT_T ;
map gfpz.GF_EXPORT_T ,target gfpz.GF_EXPORT_T ;
map gfpz.GF_LEASEHOLD_T ,target gfpz.GF_LEASEHOLD_T ;
map gfpz.GF_SOURCE_T ,target gfpz.GF_SOURCE_T ;
map gfpz.HISGF_LEASEHOLD_T ,target gfpz.HISGF_LEASEHOLD_T ;
map gfpz.GF_IMPORT_T ,target gfpz.GF_IMPORT_T ;
map gfpz.GF_LOCATION_T ,target gfpz.GF_LOCATION_T ;
map gfpz.HISGF_LOCATION_T ,target gfpz.HISGF_LOCATION_T ;
map gfpz.GF_ACCEPT_AUDIT_T ,target gfpz.GF_ACCEPT_AUDIT_T ;
map gfpz.GF_PRIVATEPART_T ,target gfpz.GF_PRIVATEPART_T ;
map gfpz.HISGF_PRIVATEPART_T ,target gfpz.HISGF_PRIVATEPART_T ;
map gfpz.GF_EQUIPMENT_T ,target gfpz.GF_EQUIPMENT_T ;
map gfpz.GF_PRIVATEEQUIPMENT_T ,target gfpz.GF_PRIVATEEQUIPMENT_T ;
map gfpz.GF_PUBLICPART_T ,target gfpz.GF_PUBLICPART_T ;
map gfpz.HISGF_EQUIPMENT_T ,target gfpz.HISGF_EQUIPMENT_T ;
map gfpz.HISGF_PRIVATEEQUIPMENT_T ,target gfpz.HISGF_PRIVATEEQUIPMENT_T ;
map gfpz.HISGF_PUBLICPART_T ,target gfpz.HISGF_PUBLICPART_T ;
map gfpz.GF_DATA_LOG_T ,target gfpz.GF_DATA_LOG_T ;
map gfpz.GF_PRIVATEBUILD_T ,target gfpz.GF_PRIVATEBUILD_T ;
map gfpz.HISGF_PRIVATEBUILD_T ,target gfpz.HISGF_PRIVATEBUILD_T ;
map gfpz.BUILDINGAREA ,target gfpz.BUILDINGAREA ;
map gfpz.GF_PRINT_POINT_T ,target gfpz.GF_PRINT_POINT_T ;
map gfpz.HISGF_R_REALHOUSE_T ,target gfpz.HISGF_R_REALHOUSE_T ;
map gfpz.CT_DISTRICT ,target gfpz.CT_DISTRICT ;
map gfpz.EXCEL ,target gfpz.EXCEL ;
13.禁用外來鍵
select 'alter table '||table_name||' modify constraint '||constraint_name||' disable;' from user_constraints where constraint_type='R';
14.經過驗證,源端的資料成功被目標端抽取.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15797451/viewspace-1677058/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- GoldenGate抽取Informix資料庫安裝及配置GoORM資料庫
- goldengate抽取程式延遲90小時Go
- RestCloud ETL抽取動態庫表資料實踐RESTCloud
- 如何抽取Oracle資料到文字文件進行查詢NAOracle
- 基於BERT進行抽取式問答
- 使用隱含引數testMappingSpeed排查GoldenGate抽取慢的步驟APPGo
- Flink 實踐教程-進階(2):複雜格式資料抽取
- GoldenGate 自動化初始資料Go
- onethink裡自己匯入新的資料表,無法進行運算元據表怎麼辦?
- 從雲資料遷移服務看MySQL大表抽取模式MySql模式
- 資料恢復:AMDU資料抽取恢復資料恢復
- 在多資料來源中對部分資料表使用shardingsphere進行分庫分表
- AMDU資料抽取案例一則
- Transwarp元件Trasporter工具資料抽取元件
- [shell]shell指令碼實現每天自動抽取資料插入hive表指令碼Hive
- 大資料包表如何進行自動化測試大資料
- MySQL、Oracle後設資料抽取分析MySqlOracle
- 資料上雲,應該選擇全量抽取還是增量抽取?
- 使用GoldenGate EVENTACTIONS執行資料的實時觸發和定製化Go
- Java實戰:教你如何進行資料庫分庫分表Java資料庫
- OGG-00446 goldengate 抽取程式找不到相應的歸檔日誌的解Go
- Datax離線資料抽取(MySQL--MySQL)MySql
- Datax離線資料抽取(Oracle--MySQL)OracleMySql
- Datax離線資料抽取(MySQL--Oracle)MySqlOracle
- GoldenGate表異構的解決方法Go
- 資料抽取中的CDC(變化資料捕獲)方式
- 資料結構進階:ST表資料結構
- GoldenGate for bigdata 12.3.2.1版本新特性Go
- 報表如何實現對資料列進行排名分析?
- GoldenGate異種資料庫之間的複製Go資料庫
- 使用pandas進行資料分析
- 怎麼進行資料分析
- 大資料如何進行分析大資料
- TDengine 如何進行資料建模?
- SQL Server中使用臨時表進行資料備份與恢復SQLServer
- 《資料安全法》實施後,企業如何依法進行資料安全加固及創新
- 從資料集中隨機抽取一定數量的資料隨機
- iNeuOS工業互聯作業系統,圖表與資料點組合成新元件,進行專案複用作業系統元件
- 網頁可讀內容抽取 API 資料介面網頁API