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

请使用浏览器的分享功能分享到微信等