在資料同步過程中,客戶擔心在源端誤操作,比如truncate, drop, delete all等,在目標端也會立即同步,而無法挽救損失;因此,客戶希望是目標端的資料比源端要慢一個時間點。
解決方案:在ogg的replicat引數中使用
DEFERAPPLYINTERVAL <n><unit>
Specifies a length of time for Replicat to wait before applying replicated operations to the target database.
引數說明:
<n> A numeric value for the amount of time to delay. The minimum delay time is the value that is set for the EOFDELAY parameter. The maximum delay time is seven days.
<unit> The unit of time for the delay. Can be: S | SEC | SECS | SECOND | SECONDS | MIN | MINS | MINUTE | MINUTES | HOUR | HOURS | DAY | DAYS
<unit> The unit of time for the delay. Can be: S | SEC | SECS | SECOND | SECONDS | MIN | MINS | MINUTE | MINUTES | HOUR | HOURS | DAY | DAYS
使用這個引數之後,目標端始終與源端有一個時間差,但是源端的資料(佇列檔案)其實已經投遞到目標端,只是沒有交付到資料庫。所以,如果源端當掉,目標端在去掉這個引數之後,可以很快追平資料,再去接管業務應用。