监控rman执行操作的脚本

  1. REM -------------------------------  
  2. REM Script to monitor rman backup/restore operations  
  3. REM To run from sqlplus:   @monitor '<dd-mon-rr hh24:mi:ss>'   
  4. REM Example:    
  5. --SQL>spool monitor.out  
  6. --SQL>@monitor '06-aug-12 16:38:03'  
  7. REM where <dateis the start time of your rman backup or restore job  
  8. REM Run monitor script periodically to confirm rman is progessing  
  9. REM -------------------------------  
  10.   
  11.   
  12. alter session set nls_date_format='dd-mon-rr hh24:mi:ss';  
  13. set lines 1500  
  14. set pages 100  
  15. col CLI_INFO format a10  
  16. col spid format a5  
  17. col ch format a20  
  18. col seconds format 999999.99  
  19. col filename format a65  
  20. col bfc  format 9  
  21. col "% Complete" format 999.99  
  22. col event format a40  
  23. set numwidth 10  
  24.   
  25.   
  26. select sysdate from dual;  
  27.   
  28.   
  29. REM gv$session_longops (channel level)  
  30.   
  31.   
  32. prompt  
  33. prompt Channel progress - gv$session_longops:  
  34. prompt  
  35. select  s.inst_id,   -- 实例编号  
  36.         o.sid,       --session_id  
  37.         CLIENT_INFO ch,  --客户端信息  
  38.         context,       --上下文信息         
  39.         sofar,         --已完成工作量  
  40.         totalwork,     --总工作量  
  41.         round(sofar/totalwork*100,2) "% Complete"  --完成进度比  
  42.      FROM gv$session_longops o, gv$session s  
  43.      WHERE opname LIKE 'RMAN%'  
  44.      AND opname NOT LIKE '%aggregate%'  
  45.      AND o.sid=s.sid  
  46.      AND totalwork != 0  
  47.      AND sofar <> totalwork;  
  48.   
  49.   
  50. REM Check wait events (RMAN sessions) - this is for CURRENT waits only  
  51. REM use the following for 11G+  
  52. prompt  
  53. prompt Session progess - CURRENT wait events and time in wait so far:  
  54. prompt  
  55. select inst_id,  
  56.        sid,   
  57.        CLIENT_INFO ch,   
  58.        seq#,     --最近等待的唯一标识  
  59.        event,    --等待事件  
  60.        state,    --状态(WAITING 、WAITED UNKNOWN TIME、WAITED SHORT TIME 、WAITED KNOWN TIME  )  
  61.        wait_time_micro/1000000 seconds  --已经等待的时间  
  62. from gv$session where program like '%rman%' and  
  63. wait_time = 0 and  
  64. not action is null;  
  65.   
  66.   
  67. REM use the following for 10G    
  68. --select  inst_id, sid, CLIENT_INFO ch, seq#, event, state, seconds_in_wait secs  
  69. --from gv$session where program like '%rman%' and  
  70. --wait_time = 0 and  
  71. --not action is null;  
  72.   
  73.   
  74. REM gv$backup_async_io  
  75. prompt  
  76. prompt Disk (file and backuppiece) progress - includes tape backuppiece   
  77. prompt if backup_tape_io_slaves=TRUE:  
  78. prompt  
  79. select s.inst_id, a.sid, CLIENT_INFO Ch, a.STATUS,  
  80. open_time,   --文件打开时间  
  81. round(BYTES/1024/1024,2) "SOFAR Mb" ,  --已完成大小  
  82. round(total_bytes/1024/1024,2) TotMb,  --总大小  
  83. io_count,                              --文件当前发送的IO请求数量  
  84. round(BYTES/TOTAL_BYTES*100,2) "% Complete" ,   
  85. a.type,  --类型 (INPUT, OUTPUT, or AGGREGATE)  
  86.  filename --文件名  
  87. from gv$backup_async_io a,  gv$session s  
  88. where not a.STATUS in ('UNKNOWN')  
  89. and a.sid=s.sid and open_time > to_date('&1''dd-mon-rr hh24:mi:ss'order by 2,7;  
  90.   
  91.   
  92. REM gv$backup_sync_io  
  93. prompt  
  94. prompt Tape backuppiece progress (only if backup_tape_io_slaves=FALSE):  
  95. prompt  
  96. select s.inst_id, a.sid, CLIENT_INFO Ch,  
  97.  filename, --文件名    
  98.   a.type,  --类型  
  99.   a.status, --(NOT STARTED, IN PROGRESS, or FINISHED)  
  100.   buffer_size bsz, --使用的buffer大小  
  101.    buffer_count bfc, --使用的buffer 数量  
  102. open_time open,  --文件被打开的时间  
  103. io_count    ----文件当前发送的IO请求数量  
  104. from gv$backup_sync_io a, gv$session s  
  105. where  
  106. a.sid=s.sid and  
  107. open_time > to_date('&1''dd-mon-rr hh24:mi:ss') ;  
  108. REM ------------------------------- 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值