您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

调整Oracle回滚的速度

2025/10/27 14:32:14发布20次查看
回滚的速度快慢通过参数fast_start_parallel_rollback来实现,此参数可以动态调整 关于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来确定
sql> select usn, state, undoblocksdone, undoblockstotal, cputime, pid,xid, rcvservers from v$fast_start_transactions;
usn state            undoblocksdone undoblockstotal    cputime        pid xid              rcvservers
 ---------- ---------------- -------------- --------------- ---------- ---------- ---------------- ----------
        454 recovered                110143          110143        210            01c600210027e0d9          1
        468 recovered                  430            430        17            01d40000001f3a36        128
usn:事务对应的undo段
 state:事务的状态,可选的值为(be recovered, recovered, or recovering)     
 undoblocksdone:已经完成的undo块
 undoblockstotal:总的undo数据块
 cputime:已经回滚的时间,单位是秒
 rcvservers:回滚的并行进程数
补充,查询回滚时间更好的脚本
sys@ms4adb3(dtydb5)> select  undoblockstotal total, undoblocksdone done, undoblockstotal-undoblocksdone
  2    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')
  5      from v$fast_start_transactions;
 total  mb      done      todo estimated time to complete            to_char(sysdate,'yyyy-mm-ddhh24:mi:ss'
---------- ---------- ---------- -------------------------------------- --------------------------------------
    36,767      36767          0 2014-03-19 16:59:19                    2014-03-19 16:59:19
    7,209      7209          0 2014-03-19 16:59:19                    2014-03-19 16:59:19
    3,428      3428          0 2014-03-19 16:59:19                    2014-03-19 16:59:19
    34,346      1604      32742 2014-03-19 17:25:31                    2014-03-19 16:59:19
下面是一次大量wait for a undo record等待事件的处理过程
1,某用户使用plsql执行某 insert操作异常,导致表空间不断增长,于是手工kill该回滚停掉,kill后大量wait for a undo record,大约100多个
2,查询v$fast_start_transactions视图,由于fast_start_parallel_rollback参数设置为high,且cpu为32个,因此并行进程为32×3=128个
sql> select usn, state, undoblocksdone, undoblockstotal, cputime, pid,xid, rcvservers from v$fast_start_transactions;
      usn state            undoblocksdone undoblockstotal    cputime        pid xid              rcvservers
---------- ---------------- -------------- --------------- ---------- ---------- ---------------- ----------
      454 recovering                26922          464160        103      3744 01c600210027e0d9        128
      468 recovered                  430            430        17            01d40000001f3a36        128
sql> show parameter rollback
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product