1.創(chuàng)建目錄:
創(chuàng)新互聯(lián)公司是一家專業(yè)提供新市企業(yè)網(wǎng)站建設(shè),專注與成都網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè)、HTML5、小程序制作等業(yè)務(wù)。10年已為新市眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)站制作公司優(yōu)惠進(jìn)行中。GGSCI (jq-prod-oracle-wms3-120-24) 3> CREATE SUBDIRS
Creating subdirectories under current directory /u01/app/goldengate
Parameter file /u01/app/goldengate/dirprm: created.
Report file /u01/app/goldengate/dirrpt: created.
Checkpoint file /u01/app/goldengate/dirchk: created.
Process status files /u01/app/goldengate/dirpcs: created.
SQL script files /u01/app/goldengate/dirsql: created.
Database definitions files /u01/app/goldengate/dirdef: created.
Extract data files /u01/app/goldengate/dirdat: created.
Temporary files /u01/app/goldengate/dirtmp: created.
Credential store files /u01/app/goldengate/dircrd: created.
Masterkey wallet files /u01/app/goldengate/dirwlt: created.
Dump files /u01/app/goldengate/dirdmp: created.
2.編輯mgr:
edit param mgr
port 7809
autostart er *
autorestart er *
PURGEOLDEXTRACTS /s01/app/goldengate/dirdat/sz*, USECHECKPOINTS, MINKEEPDAYS 3
啟動(dòng):
GGSCI (chuanqiu) 9> start mgr
Manager started.
GGSCI (chuanqiu) 10> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER RUNNING
3.添加pump進(jìn)程:
GGSCI (scm02db01.baozunops.com) 2> edit params p_wmsjq
extract p_wmsjq
rmthost 192.168.101, mgrport 7809, compress
passthru
numfiles 5000
rmttrail ./dirdat/sz
--dynamicresolution
ddl
table wms.T_USER ;
table wms.T_BRAND ;
table wms.T_CHANNEL ;
table wms.T_CUSTOMER ;
ADD EXTRACT p_wmsjq, EXTTRAILSOURCE ./dirdat/ea, BEGIN now
add rmttrail ./dirdat/sz extract p_wmsjq
啟動(dòng)進(jìn)程:
start p_wmsjq
查看添加的進(jìn)程狀態(tài):
stats P_WMSJQ
Sending STATS request to EXTRACT P_WMSJQ ...
2018-09-19 16:34:33 ERROR OGG-15149 EXTRACT P_WMSJQ is initializing, please try the command later.
GGSCI (chunqiu) 40> info P_WMSJQ
EXTRACT P_WMSJQ Initialized 2018-09-19 16:27 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:12:20 ago)
Process ID 11252
Log Read Checkpoint File ./dirdat/ea000000000
2018-09-19 16:27:03.000000
為什么會(huì)出現(xiàn)這種情況呢?
這是因?yàn)槌槿∵M(jìn)程以及運(yùn)行了很久,而且日志量非常的大,之前的很多文件已經(jīng)刪除,所以P_WMSJQ進(jìn)程在后臺(tái)不斷的尋找剛才從BEGIN now開始的時(shí)候的日志,可以從后臺(tái)可以看到如下日志確認(rèn):
tail -f ggserr.log查看后臺(tái)日志:
2018-09-19T16:41:03.194+0800 INFO OGG-02232 Oracle GoldenGate Capture for Oracle, p_wmsjq.prm: Switching to next trail file /u01/goldengate/dirdat/ea000001813 at 2018-09-19 16:41:03.194239 due to EOF. with current RBA 499,998,509.
2018-09-19T16:41:07.781+0800 INFO OGG-02232 Oracle GoldenGate Capture for Oracle, p_wmsjq.prm: Switching to next trail file /u01/goldengate/dirdat/ea000001814 at 2018-09-19 16:41:07.781704 due to EOF. with current RBA 499,999,232.
2018-09-19T16:41:12.339+0800 INFO OGG-02232 Oracle GoldenGate Capture for Oracle, p_wmsjq.prm: Switching to next trail file /u01/goldengate/dirdat/ea000001815 at 2018-09-19 16:41:12.339296 due to EOF. with current RBA 499,998,210.
那么到底需要多久才可以完成呢? 我們可以從extract的抽取進(jìn)程生成的最新的trail文件確認(rèn):
查看trail文件的序號:
ls -l ea000002*
-rw-r----- 1 oracle oinstall 477M Sep 19 15:58 ea000002146
-rw-r----- 1 oracle oinstall 477M Sep 19 16:03 ea000002147
-rw-r----- 1 oracle oinstall 477M Sep 19 16:07 ea000002148
-rw-r----- 1 oracle oinstall 477M Sep 19 16:11 ea000002149
-rw-r----- 1 oracle oinstall 477M Sep 19 16:25 ea000002150
-rw-r----- 1 oracle oinstall 477M Sep 19 16:40 ea000002151
-rw-r----- 1 oracle oinstall 477M Sep 19 16:52 ea000002152
-rw-r----- 1 oracle oinstall 6.0M Sep 19 16:52 ea000002153
或者查看另外的pump進(jìn)程:
GGSCI (chunqiu) 41> info PUMP_lbs
EXTRACT PUMP_WMS Last Started 2018-09-19 06:55 Status RUNNING
Checkpoint Lag 00:00:03 (updated 00:00:03 ago)
Process ID 92773
Log Read Checkpoint File /u01/goldengate/dirdat/ea000002152
2018-09-19 16:42:10.000000 RBA 85805949
從該進(jìn)程可以看出ea000001815 到ea000002151 還有點(diǎn)時(shí)間,不過已經(jīng)越來越接近了。
等了很久,再次看下:
GGSCI (scm02db01.baozunops.com) 54> info P_WMSJQ
EXTRACT P_WMSJQ Initialized 2018-09-19 16:27 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:42:57 ago)
Process ID 11252
Log Read Checkpoint File ./dirdat/ea000000000
2018-09-19 16:27:03.000000
已經(jīng)42分鐘過去了,可知trail文件是相當(dāng)大的。
最后確認(rèn):
GGSCI (scm02db01.baozunops.com) 79> info P_WMSJQ
EXTRACT P_WMSJQ Last Started 2018-09-19 17:32 Status RUNNING
Checkpoint Lag 00:00:00 (updated 00:00:07 ago)
Process ID 71325
Log Read Checkpoint File /s01/goldengate/dirdat/ea000002156
2018-09-19 17:32:04.000000 RBA 37332782
GGSCI (chunqiu) 80> stats P_WMSJQ
Sending STATS request to EXTRACT P_WMSJQ ...
Start of Statistics at 2018-09-19 17:33:07.
DDL replication statistics (for all trails):
*** Total statistics since extract started ***
Operations 0.00
Mapped operations 0.00
Unmapped operations 0.00
Other operations 0.00
Excluded operations 0.00
Output to ./dirdat/sz:
Extracting from wms.T_USER to WMS.T_USER:
*** Total statistics since 2018-09-19 17:32:22 ***
Total inserts 7041.00
Total updates 108651.00
Total deletes 178000.00
Total discards 0.00
Total operations 293692.00
看看target端文件已經(jīng)傳輸過來:
-rw-r----- 1 oracle oinstall 499999847 Sep 19 17:31 sz000000000
-rw-r----- 1 oracle oinstall 499999640 Sep 19 17:31 sz000000001
-rw-r----- 1 oracle oinstall 499999561 Sep 19 17:43 sz000000002
-rw-r----- 1 oracle oinstall 50584137 Sep 19 17:47 sz000000003
另外,如果是新的環(huán)境或者是日志量非常小,不會(huì)出現(xiàn)這種情況。
因此,在日志工作中,特別是生產(chǎn)環(huán)境,如果遇到goldengate問題,不要驚慌,只要理解原理,解決問題相當(dāng)簡單。
2018-09-19 周三
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢,專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場景需求。