自動化RMAN指令碼
#!/bin/bash
# chkconfig: 345 99 10
# description: script for the SMS MESSAGE OR Oracle Instance, Listener
#Choose to run the script by week
#The script will automatically choose the backup level
#software make : muxinqing
time=$(date +%A)
ora=$(ps -aux | grep ora | grep -v "grep" | wc -l)
if [ $time=Monday ]; then
su - oracle -c "rman target / msglog=/home/oracle/bakl1.log" < run
{allocate channel orademo type disk;
backup incremental level 0 as compressed backupset database format '/home/oracle/db_%s_%p_%t' plus archivelog format '/home/oracle/arch_%s_%p_%t' delete input;
crosscheck backup;
delete noprompt expired backup;
Delete noprompt obsolete;
crosscheck archivelog all;
delete noprompt expired archivelog all;
backup current controlfile format '/data1/control%T%U';
}
m
else
su - oracle -c "rman target / msglog=/home/oracle/bakl1.log" << m
run
{allocate channel orademo type disk;
backup incremental level 1 cumulative as compressed backupset database format 'e:\db_%s_%p_%t' plus archivelog format 'e:\arch_%s_%p_%t' delete input;
crosscheck backup;
delete noprompt expired backup;
Delete noprompt obsolete;
crosscheck archivelog all;
delete noprompt expired archivelog all;
backup current controlfile format '/data1/control%T%U';
}
m
fi
版本二
#!/bin/bash
# chkconfig: 345 99 10
# description: script for the SMS MESSAGE OR Oracle Instance, Listener
#Choose to run the script by week
#The script will automatically choose the backup level
#software make : muxinqing
time=$(date +%A)
ora=$(ps -aux | grep ora | grep -v "grep" | wc -l)
case $time in
'Monday')
#cmdfile=/backup/script/backup_0_level
if [ -n ora ]; then
su - oracle -c "rman target / msglog=/home/oracle/bakl1.log" < run
{allocate channel orademo type disk;
backup incremental level 0 as compressed backupset database format '/home/oracle/db_%s_%p_%t' plus archivelog format '/home/oracle/arch_%s_%p_%t' delete input;
crosscheck backup;
delete noprompt expired backup;
Delete noprompt obsolete;
crosscheck archivelog all;
delete noprompt expired archivelog all;
backup current controlfile format '/data1/control%T%U';
}
m
else
echo "file not exist"
fi
;;
'Tuesday')
if [ -n ora ]; then
su - oracle -c "rman target / msglog=/home/oracle/bakl1.log" << m
run
{allocate channel orademo type disk;
backup incremental level 2 cumulative as compressed backupset database include current controlfile format 'e:\db_%s_%p_%t' plus archivelog format 'e:\arch_%s_%p_%t' delete input;
crosscheck backup;
delete noprompt expired backup;
Delete noprompt obsolete;
crosscheck archivelog all;
delete noprompt expired archivelog all;
backup current controlfile format '/data1/control%T%U';
}
m
else
echo "file not exist"
fi
;;
'Wednesday')
if [ -n ora ]; then
su - oracle -c "rman target / msglog=/home/oracle/bakl1.log" << m
run
{allocate channel orademo type disk;
backup incremental level 1 cumulative as compressed backupset database include current controlfile format 'e:\db_%s_%p_%t' plus archivelog format 'e:\arch_%s_%p_%t' delete input;
crosscheck backup;
delete noprompt expired backup;
Delete noprompt obsolete;
crosscheck archivelog all;
delete noprompt expired archivelog all;
backup current controlfile format '/data1/control%T%U';
}
m
else
echo "file not exist"
fi
;;
'Thursday')
if [ -n ora ]; then
su - oracle -c "rman target / msglog=/home/oracle/bakl1.log" << m
run
{allocate channel orademo type disk;
backup incremental level 2 cumulative as compressed backupset database include current controlfile format 'e:\db_%s_%p_%t' plus archivelog format 'e:\arch_%s_%p_%t' delete input;
crosscheck backup;
delete noprompt expired backup;
Delete noprompt obsolete;
crosscheck archivelog all;
delete noprompt expired archivelog all;
backup current controlfile format '/data1/control%T%U';
}
m
else
echo "file not exist"
fi
;;
'Friday')
if [ -n ora ]; then
su - oracle -c "rman target / msglog=/home/oracle/bakl1.log" << m
run
{allocate channel orademo type disk;
backup incremental level 2 cumulative as compressed backupset database include current controlfile format 'e:\db_%s_%p_%t' plus archivelog format 'e:\arch_%s_%p_%t' delete input;
crosscheck backup;
delete noprompt expired backup;
Delete noprompt obsolete;
crosscheck archivelog all;
delete noprompt expired archivelog all;
backup current controlfile format '/data1/control%T%U';
}
m
else
echo "file not exist"
fi
;;
'Saturday')
if [ -n ora ]; then
su - oracle -c "rman target / msglog=/home/oracle/bakl1.log" << m
run
{allocate channel orademo type disk;
backup incremental level 2 cumulative as compressed backupset database include current controlfile format 'e:\db_%s_%p_%t' plus archivelog format 'e:\arch_%s_%p_%t' delete input;
crosscheck backup;
delete noprompt expired backup;
Delete noprompt obsolete;
crosscheck archivelog all;
delete noprompt expired archivelog all;
backup current controlfile format '/data1/control%T%U';
}
m
else
echo "file not exist"
fi
;;
'Sunday')
if [ -n ora ]; then
su - oracle -c "rman target / msglog=/home/oracle/bakl1.log" << m
run
{allocate channel orademo type disk;
backup incremental level 2 cumulative as compressed backupset database include current controlfile format 'e:\db_%s_%p_%t' plus archivelog format 'e:\arch_%s_%p_%t' delete input;
crosscheck backup;
delete noprompt expired backup;
Delete noprompt obsolete;
crosscheck archivelog all;
delete noprompt expired archivelog all;
backup current controlfile format '/data1/control%T%U';
}
m
else
echo "file not exist"
fi
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29065182/viewspace-1593395/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- specjvm自動化指令碼JVM指令碼
- Dockerfile---指令碼自動化Docker指令碼
- vue自動化部署指令碼Vue指令碼
- mydumper自動化安裝指令碼指令碼
- JMeter 介面自動化測試(手工轉自動化指令碼)JMeter指令碼
- 自動化指令碼安裝mysql shell指令碼範例指令碼MySql
- rman 備份指令碼指令碼
- 介面自動化指令碼設計規範指令碼
- web自動化測試框架-06 如何快速編寫自動化指令碼Web框架指令碼
- [python] request 介面測試自動化指令碼轉化為 [locust] 效能測試指令碼Python指令碼
- 自動化瓦力多渠道打包python指令碼Python指令碼
- 案例八:Shell自動化管理賬號指令碼指令碼
- pyautogui模組,PC自動化指令碼,控制滑鼠GUI指令碼
- 自動備份指令碼指令碼
- 分享Oracle Rman的備份指令碼Oracle指令碼
- 用python寫一個自動化盲註指令碼Python指令碼
- 微服務專案Git倉庫自動化指令碼微服務Git指令碼
- k8s自動化部署springcloud、springboot指令碼K8SGCCloudSpring Boot指令碼
- Ubuntu自動啟動配置指令碼Ubuntu指令碼
- Python——自動簽到指令碼Python指令碼
- 使用 Playwright 指令碼錄製簡化自動化測試:完全指南指令碼
- linux透過shell指令碼實現ssh互動式自動化Linux指令碼
- 高複用性自動化指令碼設計實踐指令碼
- centos 自動啟動指令碼和自啟動服務CentOS指令碼
- iOS —— 兩套自動打包指令碼iOS指令碼
- oracle自動冷備份指令碼Oracle指令碼
- 實現指令碼自動部署docker指令碼Docker
- 自動化運維-修改主機名&hosts檔案指令碼運維指令碼
- 測試開發之自動化篇-Appium指令碼開發APP指令碼
- 10個Python指令碼來自動化你的日常任務Python指令碼
- 介面自動化測試錄製工具,讓python selenium自動化測試指令碼開發更加方便Python指令碼
- oracle資料庫使用rman備份指令碼Oracle資料庫指令碼
- MySQL自動備份指令碼30天自動刪除MySql指令碼
- 使用CukeTest建立指令碼自動化備份檔案到網盤指令碼
- 透過標籤清理微信好友:Python自動化指令碼解析Python指令碼
- awr報告每天自動生成指令碼指令碼
- Linux 新增指令碼開機自啟動Linux指令碼
- Python 指令碼自動視窗截圖Python指令碼
- golang一鍵自動安裝指令碼Golang指令碼