我有一个长时间运行的 RMAN 作业,我需要一个脚本来监视 RMAN 执行的进度。如何监控 RMAN 进度?

 Oracle 有多个视图可以监视长时间运行的作业,包括v$session_longopsv$process 和v$session另请参阅RMAN 自动备份的 Windows DOS 脚本中的 RMAN 备份脚本 以及RMAN shell 脚本示例


SELECT SID, SERIAL#, CONTEXT, SOFAR, TOTALWORK,
ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE"
FROM V$SESSION_LONGOPS
WHERE OPNAME LIKE 'RMAN%'
AND OPNAME NOT LIKE '%aggregate%'
AND TOTALWORK != 0
AND SOFAR <> TOTALWORK;
 

Yousef Rifai发布了这个 RMAN 监控脚本,当您需要监控长时间运行的 RMAN 备份作业的状态时,它非常方便:

REM RMAN Progress
alter session set nls_date_format='dd/mm/yy hh24:mi:ss'
/
select SID, START_TIME,TOTALWORK, sofar, (sofar/totalwork) * 100 done,
sysdate + TIME_REMAINING/3600/24 end_at
from v$session_longops
where totalwork > sofar
AND opname NOT LIKE '%aggregate%'
AND opname like 'RMAN%'
/

REM RMAN wiats
set lines 120
column sid format 9999
column spid format 99999
column client_info format a25
column event format a30
column secs format 9999
SELECT SID, SPID, CLIENT_INFO, event, seconds_in_wait secs, p1, p2, p3
  FROM V$PROCESS p, V$SESSION s
  WHERE p.ADDR = s.PADDR
  and CLIENT_INFO like 'rman channel=%'
/

  

posted @ 2023-12-06 20:52  雪竹子  阅读(72)  评论(0编辑  收藏  举报