q66262 发表于 2018-9-26 11:34:07

长时间回滚oracle响应慢解决。

  现象:
  1. 应用连接数据异常缓慢,查询,更新,插入响应速度缓慢
  分析:
  查看这个小时的AWR,发现等待事件中
  wait for a undo record   排在第二位。。。
  原因:
  经过baidu和现在询问得知,开发人员昨天晚上向数据库中一张表插入大量数据,到白天看插入还没有完成就强行结束进程,
  导致数据库回滚,占用大量资源。
  解决办法:
  1.使用下面sql语句查看大致需要回滚时间:
  selectundoblockstotal "Total", undoblocksdone "Done", undoblockstotal-undoblocksdone2   "ToDo",decode(cputime,0,'unknown',to_char(sysdate+(((undoblockstotal-undoblocksdone)3   / (undoblocksdone / cputime)) / 86400),'yyyy-mm-dd hh24:mi:ss'))4"Estimated time to complete",to_char(sysdate,'yyyy-mm-dd hh24:mi:ss')5from v$fast_start_transactions;
  2.关闭数据库,设置参数FAST_START_PARALLEL_ROLLBACK=false
  3.重启数据库,查看回滚速度
  4.FAST_START_PARALLEL_ROLLBACK的作用
  详见:http://www.xifenfei.com/2534.html
  结论如下:
  1)Oracle大事物回滚,是没有办法取消,但是可以通过FAST_START_PARALLEL_ROLLBACK干预回滚速度
  2)数据库的并发效率高于低,取决于系统的资源情况(如果你系统的cpu非常强大,那么可能设置HIGH速度最快)
  3)回滚的数据类型,在回滚表中数据时可能设置并发比FALSE快,
  但是如果是要回滚串行数据(如:index),那么可能串行方法方式速度更快
  4)根据你的系统的使用状况,比如你想让系统的业务受到的影响最小,那么设置FALSE可能是个不错的选择。
  5.FAST_START_PARALLEL_ROLLBACK的官方说明。
  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.
  Values:
  FALSE    Parallel rollback is disabled
  LOW      Limits the maximum degree of parallelism to 2 * CPU_COUNT
  HIGH   Limits the maximum degree of parallelism to 4 * CPU_COUNT
  Note:If you change the value of this parameter,then transaction recovery will be stopped and restarted with the new implied degree of parallelism.

页: [1]
查看完整版本: 长时间回滚oracle响应慢解决。