快活林资源网 Design By www.csstdc.com

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;

快活林资源网 Design By www.csstdc.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
快活林资源网 Design By www.csstdc.com