1.背景
GoldenGate重要的日志檔案有2個:ggserr.log和discard檔案。
ggserr.log記錄重要的日志,如程序啟停、程序失敗abend及響應ggsci指令的響應輸出。
discard檔案,是丢棄檔案,在備機端,同步環境沒有問題的前提下,在執行具體某個sql時失敗,會把執行失敗的sql放入到discard檔案。
由此看出,discard檔案很重要,是運維發現哪些表主從不一緻的重要線索。
2.目前環境的問題
目前設定如下:
discardfile ./dirrpt/rept01.dsc , purge,megabytes 100
會出現2個問題:
discard檔案太小:隻有200M,持續運作N天後,會滿。
discard檔案會被覆寫:尤其重新開機replicat程序後,檔案會被清空。
3.解決方法
修改控制參數,相關參數包括:
3.1.追加還是清空
指定discard檔案名時一起設定為append追加。并調整最大大小。
Syntax DISCARDFILE <file name>
[, APPEND | PURGE]
[, MAXBYTES <n> | MEGABYTES <n>]
同時,如果檔案大小超限後,程序就會退出,顧大小盡量設大。
To set an upper limit for the size of the file, use either the MAXBYTESor MEGABYTESoption. If the specified size is exceeded, the process will abend.
3.2. 定期歸檔
使用參數:discardrollover
本參數指定個時點,當到達時點時,自動歸檔discard檔案。歸檔檔案的格式是,<group name><n>.<extension>。
3.3.修改後
discardfile ./dirrpt/rept01.dsc , append,megabytes 2048
discardrollover at 05:30
經過觀察,
确實在每天的05:30,自動建立個新的discard檔案。
最新的歸檔總是從0号開始。假設現在已有2個歸檔檔案,rept010.dsc\rept011.dsc;新歸檔後,已有的更名為rept010.dsc->rept011.dsc,rept011.dsc->rept012.dsc,
新的歸檔檔案名為rept010.dec。
發現一個問題,雖然新生成了檔案,但檔案整個生命周期内,沒有任何資料。
對比之前的内容,至少也該有類似trail檔案切換的系想你;還有,中間有過4天資料不同步,肯定有無法更新、或删除的記錄才對。
具體看handlecollisions參數介紹