Oracle中死事务的检查语句
SQL> SELECT KTUXEUSN, KTUXESLT, KTUXESQN, /* Transaction ID */ 2 KTUXESTA Status, KTUXECFL Flags ,KTUXESIZ 3 FROM x$ktuxe 4 WHERE ktuxesta!='INACTIVE'; KTUXEUSN KTUXESLT KTUXESQN STATUS FLAGS KTUXESIZ ---------- ---------- ---------- ---------------- ------------------------ ---------- 13 5 47447 ACTIVE DEAD 2819919 39 0 502 ACTIVE NONE 1 43 45 480 ACTIVE NONE 0
SQL> / KTUXEUSN KTUXESLT KTUXESQN STATUS FLAGS KTUXESIZ ---------- ---------- ---------- ---------------- ------------------------ ---------- 13 5 47447 ACTIVE DEAD 2819919<----该值没减小。 39 0 502 ACTIVE NONE 1 43 45 480 ACTIVE NONE 0
查询v$px_session和v$fast_start_servers,显示很多并行进程在rollback,根据以往的工程经验:
于是改为
SQL>alter system set fast_start_parallel_rollback=false scope=both;
之后,再次运行
SQL> SELECT KTUXEUSN, KTUXESLT, KTUXESQN,/* Transaction ID */ 2 KTUXESTA Status, KTUXECFL Flags ,KTUXESIZ 3 FROM x$ktuxe 4 WHERE ktuxesta!='INACTIVE'; KTUXEUSN KTUXESLT KTUXESQN STATUS FLAGS KTUXESIZ ---------- ---------- -------------------------- ------------------------ ---------- 13 5 47447 ACTIVE DEAD 2033516 35 29 502 ACTIVE NONE 1 SQL> / KTUXEUSN KTUXESLT KTUXESQN STATUS FLAGS KTUXESIZ ---------- ---------- -------------------------- ------------------------ ---------- 13 5 47447 ACTIVE DEAD 2033433<---该值不断变小。 35 29 502 ACTIVE NONE 1
使用如下脚本查看回滚完毕的预计时间(以天为单位):
SQL> set serveroutput on SQL> declare 2 l_start number; 3 l_end number; 4 begin 5 select ktuxesiz into l_startfrom x$ktuxe where KTUXEUSN=13 and KTUXESLT=5; 6 dbms_lock.sleep(60); 7 select ktuxesiz into l_endfrom x$ktuxe where KTUXEUSN=13 and KTUXESLT=5; 8 dbms_output.put_line('time estDay:'|| round(l_end/(l_start -l_end)/60/24,2)); 9 end; 10 / time est Day:.21
24*0.21=5.04小时。即:预计5.04小时后回滚完毕。
另外注意:在其他环境使用时,请注意替换KTUXEUSN=13和KTUXESLT=5
相关推荐
lklong 2020-11-22
oraclemch 2020-11-06
shilukun 2020-10-10
周嘉笙 2020-11-09
iilegend 2020-10-19
EricRay 2020-10-16
zhuzhufxz 2020-09-16
dataminer 2020-08-17
bfcady 2020-08-16
Hody 2020-08-16
FightFourEggs 2020-08-16
数据库设计 2020-08-16
Seandba 2020-08-16
Omega 2020-08-16
zjyzz 2020-08-16
yanghuatong 2020-08-16
ktyl000 2020-08-16
dbasunny 2020-08-16