ITPub博客

首页 > 数据库 > Oracle > 等待事件wait for a undo record 与 fast_start_parallel_rollback参数

等待事件wait for a undo record 与 fast_start_parallel_rollback参数

Oracle 作者:不一样的天空w 时间:2019-01-30 16:47:49 0 删除 编辑

今天一个客户报数据库运行速度很慢,登上去查。


检查数据库,发现数据库中存在很多wait for a undo record等待事件。再检查发现有很多的并发进程在运行。


通常,如果有很多并发进程,可以根据v$px_session视图去查看,查看v$px_session视图,发现所有的并发进程都是由smon进程导致(即qcsid列为smon进程的session id)


而smon进程的等待事件为wait for stopper event to be increased 


关于这个现象,查询mos,可以看到相应的解释和解决方法(464246.1)

In fast-start parallel rollback, the background process SMON acts as a coordinator and rolls back a set of transactions in parallel using multiple server processes.

Fast start parallel rollback is mainly useful when a system has transactions that run a long time before a commit, especially parallel Inserts, Updates, Deletes operations. When SMON discovers that the amount of recovery work is above a certain threshold, it automatically begins parallel rollback by dispersing the work among several parallel processes.


There are cases where parallel transaction recovery is not as fast as serial transaction recovery because the PQ slaves may interfere with each others work by contending for the same resource. With such a transaction rollback performance may be worse in parallel when compared to a serial rollback.  


Becasue of this contention and the perceived slowness and 'hang' like symptoms (the database may seem to hang, SMON and parallel query slaves may be seen to take all the available CPU), DBA intervent


即smon进程在做大事务的回滚,默认参数fast_start_parallel_rollback参数为low,即回滚时会启动2*CPU个数 个并发进程。而由于是使用并发,所以可能由于并发之间相互使用共同的资源,导致回滚速度更慢。


解决方法为将fast_start_parallel_rollback参数改为false


fast_start_paralllel_rollback参数是可以动态修改的,但是对于正在运行大量的回滚操作的数据库实例来说,可能动态修改会导致一些问题(具体会是什么问题,oracle官方文档并没有说),正确修改方法参考官方文档(238507.1)

1.查找smon进程ID

2.禁用smon进程的事务清理(Disable SMON transaction cleanup)

  oradebug setorapid 'SMON's Oracle PID';

  oradebug event 10513 trace name context forever, level 2

3.查询V$FAST_START_SERVERS视图,将所有smon启用的并发进程杀掉

4.修改fast_start_parallel_rollback参数

  alter system set fast_start_parallel_rollback=false;

5.启用smon进程的事务清理(enable transaction recovery)

  oradebug setorapid 'SMON's Oracle PID';

  oradebug event 10513 trace name context off


关于fast_start_paralllel_rollback参数的介绍:

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


对于数据库中的回滚事务,可以查看下面的视图监控:


V$FAST_START_SERVERS

V$FAST_START_TRANSACTIONS


分别查看回滚的进程信息和事务信息


select pid from v$fast_start_servers where state='RECOVERING';

select spid from v$process where pid in (select pid from v$fast_start_servers where state='RECOVERING');

select * from v$fast_start_transactions;


Database Appears to Hang Waits for "Wait for a undo record" and "Wait for stopper event to be increased" Due to Parallel Transaction Recover (文档 ID 464246.1)

How to Disable Parallel Transaction Recovery When Parallel Txn Recovery is Active (文档 ID 238507.1)


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31397003/viewspace-2565262/,如需转载,请注明出处,否则将追究法律责任。

下一篇: DG搭建配置方案
请登录后发表评论 登录
全部评论

注册时间:2016-09-22

  • 博文量
    761
  • 访问量
    400544