Oracle中查看慢查询进度的脚本分享
Oracle一个大事务的SQL往往不知道运行到了哪里,可以使用如下SQL查看执行进度。
代码如下:
set linesize 400; set pagesize 400; col sql_text format a100; col opname format a15; SELECT se.sid, opname, TRUNC (sofar / totalwork * 100, 2) pct_work, elapsed_seconds elapsed, ROUND (elapsed_seconds * (totalwork - sofar) / sofar) remain_time, sql_text FROM v$session_longops sl, v$sqlarea sa, v$session se WHERE sl.sql_hash_value = sa.hash_value AND sl.sid = se.sid AND sofar != totalwork ORDER BY start_time;
或者
代码如下:
set linesize 400; set pagesize 400; set long 4000; col sql_fulltext format a100; col opname format a15; SELECT se.sid, opname, TRUNC (sofar / totalwork * 100, 2) pct_work, elapsed_seconds elapsed, ROUND (elapsed_seconds * (totalwork - sofar) / sofar) remain_time, sql_fulltext FROM v$session_longops sl, v$sqlarea sa, v$session se WHERE sl.sql_hash_value = sa.hash_value AND sl.sid = se.sid AND sofar != totalwork ORDER BY start_time;
相关推荐
oraclemch 2019-12-16
pfpfpfpfpf 2015-03-07
redis 2015-01-13
MySQLLelove 2019-06-27
xpaibeyond 2010-05-14
gongg0 2012-07-06
holyrong 2014-03-02
Cavlier 2012-10-04
LinuxOracleWf 2012-05-27
anshenoracle 2011-04-20
嵌入式天地 2011-01-28
LinuxOracleWf 2010-01-15
ltoper 2019-04-07
一昕之代码 2019-04-06
ltoper 2019-04-06
ltoper 2019-04-05
不怕猫的耗子A 2007-04-07