這篇文章將為大家詳細(xì)講解有關(guān)如何理解OGG的initial load和,文章內(nèi)容質(zhì)量較高,因此小編分享給大家做個(gè)參考,希望大家閱讀完這篇文章后對(duì)相關(guān)知識(shí)有一定的了解。
堅(jiān)守“ 做人真誠(chéng) · 做事靠譜 · 口碑至上 · 高效敬業(yè) ”的價(jià)值觀,專業(yè)網(wǎng)站建設(shè)服務(wù)10余年為成都成都茶藝設(shè)計(jì)小微創(chuàng)業(yè)公司專業(yè)提供成都企業(yè)網(wǎng)站定制營(yíng)銷網(wǎng)站建設(shè)商城網(wǎng)站建設(shè)手機(jī)網(wǎng)站建設(shè)小程序網(wǎng)站建設(shè)網(wǎng)站改版,從內(nèi)容策劃、視覺設(shè)計(jì)、底層架構(gòu)、網(wǎng)頁(yè)布局、功能開發(fā)迭代于一體的高端網(wǎng)站建設(shè)服務(wù)。Initial load
可分為幾種:
除去第一種方法,其余均需要initial-load extract或initial-load replicat;在同步initial-load期間的change時(shí),replicat都需要添加handlercollisions參數(shù),并在同步完成后去除;
Loading data with a database utility
使用db copy utility創(chuàng)建target db,等copy完成啟用change-sync replicat同步期間產(chǎn)生的change;此過(guò)程完成后開始正常的數(shù)據(jù)同步;
因?yàn)椴恍枰猧nitial-load extract/replicat,也無(wú)須為之配備參數(shù)文件
Loading data from file to replicat
使用initial-load extract將source table寫入remote extract文件(canonical格式),由initial-load replicat將其加逐行載入數(shù)據(jù)庫(kù),因此效率較低;
大致步驟
1 啟動(dòng)source的manager進(jìn)程:start manager;
2 編輯initial-load extract參數(shù)文件:edit params
SOURCEISTABLE – 標(biāo)明extract為initial load,直接從source table獲取數(shù)據(jù)
SOURCEDB mydb, USERID ogg, PASSWORD
AACAAAAAAAAAAAJAUEUGODSCVGJEEIUGKJDJTFNDKEJFFFTC &
AES128, ENCRYPTKEY securekey1
RMTHOST ny4387, MGRPORT 7888, ENCRYPT AES 192 KEYNAME mykey –指定target host和manager port
ENCRYPTTRAIL AES192, KEYNAME mykey1
RMTFILE /ggs/dirdat/initld, MEGABYTES 2, PURGE --指定remote extract文件,不需要維護(hù)checkpoing
TABLE hr.*;
TABLE sales.*;
3 編輯target initial-load repicat的參數(shù)文件:edit params
SPECIALRUN –將replicat設(shè)定為一次性運(yùn)行,不需要checkpoint
END RUNTIME –當(dāng)load完成后終結(jié)replicat
TARGETDB mydb, USERID ogg, PASSWORD
AACAAAAAAAAAAAJAUEUGODSCVGJEEIUGKJDJTFNDKEJFFFTC &
AES128, ENCRYPTKEY securekey1
DECRYPTTRAIL AES192, KEYNAME mykey1
EXTFILE /ggs/dirdat/initld –聲明由extract指定的rmtfile
SOURCEDEFS /ggs/dirdef/source_defs – 當(dāng)source/target表結(jié)構(gòu)不同時(shí)使用,def文件由defgen生成;如果表結(jié)構(gòu)一致則使用assumetargetdefs
MAP hr.*, TARGET hr.*;
MAP sales.*, TARGET hr.*;
4 啟動(dòng)change extract進(jìn)程:start extract
5 啟動(dòng)initial-load extract進(jìn)程:$/
6 啟動(dòng)initial-load replicat進(jìn)程:$/
7 啟動(dòng)change replicat進(jìn)程:start replicat
8 監(jiān)控change replicat狀態(tài):info replicat
9 移除change replicat的handlecollisions參數(shù):send replicat
Load data from file to database utility
使用initial-load extract將source table寫入remote ASCII文件,通過(guò)db utility加載到target db,initial-load replicat會(huì)生成run and control files輔助db utility;數(shù)據(jù)轉(zhuǎn)換必須由initial-load extract執(zhí)行;
大致步驟
1 啟動(dòng)source的manager進(jìn)程:start manager;
2 編輯initial-load extract參數(shù)文件:edit params
SOURCEISTABLE –聲明extract為initial-load
SOURCEDB mydb, USERID ogg, PASSWORD
AACAAAAAAAAAAAJAUEUGODSCVGJEEIUGKJDJTFNDKEJFFFTC &
AES128, ENCRYPTKEY securekey1
RMTHOST ny4387, MGRPORT 7888, ENCRYPT AES 192 KEYNAME mykey –指定target host和manager port
ENCRYPTTRAIL AES192, KEYNAME mykey1
RMTFILE /ggs/dirdat/initld, MEGABYTES 2, PURGE –指定remote extract文件
FORMATASCII, SQLLOADER –將輸出格式化為ASCII文本,替代默認(rèn)的canonical格式,可選項(xiàng)包括BCP和SQLLOADER
TABLE hr.*;
TABLE sales.*;
3 編輯target initial-load repicat的參數(shù)文件:edit params
GENLOADFILES sqlldr.tpl --生成run and control files,輔助db utility加載數(shù)據(jù),該文件動(dòng)態(tài)生成不可人工干預(yù)
USERID ogg, PASSWORD
AACAAAAAAAAAAAJAUEUGODSCVGJEEIUGKJDJTFNDKEJFFFTC &
AES128, ENCRYPTKEY securekey1
DECRYPTTRAIL AES192, KEYNAME mykey1
EXTFILE /ggs/dirdat/initld
SOURCEDEFS /ggs/dirdef/source_defs
MAP hr.*, TARGET hr.*;
MAP sales.*, TARGET hr.*;
4 啟動(dòng)change extract進(jìn)程:start extract
5 啟動(dòng)initial-load extract進(jìn)程:$/
6 啟動(dòng)initial-load replicat進(jìn)程:$/
7 加載target db:通過(guò)步驟6生成的ASCII文本文件和run and control files,使用db utility將其加載至target db,監(jiān)控直至完成
7 啟動(dòng)change replicat進(jìn)程:start replicat
8 監(jiān)控change replicat狀態(tài):info replicat
9 移除change replicat的handlecollisions參數(shù):send replicat
Load data with OGG direct load
使用initial-load extract將source table直接發(fā)送至initial-load replicat task(由manager動(dòng)態(tài)生成,不需要collector進(jìn)程),由后者通過(guò)large block加載到target;不支持log/long/UDT/大于4K的數(shù)據(jù)字段;
Target端使用dynamicportlist為replicat分配port,加速查詢和綁定過(guò)程;
大致步驟
1 啟動(dòng)source的manager進(jìn)程:start manager;
2 添加并編輯initial-load extract參數(shù)文件:add extract < initial-load extract name>, sourceistable/edit params
EXTRACT initext --指定initial-load extract 進(jìn)程名
SOURCEDB mydb, USERID ogg, PASSWORD
AACAAAAAAAAAAAJAUEUGODSCVGJEEIUGKJDJTFNDKEJFFFTC &
AES128, ENCRYPTKEY securekey1
RMTHOST ny4387, MGRPORT 7888, ENCRYPT AES 192 KEYNAME mykey
RMTTASK REPLICAT, GROUP initrep – 指導(dǎo)target的manager動(dòng)態(tài)啟動(dòng)一次性initial-load replicat,
TABLE hr.*;
TABLE sales.*;
3 添加編輯target initial-load repicat的參數(shù)文件:add replicat initrep, specialran/edit params initrep
REPLICAT initrep –指定initial-load replicat task名
TARGETDB mydb, USERID ogg, PASSWORD
AACAAAAAAAAAAAJAUEUGODSCVGJEEIUGKJDJTFNDKEJFFFTC &
AES128, ENCRYPTKEY securekey1
SOURCEDEFS /ggs/dirdef/source_defs
MAP hr.*, TARGET hr.*;
MAP sales.*, TARGET hr.*;
4 啟動(dòng)change extract進(jìn)程:start extract
5 啟動(dòng)initial-load extract進(jìn)程:start extract
6 監(jiān)控initial-load進(jìn)程,在target執(zhí)行view report
7 啟動(dòng)change replicat進(jìn)程:start replicat
8 監(jiān)控change replicat狀態(tài):info replicat
9 移除change replicat的handlecollisions參數(shù):send replicat
Load data with a direct bulk load to SQL*Loader
使用initial-load extract將source table發(fā)送給initial-load replicat,后者同SQL*Loader結(jié)合執(zhí)行直接路徑加載;
此方法只用于Oracle的SQL*Loader,不適合其他數(shù)據(jù)庫(kù);不支持lob/long類型;
1 啟動(dòng)source的manager進(jìn)程:start manager;
2 編輯initial-load extract參數(shù)文件:edit params
EXTRACT initext –指定initial-load extract進(jìn)程名
SOURCEDB mydb, USERID ogg, PASSWORD
AACAAAAAAAAAAAJAUEUGODSCVGJEEIUGKJDJTFNDKEJFFFTC &
AES128, ENCRYPTKEY securekey1
RMTHOST ny4387, MGRPORT 7888, ENCRYPT AES 192 KEYNAME mykey
RMTTASK REPLICAT, GROUP initrep –指導(dǎo)target的manager動(dòng)態(tài)啟動(dòng)initial-load replicat,為一次性任務(wù)
TABLE hr.*;
TABLE sales.*;
3 添加/編輯target initial-load repicat的參數(shù)文件:add replicat
REPLICAT initrep
USERID ogg, PASSWORD
AACAAAAAAAAAAAJAUEUGODSCVGJEEIUGKJDJTFNDKEJFFFTC &
AES128, ENCRYPTKEY securekey1
BULKLOAD –指導(dǎo)replicat同oracle sql*loader接口協(xié)同工作
SOURCEDEFS /ggs/dirdef/source_defs
MAP hr.*, TARGET hr.*;
MAP sales.*, TARGET hr.*;
4 啟動(dòng)change extract進(jìn)程:start extract
5 啟動(dòng)initial-load extract進(jìn)程:start extract
6 監(jiān)控initial-load進(jìn)程,在target執(zhí)行view report
7 啟動(dòng)change replicat進(jìn)程:start replicat
8 監(jiān)控change replicat狀態(tài):info replicat
9 移除change replicat的handlecollisions參數(shù):send replicat
Online change sync
大致分為
創(chuàng)建checkpoint表
創(chuàng)建extract組
創(chuàng)建extract參數(shù)文件
創(chuàng)建trail
創(chuàng)建replicat組
創(chuàng)建replicat參數(shù)文件
每個(gè)manager最多支持5000個(gè)并發(fā)extract和replicat組,可根據(jù)活躍程度為不同的表單獨(dú)分配extract,每個(gè)extract單獨(dú)對(duì)應(yīng)一個(gè)data pumps和replicat組;
Checkpoint表
可被多個(gè)OGG instance共享,也可創(chuàng)建多個(gè)表,每個(gè)replicat組對(duì)應(yīng)一個(gè);
創(chuàng)建方式:
1
在GLOBALS文件聲明
每個(gè)通過(guò)add replicat新建的replicat組均可自動(dòng)使用
編輯GLOBALS文件Edit params ./GLOBALS
添加參數(shù) checkpointtabl 通過(guò)GGSCI登陸數(shù)據(jù)庫(kù)dblogin sourcedb 執(zhí)行add checkpointtabl 2 創(chuàng)建replicat時(shí)聲明 add replicat checkpointtable,覆蓋GLOBALS文件;如果指定nodbcheckpoint,則使用checkpoint file; 創(chuàng)建online extract group ADD EXTRACT {, {, BEGIN [, PASSIVE] –配合alias extract使用,當(dāng)從target發(fā)起連接時(shí)用到 [, THREADS [, PARAMS [, REPORT [, DESC “ 創(chuàng)建alias extract ADD EXTRACT , RMTHOST { , {MGRPORT [, RMTNAME [, DESC “ 創(chuàng)建trail 由data pump或replicat負(fù)責(zé)讀取,teradata則需要VAM-sort extract; 為trail單獨(dú)分配一個(gè)磁盤; 添加trail ADD {RMTTRAIL | EXTTRAIL} 創(chuàng)建online replicat組 ADD REPLICAT [, BEGIN [, CHECKPOINTTABLE [, NODBCHECKPOINT] [, PARAMS [, REPORT 控制online process 啟動(dòng) Start [extract|replicat] 可配置manager參數(shù)文件,autostart為自動(dòng)啟動(dòng),autorestart自動(dòng)重啟動(dòng) 停止 Stop [extract|replicat] 強(qiáng)制關(guān)閉replicat stop replicat 殺死 Kill [extract|replicat] 一次執(zhí)行操作多個(gè)進(jìn)程 --可選命令為start/stop/kill 刪除進(jìn)程組 停止相應(yīng)進(jìn)程后,可將其刪除但可同時(shí)保留參數(shù)文件,后續(xù)可重新添加同樣組; GGSCI登陸數(shù)據(jù)庫(kù),執(zhí)行delete [extract|replicat] 關(guān)于如何理解OGG的initial load和就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,可以學(xué)到更多知識(shí)。如果覺得文章不錯(cuò),可以把它分享出去讓更多的人看到。
當(dāng)前名稱:如何理解OGG的initialload和-創(chuàng)新互聯(lián)
文章地址:http://weahome.cn/article/dgicje.html
其他資訊