首页 > Linux操作系统 > Linux操作系统 > SQL语句执行进度检查
--SQL语句执行进度检查(只对经过表分析的表有效)
select st.piece, st.sql_text, (case when st.piece = 0 then round(sl.sofar/sl.totalwork, 4) * 100 else null end) "Progress(%)"
from v$session_longops sl, v$sqltext st
where st.hash_value = sl.sql_hash_value
and st.address = hextoraw(sl.sql_address)
and sl.sofar <> sl.totalwork
order by st.piece
修改了下,如果对于多个同时进行的SQL语句,需要进行分组
select st.piece, st.hash_value, st.sql_text, (case when st.piece = 0 then round(sl.sofar/sl.totalwork, 4) * 100 else null end) "Progress(%)"
from v$session_longops sl, v$sqltext st
where st.hash_value = sl.sql_hash_value
and st.address = hextoraw(sl.sql_address)
and sl.sofar <> sl.totalwork
order by st.hash_value, st.piece
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/12932950/viewspace-604955/ ,如需转载,请注明出处,否则将追究法律责任。