ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 查看SQL查询进度

查看SQL查询进度

原创 Linux操作系统 作者:xhailiang 时间:2006-11-09 00:00:00 0 删除 编辑
Sometimes there are batch jobs or long-running queries in the database that may take a while to complete. This query will show the status of the query -- how much of it is completed. In other words, this may be viewed as a "progress bar" for the query. It has been tested on v. 9.2.04 on Tru64 and Windows. (Note: This tip is a modified version of a tip from Oracle documentation.)

SELECT * FROM (select
username,opname,sid,serial#,context,sofar,totalwork
,round(sofar/totalwork*100,2) "% Complete"
from v$session_longops)
WHERE "% Complete" != 100
/

SELECT * FROM (select
username,opname,sid,serial#,context,b.sql_text,sofar,totalwork
,round(sofar/totalwork*100,2) "% Complete",elapsed_seconds,sql_hash_value
from v$session_longops , v$sql b
where sql_hash_value=b.hash_value )
WHERE "% Complete" != 100

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/308563/viewspace-171932/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-02-17

  • 博文量
    270
  • 访问量
    415643