探讨Oracle 事务并行恢复

在之前的文章中提到过event 10513详见 http://itspace.iteye.com/blog/567754,今天继续探讨Oracle smon进程并行恢复的话题。
在不同的Oracle版本中并行恢复或多或少存在部分bug,我们可以通过参数FAST_START_PARALLEL_ROLLBACK来设置恢复的并行度,Oracle默认设置是LOW
引用
FAST_START_PARALLEL_ROLLBACK determines the maximum number of processes that can exist for performing parallel rollback. This parameter is useful on systems in which some or all of the transactions are long running.
Values:
      *FALSE indicates that parallel rollback is disabled
      *LOW limits the number of rollback processes to 2 * CPU_COUNT
      *HIGH limits the number of rollback processes to 4 * CPU_COUNT


由于并行恢复存在bug,有时候启用并行恢复并不比串行恢复来的快。查看并行恢复是否出问题,可以查看v$fast_start_servers。如果每个并行进程都处于RECOVERING状态,则建议修改参数FAST_START_PARALLEL_ROLLBACK为high。如果只有一个进程处于RECOVERING状态,其他进程处于IDEL状态,则建议将并行恢复转为串行恢复,方法如下(详见metalink doc238507.1):
引用
1. Find SMON's Oracle PID:

Example:

SQL> select pid, program from v$process where program like '%SMON%';

       PID PROGRAM
---------- ------------------------------------------------
         6 oracle@stsun7 (SMON)

2. Disable SMON transaction cleanup:

SVRMGR> oradebug setorapid
SVRMGR> oradebug event 10513 trace name context forever, level 2

3. Kill the PQ slaves that are doing parallel transaction recovery.
You can check V$FAST_START_SERVERS to find these.

4. Turn off fast_start_parallel_rollback:

alter system set fast_start_parallel_rollback=false;

If SMON is recovering, this command might hang, if it does just control-C out of it.  You may need to try this many times to get this to complete (between SMON cycles).

5. Re-enable SMON txn recovery:

SVRMGR> oradebug setorapid
SVRMGR> oradebug event 10513 trace name context off


说到并行恢复,不得不提到参数_cleanup_rollback_entries,其主要作用为通知smon进程事务的条目,Oracle解释为
引用
NAME                                          VALUE                PDESC
--------------------------------------------- -------------------- --------------------------------------------------
_cleanup_rollback_entries                     100                  no. of undo entries to apply per transaction clean

在必要时我们可以加大该参数来达到加快串行事务恢复的效果(该参数为静态参数,修改该需要重启DB),另外我们可以通过x$ktuxe来观察事务恢复尤其是死事务恢复的进度
引用
select KTUXECFL, KTUXESQN, KTUXESIZ from x$ktuxe where KTUXECFL='DEAD';

你可能感兴趣的:(oracle,sql,Blog)