自動化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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- rman 自動備份指令碼-windows指令碼Windows
- windows下rman自動備份指令碼Windows指令碼
- specjvm自動化指令碼JVM指令碼
- docker指令碼自動化Docker指令碼
- TSM+RMAN 自動備份指令碼 on aix指令碼AI
- Dockerfile---指令碼自動化Docker指令碼
- vue自動化部署指令碼Vue指令碼
- linux下rman增量備份指令碼以及指令碼自動執行Linux指令碼
- mydumper自動化安裝指令碼指令碼
- oracle 巡檢指令碼(自動化)Oracle指令碼
- JMeter 介面自動化測試(手工轉自動化指令碼)JMeter指令碼
- rman映像copy自動備份的一個指令碼指令碼
- 自動化指令碼安裝mysql shell指令碼範例指令碼MySql
- Oracle 11g EXPDP、RMAN自動備份SHELL指令碼Oracle指令碼
- 幾個shell自動化指令碼(轉)指令碼
- 自動化安裝zabbix指令碼(3.0/3.2)指令碼
- shell指令碼自動化採集效能sql指令碼SQL
- Hadoop自動化安裝shell指令碼Hadoop指令碼
- dataguard switchover的自動化指令碼實現指令碼
- 使用shell生成orabbix自動化配置指令碼指令碼
- 介面自動化指令碼設計規範指令碼
- web自動化測試框架-06 如何快速編寫自動化指令碼Web框架指令碼
- rman指令碼指令碼
- 自動ftp指令碼FTP指令碼
- 案例八:Shell自動化管理賬號指令碼指令碼
- 自動化瓦力多渠道打包python指令碼Python指令碼
- [python] request 介面測試自動化指令碼轉化為 [locust] 效能測試指令碼Python指令碼
- 自動備份指令碼指令碼
- LNMP自動部署指令碼LNMP指令碼
- awr自動收集指令碼指令碼
- Oracle rman 指令碼Oracle指令碼
- 微服務專案Git倉庫自動化指令碼微服務Git指令碼
- 用Python開發自動化測試指令碼Python指令碼
- Ubuntu自動啟動配置指令碼Ubuntu指令碼
- 網路卡自動啟動指令碼指令碼
- 【RMAN】RMAN指令碼中使用替換變數--windows 下rman全備指令碼指令碼變數Windows
- linux基於cron的rman自動增量備份指令碼及設定Linux指令碼
- Linux自啟動指令碼Linux指令碼