被动式监控oracle的rman备份情况

被动式监控oracle的rman备份情况


dbbackup.sh

点击(此处)折叠或打开

  1. [oracle@db rman]$ cat dbbackup.sh
  2. cd /home/db/oracle/
  3. . ./.bash_profile
  4. mv /oradata/rman/db_* /oradata/rmanbak/db_*
  5. logName=db_rman_`date +\'%Y%m%d%H%M%S\'`_full.log
  6. find /oradata/rmanbak -name \"db_*\" -mtime +0 -exec rm -rf {} \\;
  7. cd /oradata/rman
  8. rman target / CMDFILE rman_db.rcv >> $logName

  9. ##################################
  10. sh check_backup.sh
  11. ##################################


RMAN_db.rcv

点击(此处)折叠或打开

  1. [oracle@db rman]$ cat rman_db.rcv 
  2. run{
  3. crosscheck archivelog all;
  4. allocate channel c1 type disk;
  5. allocate channel c2 type disk;
  6. allocate channel c3 type disk;
  7. allocate channel c4 type disk;
  8. backup as compressed backupset database format \'/oradata/rman/hxpif_full_%U\'
  9. plus archivelog skip inaccessible format \'/oradata/rman/hxpif_ARC_%U\';
  10. delete noprompt archivelog all completed before \'sysdate-1/8\';
  11. backup current controlfile format \'/oradata/rman/hxpif_control_bak_%T\';
  12. backup spfile format \'/oradata/rman/hxpif_spfile_bak_%T\';
  13. release channel c1;
  14. release channel c2;
  15. release channel c3;
  16. release channel c4;
  17. }


check_backup.sh

点击(此处)折叠或打开

  1. [oracle@db rman]$ cat check_backup.sh
  2. IP=192.168.0.56
  3. SID=db

  4. status=`sqlplus -silent \"/as sysdba\" <<eof
  5. set feedback off
  6. set verify off
  7. set heading off
  8. set echo off
  9. set pagesize 0
  10. SELECT /*+ rule */ DECODE (
  11.              TRUNC (SYSDATE - start_time),
  12.              0, DECODE (
  13.                    status,
  14.                    \'COMPLETED\', \'0\',
  15.                    \'COMPLETED WITH WARNINGS\',\'1\',
  16.                    \'2\'),
  17.              \'2\')
  18.           backup_status
  19.   FROM v\\\\$rman_backup_job_details
  20.  WHERE start_time = (SELECT MAX (start_time) FROM v\\\\$rman_backup_job_details);
  21. exit;
  22. eof`
  23. output=`sqlplus -silent \"/as sysdba\" <<eof
  24. set feedback off
  25. set verify off
  26. set heading off
  27. set echo off
  28. set pagesize 0
  29. SELECT /*+ rule */ DECODE (
  30.           TRUNC (SYSDATE - start_time),
  31.           0, DECODE (status,
  32.                      \'COMPLETED\', \'Backup Suess!\',
  33.                      \'COMPLETED WITH WARNINGS\', \'Backup With Warnings!\',
  34.                      \'Backup Failed!\'),
  35.           \'No Backup!\')
  36.           backup_status
  37.   FROM v\\\\$rman_backup_job_details
  38.  WHERE start_time = (SELECT MAX (start_time) FROM v\\\\$rman_backup_job_details);
  39. exit;
  40. eof`
  41. hostip=$IP
  42. checkname=\"Rman_Backup_\"$SID
  43. echo -e \"$hostip\\t$checkname\\t$status\\t$output\" > backup_status.log

  44. /usr/local/nagios/bin/send_nsca 192.168.128.45 -c /usr/local/nagios/etc/send_nsca.cfg < backup_status.log


[oracle@db rman]$ cat backup_status.log 
192.168.0.56     Rman_Backup_DB       0       Backup Suess!












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

转载于:http://blog.itpub.net/29500582/viewspace-1692584/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值