ITPub博客

首页 > 数据库 > Oracle > 查看RMAN备份进度的两条SQL

查看RMAN备份进度的两条SQL

Oracle 作者:18141908802 时间:2018-05-23 16:47:58 0 删除 编辑
近期在生产系统重新部署DG时网上收集发现如下两条SQL还是挺好用的,在此作为记录分享一下。<br /> SELECT SID,<br /> &nbsp; &nbsp; &nbsp; &nbsp;SERIAL#,<br /> &nbsp; &nbsp; &nbsp; &nbsp;CONTEXT,<br /> &nbsp; &nbsp; &nbsp; &nbsp;SOFAR,<br /> &nbsp; &nbsp; &nbsp; &nbsp;TOTALWORK,<br /> &nbsp; &nbsp; &nbsp; &nbsp;ROUND(SOFAR / TOTALWORK * 100, 2) "%_COMPLETE"<br /> &nbsp; FROM gV$SESSION_LONGOPS<br /> WHERE OPNAME LIKE 'RMAN%' AND OPNAME NOT LIKE '%aggregate%' AND<br /> &nbsp; &nbsp; &nbsp; &nbsp;TOTALWORK != 0 AND SOFAR &lt;&gt; TOTALWORK;<br /> <div style="white-space:nowrap;"> 或<br /> <br /> <br /> col opname for a30<br /> set linesize 500&nbsp;<br /> select inst_id,sid,serial#,opname,COMPLETE,<br /> trunc(((to_char(last_update_time,'dd')-to_char(start_time,'dd'))*60*24+(to_char(last_update_time,'hh24')-to_char(start_time,'hh24'))*60 +(to_char(last_update_time,'mi')-to_char(start_time,'mi')))*(100-complete)/complete) min from&nbsp;<br /> (&nbsp;<br /> SELECT inst_id,<br /> sid,<br /> serial#,<br /> opname,<br /> ROUND(SOFAR / TOTALWORK * 100, 2) COMPLETE,<br /> LAST_UPDATE_TIME,<br /> START_TIME<br /> FROM gV$SESSION_LONGOPS<br /> WHERE OPNAME LIKE 'RMAN%'<br /> --AND OPNAME NOT LIKE '%aggregate%'<br /> AND TOTALWORK != 0<br /> AND SOFAR &lt;&gt; TOTALWORK<br /> ) t ;<br /> <br /> <br /> 如下为在系统查询的结果:<br /> <br /> SQL&gt; SELECT SID,<br /> &nbsp; 2 &nbsp; &nbsp; &nbsp; &nbsp; SERIAL#,<br /> &nbsp; 3 &nbsp; &nbsp; &nbsp; &nbsp; CONTEXT,<br /> &nbsp; 4 &nbsp; &nbsp; &nbsp; &nbsp; SOFAR,<br /> &nbsp; 5 &nbsp; &nbsp; &nbsp; &nbsp; TOTALWORK,<br /> &nbsp; 6 &nbsp; &nbsp; &nbsp; &nbsp; ROUND(SOFAR / TOTALWORK * 100, 2) "%_COMPLETE"<br /> &nbsp; 7 &nbsp; &nbsp;FROM gV$SESSION_LONGOPS<br /> &nbsp; 8 &nbsp;WHERE OPNAME LIKE 'RMAN%' AND OPNAME NOT LIKE '%aggregate%' AND<br /> &nbsp; 9 &nbsp; &nbsp; &nbsp; &nbsp; TOTALWORK != 0 AND SOFAR &lt;&gt; TOTALWORK;<br /> <br /> <br /> &nbsp; &nbsp; &nbsp; &nbsp;SID &nbsp; &nbsp;SERIAL# &nbsp; &nbsp;CONTEXT &nbsp; &nbsp; &nbsp;SOFAR &nbsp;TOTALWORK %_COMPLETE<br /> ---------- ---------- ---------- ---------- ---------- ----------<br /> &nbsp; &nbsp; &nbsp; &nbsp;892 &nbsp; &nbsp; &nbsp;10655 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1 &nbsp; 23280622 &nbsp; 53423998 &nbsp; &nbsp; &nbsp;43.58<br /> <br /> <br /> SQL&gt; col opname for a30<br /> SQL&gt; set linesize 500&nbsp;<br /> SQL&gt;&nbsp;<br /> SQL&gt; select inst_id,sid,serial#,opname,COMPLETE,<br /> &nbsp; 2 &nbsp;trunc(((to_char(last_update_time,'dd')-to_char(start_time,'dd'))*60*24+(to_char(last_update_time,'hh24')-to_char(start_time,'hh24'))*60 +(to_char(last_update_time,'mi')-to_char(start_time,'mi')))*(100-complete)/complete) min from&nbsp;<br /> &nbsp; 3 &nbsp;(&nbsp;<br /> &nbsp; 4 &nbsp;SELECT inst_id,<br /> &nbsp; 5 &nbsp;sid,<br /> &nbsp; 6 &nbsp;serial#,<br /> &nbsp; 7 &nbsp;opname,<br /> &nbsp; 8 &nbsp;ROUND(SOFAR / TOTALWORK * 100, 2) COMPLETE,<br /> &nbsp; 9 &nbsp;LAST_UPDATE_TIME,<br /> &nbsp;10 &nbsp;START_TIME<br /> &nbsp;11 &nbsp;FROM gV$SESSION_LONGOPS<br /> &nbsp;12 &nbsp;WHERE OPNAME LIKE 'RMAN%'<br /> &nbsp;13 &nbsp;--AND OPNAME NOT LIKE '%aggregate%'<br /> &nbsp;14 &nbsp;AND TOTALWORK != 0<br /> &nbsp;15 &nbsp;AND SOFAR &lt;&gt; TOTALWORK<br /> &nbsp;16 &nbsp;) t ;<br /> <br /> <br /> &nbsp; &nbsp;INST_ID &nbsp; &nbsp; &nbsp; &nbsp;SID &nbsp; &nbsp;SERIAL# OPNAME &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; COMPLETE &nbsp; &nbsp; &nbsp; &nbsp;MIN<br /> ---------- ---------- ---------- ------------------------------ ---------- ----------<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2 &nbsp; &nbsp; &nbsp; 1057 &nbsp; &nbsp; &nbsp;37067 RMAN: aggregate input &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 78.34 &nbsp; &nbsp; &nbsp; &nbsp;139<br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2 &nbsp; &nbsp; &nbsp; &nbsp;892 &nbsp; &nbsp; &nbsp;10655 RMAN: full datafile backup &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;43.65 &nbsp; &nbsp; &nbsp; &nbsp;156<br /> <br /> <br /> SQL&gt;&nbsp;<br /> <br /> 第二条SQL语句还显示剩余时间(估计时间)。<br /> </div>

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

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

注册时间:2017-01-16

  • 博文量
    117
  • 访问量
    92303