● Aug 27, 2001 (Mon) 23:59 - v$session_longops OEMを使っていて,長いジョブの%表示が出ているのを発見‥‥‥. 長いジョブが監視できるようになったのは 8i からだったかな? 早速,発行しているSQLを見てみると,v$session_longops ビューを 見に行っている模様. OEMは重いので,普段手軽にSQL*Plusから実行できるように スクリプトを書いてみる. 出力は以下のような感じ‥‥‥. SQL Execution の出力はあまり宛にならないっぽい? 明日OEMの出力を見てもう一度練り直そう‥‥‥ 22:57:41 SQL> @longops SID SERI# USERNAME OPNAME REMAINING PER END ----- ------- --------- --------------- --------- -------- -------------------- MESSAGE -------------------------------------------------------------------------------- 22 12074 MIKAGE Table Scan 312 12.83% 2001-08-27 23:02:18 Table Scan: MIKAGE.SCAN_INDEX_MD5: 11232 out of 87524 Blocks done 22 12074 MIKAGE SQL Execution 45 50.00% 2001-08-27 22:57:51 SQL Execution: : 1053 out of 2106 units done SQLは以下のような感じで. col sid format 9999 col serial# format 999999 heading "SERI#" col username format a9 col opname format a15 word_wrapped col per format a8 col units format a10 wrapped col start_time format a20 heading "START" col last_update_time format a20 heading "LAST UPDATE" col end_time format a20 heading "END" col time_remaining format 99999999 heading "REMAINING" col elapsed_seconds format 99999999 heading "ELAPSED" col message format a80 word_wrapped set pagesize 50 SELECT sid, serial#, username, opname, /* sofar, totalwork, units, */ time_remaining, /* elapsed_seconds, time_remaining + elapsed_seconds total, */ TO_CHAR(sofar / totalwork * 100, '999.99') || '%' per, /* TO_CHAR(start_time, 'YYYY-MM-DD HH24:MI:SS') start_time, TO_CHAR(last_update_time, 'YYYY-MM-DD HH24:MI:SS') last_update_time, */ TO_CHAR(start_time + time_remaining / 60 / 60 / 24, 'YYYY-MM-DD HH24:MI:SS') end_time, message FROM v$session_longops WHERE sofar < totalwork ORDER BY sid, serial#; |
|