REM -------------------------------
REM Script to monitor rman backup/restore operations
REM To run from sqlplus:   @monitor '<dd-mon-rr hh24:mi:ss>' 
REM Example:  
--SQL>spool monitor.out
--SQL>@monitor '06-aug-12 16:38:03'
REM where <date> is the start time of your rman backup or restore job
REM Run monitor script periodically to confirm rman is progessing
REM -------------------------------
 
 
alter session set nls_date_format='dd-mon-rr hh24:mi:ss';
set lines 1500
set pages 100
col CLI_INFO format a10
col spid format a5
col ch format a20
col seconds format 999999.99
col filename format a65
col bfc  format 9
col "% Complete" format 999.99
col event format a40
set numwidth 10
 
 
select sysdate from dual;
 
 
REM gv$session_longops (channel level)
 
 
prompt
prompt Channel progress - gv$session_longops:
prompt
select  s.inst_id,   -- 实例编号
        o.sid,       --session_id
        CLIENT_INFO ch,  --客户端信息
        context,       --上下文信息       
        sofar,         --已完成工作量
        totalwork,     --总工作量
        round(sofar/totalwork*100,2) "% Complete"  --完成进度比
     FROM gv$session_longops o, gv$session s
     WHERE opname LIKE 'RMAN%'
     AND opname NOT LIKE '%aggregate%'
     AND o.sid=s.sid
     AND totalwork != 0
     AND sofar <> totalwork;
 
 
REM Check wait events (RMAN sessions) - this is for CURRENT waits only
REM use the following for 11G+
prompt
prompt Session progess - CURRENT wait events and time in wait so far:
prompt
select inst_id,
       sid, 
       CLIENT_INFO ch, 
       seq#,     --最近等待的唯一标识
       event,    --等待事件
       state,    --状态(WAITING 、WAITED UNKNOWN TIME、WAITED SHORT TIME 、WAITED KNOWN TIME  )
       wait_time_micro/1000000 seconds  --已经等待的时间
from gv$session where program like '%rman%' and
wait_time = 0 and
not action is null;
 
 
REM use the following for 10G  
--select  inst_id, sid, CLIENT_INFO ch, seq#, event, state, seconds_in_wait secs
--from gv$session where program like '%rman%' and
--wait_time = 0 and
--not action is null;
 
 
REM gv$backup_async_io
prompt
prompt Disk (file and backuppiece) progress - includes tape backuppiece 
prompt if backup_tape_io_slaves=TRUE:
prompt
select s.inst_id, a.sid, CLIENT_INFO Ch, a.STATUS,
open_time,   --文件打开时间
round(BYTES/1024/1024,2) "SOFAR Mb" ,  --已完成大小
round(total_bytes/1024/1024,2) TotMb,  --总大小
io_count,                              --文件当前发送的IO请求数量
round(BYTES/TOTAL_BYTES*100,2) "% Complete" , 
a.type,  --类型 (INPUT, OUTPUT, or AGGREGATE)
 filename --文件名
from gv$backup_async_io a,  gv$session s
where not a.STATUS in ('UNKNOWN')
and a.sid=s.sid and open_time > to_date('&1', 'dd-mon-rr hh24:mi:ss') order by 2,7;
 
 
REM gv$backup_sync_io
prompt
prompt Tape backuppiece progress (only if backup_tape_io_slaves=FALSE):
prompt
select s.inst_id, a.sid, CLIENT_INFO Ch,
 filename, --文件名  
  a.type,  --类型
  a.status, --(NOT STARTED, IN PROGRESS, or FINISHED)
  buffer_size bsz, --使用的buffer大小
   buffer_count bfc, --使用的buffer 数量
open_time open,  --文件被打开的时间
io_count    ----文件当前发送的IO请求数量
from gv$backup_sync_io a, gv$session s
where
a.sid=s.sid and
open_time > to_date('&1', 'dd-mon-rr hh24:mi:ss') ;
REM -------------------------------

监控RMAN操作进度的脚本的更多相关文章

  1. Replication的犄角旮旯(六)-- 一个DDL引发的血案(上)(如何近似估算DDL操作进度)

    <Replication的犄角旮旯>系列导读 Replication的犄角旮旯(一)--变更订阅端表名的应用场景 Replication的犄角旮旯(二)--寻找订阅端丢失的记录 Repli ...

  2. tomcat监控,自动重启shell脚本

    tomcat监控,自动重启shell脚本如下,取名 monitor_tomcat.sh: #!/bin/sh # func:自动监控tomcat脚本并且执行重启操作 # 获取tomcat进程ID(其中 ...

  3. 监控mysql主从同步状态脚本

    监控mysql主从同步状态脚本 示例一: cat check_mysql_health #!/bin/sh slave_is=($(mysql -S /tmp/mysql3307.sock -uroo ...

  4. 监控EXPDP/IMPDP进度

    --获取JOB_NAMEselect * from DBA_DATAPUMP_JOBS;OWNER_NAME JOB_NAME OPERATION JOB_MODE STATE DEGREE ATTA ...

  5. 【原创】rman 全库备份脚本

    rman 全库备份脚本 run { allocate channel d1 type disk; allocate channel d2 type disk; backup full database ...

  6. zabbix监控进程和端口存活脚本

    自定义脚本监控端口和进程,脚本process_port_check.sh 内容: [root@mysql02 data]# cat test.sh #!/bin/bash ############## ...

  7. Process Monitor监控进程操作注册表如何实现?

    http://zhidao.baidu.com/link?url=Kqav4qkQSprC5FnpHPOGJvhqvY9fJ9-Vdx9g_SWh4w5VOusdRJo4Vl7qIdrG4LwRJvr ...

  8. Splunk监控软件操作

    一.  Splunk公司与产品 美国Splunk公司,成立于2004年,2012年纳斯达克上市,第一家大数据上市公司,荣获众多奖项和殊荣.总部位于美国旧金山,伦敦为国际总部,香港设有亚太支持中心,上海 ...

  9. redis原子性读写操作之LUA脚本和watch机制

    最近在开发电商平台的子系统--储值卡系统,系统核心业务涉及到金额消费以及库存控制,因此为了解决建立在内存上高并发情况下的事务控制,使用了spring封装的RedisTemplate执行lua脚本进行原 ...

随机推荐

  1. 达夫设备之js

    最近阅读<高性能JavaScript>时,在书中的“达夫设备“ . 对此,有些感悟,同时有些疑问,希望看到的朋友,能帮忙解释下,在此先提前感谢了. 1. 先说自己的理解吧: ”达夫设备“的 ...

  2. dfs___刷题记录

    poj 1564 给出一个s,n个数,输出所有的能够得到s的方案 #include<cstdio> #include<cstring> #include<iostream ...

  3. Could not find result map java.util.HashMap

    Could not find result map java.util.HashMap 找不到结果图java.util.HashMap MyBatis 找不到返回的 'resultMap'!把resu ...

  4. python基础知识部分练习大全

    python基础知识部分练习大全   1.执行 Python 脚本的两种方式 答:1.>>python ../pyhton.py 2. >>python.py   #必须在首行 ...

  5. 什么是PL/SQL,有什么用

    1.什么是PL/SQL,有什么用  Procedure Language+SQL  PL/SQL是Oracle数据库特有的编程语言.  PL/SQL程序是以SQL为基础,引入了  编程语言特点,例如变 ...

  6. DCL授权命令

    create user 用户名//创建用户    grant DBA to 用户名//授权    revoke //撤销权限

  7. 记一次在BroadcastReceiver或Service里弹窗的“完美”实践

    事情是这样的,目前在做一个医疗项目,需要定时在某个时间段比如午休时间和晚上让我们的App休眠,那么这个时候在休眠时间段如果用户按了电源键点亮屏幕了,我们就需要弹出一个全屏的窗口去做一个人性化的提示,“ ...

  8. Sybase数据库工具DbVisualizer乱码问题

    使用DbVisualizer来操作sybase数据库的时候,会出现乱码问题,中文变成  '口口'. 解决的方法例如以下: 将这三个字体都改成 "宋体"  或者改成 "PM ...

  9. Oracle sql 子字符串长度判断

    Oracle sql 子字符串长度判断 select t.* from d_table t ,) ,instr(t.col,; 字符串的前两位都是数字: select * from d_table t ...

  10. Android中的单位

    Android中的单位 1.px 像素(pixels) VGA 480*640像素 (Video Graphics Array) QVGA 240*320像素 (Quarter VGA) HVGA 3 ...