1. 程式人生 > >Oracle加快回滾速度

Oracle加快回滾速度

FAST_START_PARALLEL_ROLLBACK specifies the degree of parallelism used when recovering terminated transactions. Terminated transactions are transactions that are active before a system failure. If a system fails when there are uncommitted parallel DML or DDL transactions, then you can speed up transaction recovery during startup by using this parameter.

關於fast_start_parallel_rollback引數,此引數決定了回滾啟動的並行次數,在繁忙的系統或者IO效能較差的系統,如果出現大量回滾操作,會顯著影響系統,可以通過調節此引數來降低影響

VALUES:

   false:parallel rollback is disabled

   low:limits the maximum degree of parallelim to 2*cpu_count

   high:limits the maximum degree of parallelim to 4*cpu_count

If you change the value of this parameter, then transaction recovery will be stopped and restarted with the new implied degree of parallelism.

else:另外將fast_start_parallel_rollback時,建議將parallel_force_local調整為true,以限制所有的程序都只執行在當前例項,不至於拖垮其他的節點

回滾時間計算:

  alter session set NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS'; 
  select usn,
         state,
         undoblockstotal "Total",
         undoblocksdone "Done",
         undoblockstotal - undoblocksdone "ToDo",
         decode(cputime,
                0,
                'unknown',
                sysdate + (((undoblockstotal - undoblocksdone) /
                (decode(UNDOBLOCKSDONE,0,1,UNDOBLOCKSDONE) / cputime)) / 86400)) "Estimated time to complete"
from v$fast_start_transactions
where state!='RECOVERED';

注意:對於v$fast_recovery_transactions並不會記錄所有的回滾工作,一般的操作引起的回滾,如rollback,中斷操作,是不會記錄的。這個檢視一般記錄的是大量的操作期間,例項異常關閉或會話被killed之後引起的回滾,裡面記錄了回滾操作的狀態,執行時間,操作的資料塊,程序id等