前言:
此刻看官们对“oracle停止回滚”都比较珍视,朋友们都想要分析一些“oracle停止回滚”的相关知识。那么小编在网上搜集了一些对于“oracle停止回滚””的相关资讯,希望同学们能喜欢,朋友们一起来学习一下吧!概述
最近因为PLSQL崩溃导致几千万的数据产生了回滚,大概有300多万块需要回滚,那么怎么去调整Oracle回滚的速度呢?
fast_start_parallel_rollback
回滚的速度快慢通过参数fast_start_parallel_rollback来实现,此参数可以动态调整
关于fast_start_parallel_rollback参数,此参数决定了回滚启动的并行次数,在繁忙的系统或者IO性能较差的系统,如果出现大量回滚操作,会显著影响系统系统,可以通过调整此参数来降低影响。官方文档的定义如下:
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
If you change the value of this parameter, then transaction recovery will be stopped and restarted with the new implied degree of parallelism.
回滚进度
回滚过程中,回滚的进度可以通过视图V$FAST_START_TRANSACTIONS来确定:
select usn, state, undoblocksdone, undoblockstotal, CPUTIME, pid, xid, rcvservers from v$fast_start_transactions;--或者以下sqlselect ktuxeusn USN, ktuxeslt Slot, ktuxesqn Seq, ktuxesta State, ktuxesiz Undo from sys.ktuxe where ktuxesta <> 'INACTIVE' and ktuxecfl like '%DEAD%' order by ktuxesiz asc;
说明:
USN:事务对应的undo段STATE:事务的状态,可选的值为(BE RECOVERED, RECOVERED, or RECOVERING) UNDOBLOCKSDONE:已经完成的undo块UNDOBLOCKSTOTAL:总的undo数据块CPUTIME:已经回滚的时间,单位是秒RCVSERVERS:回滚的并行进程数计算回滚时间
通过以下sql可以计算回滚的实际时间,不过不是很准确的,这个时间一般会慢慢变少。
select undoblockstotal "Total", undoblocksdone "Done", undoblockstotal-undoblocksdone"ToDo",decode(cputime,0,'unknown',to_char(sysdate+(((undoblockstotal-undoblocksdone)/ (undoblocksdone / cputime)) / 86400),'yyyy-mm-dd hh24:mi:ss'))"Estimated time to complete",to_char(sysdate,'yyyy-mm-dd hh24:mi:ss')from v$fast_start_transactions;加快undo回滚
为了加快undo回滚的速度,可以通过设置fast_start_parallel_rollback,在线修改,立即生效
alter system set fast_start_parallel_rollback=HIGH scope=both;
后面会分享更多devops和DBA方面的内容,感兴趣的朋友可以关注下!
标签: #oracle停止回滚