rman增量備份指令碼
#!/bin/bash
#edit: daniel
#date:2012-03-08
#auto backup database
#load Environment variables
myweek=`date +%a`
mydate=`date +%Y%m%d`
su - oracle -c 'cat >> /home/oracle/.bash_profile' << EOF
export mydir=/home/oracle/log
EOF
#Sunday
if [ "$myweek" == "Sun" ]; then
su - oracle -c 'rman target / log=${mydir}/backup.log append' <
run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 0 database
include current controlfile format '/home/oracle/backup/backup_%T_%s_%p.lv0' plus archivelog delete all input format '/home/oracle/backup/backup_%T_%s_%p.arc';
release channel c1;
release channel c2;
}
EOF
#Monday
elif [ "$myweek" == "Mon" ]; then
su - oracle -c 'rman target / log=${mydir}/backup.log append' <
run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 2 database include current controlfile format '/home/oracle/backup/backup_%T_%s_%p.lv2';
release channel c1;
release channel c2;
}
EOF
#Tuesday
elif [ "$myweek" == "Tue" ]; then
su - oracle -c 'rman target / log=${mydir}/backup.log append' <
run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 2 database include current controlfile format '/home/oracle/backup/backup_%T_%s_%p.lv2';
release channel c1;
release channel c2;
}
EOF
#Wednesday
elif [ "$myweek" == "Wed" ]; then
su - oracle -c 'rman target / log=${mydir}/backup.log append' <
run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 1 database include current controlfile format '/home/oracle/backup/backup_%T_%s_%p.lv1';
release channel c1;
release channel c2;
}
EOF
#Thursday
elif [ "$myweek" == "Thu" ]; then
su - oracle -c 'rman target / log=${mydir}/backup.log append' <
run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 2 database include current controlfile format '/home/oracle/backup/backup_%T_%s_%p.lv2';
release channel c1;
release channel c2;
}
EOF
#Friday
elif [ "$myweek" == "Fri" ]; then
su - oracle -c 'rman target / log=${mydir}/backup.log append' <
run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 2 database include current controlfile format '/home/oracle/backup/backup_%T_%s_%p.lv2';
release channel c1;
release channel c2;
}
EOF
#Saturday
elif [ "$myweek" == "Sat" ]; then
su - oracle -c 'rman target / log=${mydir}/backup.log append' <
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 0 database include current controlfile format '/home/oracle/backup/backup_%T_%s_%p.lv0' plus archivelog delete all input format '/home/oracle/backup/backup_%T_%s_%p.arc';
release channel c1;
release channel c2;
}
EOF
fi
#edit: daniel
#date:2012-03-08
#auto backup database
#load Environment variables
myweek=`date +%a`
mydate=`date +%Y%m%d`
su - oracle -c 'cat >> /home/oracle/.bash_profile' << EOF
export mydir=/home/oracle/log
EOF
#Sunday
if [ "$myweek" == "Sun" ]; then
su - oracle -c 'rman target / log=${mydir}/backup.log append' <
run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 0 database
include current controlfile format '/home/oracle/backup/backup_%T_%s_%p.lv0' plus archivelog delete all input format '/home/oracle/backup/backup_%T_%s_%p.arc';
release channel c1;
release channel c2;
}
EOF
#Monday
elif [ "$myweek" == "Mon" ]; then
su - oracle -c 'rman target / log=${mydir}/backup.log append' <
run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 2 database include current controlfile format '/home/oracle/backup/backup_%T_%s_%p.lv2';
release channel c1;
release channel c2;
}
EOF
#Tuesday
elif [ "$myweek" == "Tue" ]; then
su - oracle -c 'rman target / log=${mydir}/backup.log append' <
run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 2 database include current controlfile format '/home/oracle/backup/backup_%T_%s_%p.lv2';
release channel c1;
release channel c2;
}
EOF
#Wednesday
elif [ "$myweek" == "Wed" ]; then
su - oracle -c 'rman target / log=${mydir}/backup.log append' <
run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 1 database include current controlfile format '/home/oracle/backup/backup_%T_%s_%p.lv1';
release channel c1;
release channel c2;
}
EOF
#Thursday
elif [ "$myweek" == "Thu" ]; then
su - oracle -c 'rman target / log=${mydir}/backup.log append' <
run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 2 database include current controlfile format '/home/oracle/backup/backup_%T_%s_%p.lv2';
release channel c1;
release channel c2;
}
EOF
#Friday
elif [ "$myweek" == "Fri" ]; then
su - oracle -c 'rman target / log=${mydir}/backup.log append' <
run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 2 database include current controlfile format '/home/oracle/backup/backup_%T_%s_%p.lv2';
release channel c1;
release channel c2;
}
EOF
#Saturday
elif [ "$myweek" == "Sat" ]; then
su - oracle -c 'rman target / log=${mydir}/backup.log append' <
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup incremental level 0 database include current controlfile format '/home/oracle/backup/backup_%T_%s_%p.lv0' plus archivelog delete all input format '/home/oracle/backup/backup_%T_%s_%p.arc';
release channel c1;
release channel c2;
}
EOF
fi
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/90618/viewspace-1068331/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- rman 備份指令碼指令碼
- rman 增量備份恢復
- 分享Oracle Rman的備份指令碼Oracle指令碼
- windows 全量+增量備份指令碼batWindows指令碼BAT
- oracle10g RMAN增量備份策略Oracle
- oracle資料庫使用rman備份指令碼Oracle資料庫指令碼
- dg丟失歸檔,使用rman增量備份恢復
- [20221028]rman使用tape與增量備份測試2.txt
- 備份指令碼指令碼
- 【RMAN】RMAN備份至ASMASM
- EXP增量備份
- Xtrabackup增量備份
- RMAN備份概述
- 【RMAN】RMAN的備份保留策略
- mysql備份指令碼MySql指令碼
- ORACLE備份指令碼Oracle指令碼
- RMAN備份恢復典型案例——RMAN備份&系統變慢
- 使用RMAN增量備份處理Dataguard因歸檔丟失造成的gap
- RMAN備份進度
- RMAN的備份原理
- 自動備份指令碼指令碼
- windows mysqldump備份指令碼WindowsMySql指令碼
- ORACLE NBU調取oracle rman指令碼備份歸檔不自動刪除歸檔Oracle指令碼
- MySQL 定時增量備份MySql
- oracle資料庫備份之exp增量備份Oracle資料庫
- Oracle RMAN備份實戰Oracle
- Oracle OCP(60):RMAN 備份Oracle
- RMAN備份恢復技巧
- 【rman備份策略】實驗
- expdp 邏輯備份指令碼指令碼
- 資料庫備份指令碼資料庫指令碼
- 兩套mysql備份指令碼MySql指令碼
- RMAN增量恢復
- [20221020]奇怪的增量備份.txt
- 【RMAN】同時建立多個備份(建立多重備份)
- 【RMAN】在備庫執行rman備份時報錯RMAN-06820 ORA-17629
- RMAN備份詳解(轉載)
- [20190522]rman備份問題.txt
- RMAN 備份相關的概念