RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;
啟用控制文件自動(dòng)備份及備份存放位置配置
RMAN> configure controlfile autobackup on;
查看配置信息
RMAN> show all;
目前成都創(chuàng)新互聯(lián)已為千余家的企業(yè)提供了網(wǎng)站建設(shè)、域名、虛擬主機(jī)、網(wǎng)站托管運(yùn)營(yíng)、企業(yè)網(wǎng)站設(shè)計(jì)、圖們網(wǎng)站維護(hù)等服務(wù),公司將堅(jiān)持客戶導(dǎo)向、應(yīng)用為本的策略,正道將秉承"和諧、參與、激情"的文化,與客戶和合作伙伴齊心協(xié)力一起成長(zhǎng),共同發(fā)展。
-------------------------------------------------
--創(chuàng)建文件夾
$mkdir /home/oracle/backup
mkdir /home/oracle/backup/script
mkdir /home/oracle/backup/log
mkdir /home/oracle/backup/export
--備份目的地
mkdir /home/oracle/rman_backup
創(chuàng)建備份表空間
create tablespace rman_tbs datafile '/u01/app/oracle/oradata/orcl11g/rman_tbs01.dbf'
size 1024M autoextend on next 50M maxsize 10240M
extent management local segment space management auto;
創(chuàng)建備份用戶
create user rman identified by rman default tablespace rman_tbs temporary tablespace temp;
grant connect,resource ,recovery_catalog_owner to rman;
SQL> grant unlimited tablespace to rman;
SQL> grant sysdba to rman;
rman catalog rman/rman
create catalog tablespace rman_tbs;
connect target sys/Oracle123@orcl11g
register database;
report schema;
-------------------------------------------------------
--倒出RMAN用戶數(shù)據(jù)腳本exp_rman.par (即備份catalog庫(kù))
userid=rman/rman
file=/home/oracle/backup/export/rman.dmp
log=/home/oracle/backup/log/rman.log
-- 倒出RMAN數(shù)據(jù)SHELL腳本exp_rman.sh
#!/bin/bash
cd $HOME
. .bash_profile
cd $HOME/backup/script
exp parfile=exp_rman.par
--------------
---零級(jí)備份RMAN腳本level0_backup.rcv
connect catalog rman/rman
connect target sys/Oracle123@orcl11g
run {
allocate channel d1 type disk;
allocate channel d2 type disk;
backup incremental level 0 database format '/home/oracle/rman_backup/level0_%d_%s_%p_%u.bak'
tag='level 0' include current controlfile;
sql 'alter system archive log current';
backup archivelog all format '/home/oracle/rman_backup/arc_%d_%s_%p_%u.bak' ;
release channel d2;
release channel d1;
}
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
crosscheck archivelog all;
delete noprompt archivelog all completed before 'sysdate-15';
resync catalog;
--零級(jí)備份SHELL腳本的level0_backup.sh
#!/bin/bash
backtime=`date +"%y%m%d%H"`
#cd $HOME
. /home/oracle/.bash_profile
cd $HOME/backup/script
rman cmdfile=level0_backup.rcv msglog=$HOME/backup/log/level0_${backtime}.log
. /home/oracle/backup/script/exp_rman.sh
一級(jí)差異增量備份RMAN腳本 level1_backup.rcv
connect catalog rman/rman
connect target sys/Oracle123@orcl11g
run {
allocate channel d1 type disk;
backup incremental level 1 format '/home/oracle/rman_backup/level1_%d_%s_%p_%u.bak' tag = 'level 1'cumulative database;
sql 'alter system archive log current';
backup archivelog all format '/home/oracle/rman_backup/log_%d_%s_%p_%u.bak' ;
release channel d1;
}
crosscheck backup;
delete noprompt expired backup;
delete noprompt obsolete;
crosscheck archivelog all;
delete noprompt archivelog all completed before 'sysdate-15';
resync catalog;
--一級(jí)差異增量備份SHELL腳本level1_backup.sh
#!/bin/bash
backtime=`date +"%y%m%d%H"`
#cd $HOME
. /home/oracle/.bash_profile
cd /home/oracle/backup/script
rman cmdfile=level1_backup.rcv msglog=$HOME/backup/log/level1_${backtime}.log
. /home/oracle/backup/script/exp_rman.sh
linux下定時(shí)執(zhí)行備份腳本
crontab -e -u oracle
SHELL=/bin/bash --以下腳本在bash下執(zhí)行
MAILTO=oracle --執(zhí)行日志以郵件形式郵給oracle用戶,可以/var/spool/mail/oracle下查收
5 12 * * 1 nohup /home/oracle/backup/script/level0_backup.sh >/home/oracle/backup/cron.log 2>&1 &
5 12 * * 3 /home/oracle/backup/script/level1_backup.sh
5 12 * * 5 /home/oracle/backup/script/level1_backup.sh
一周差異備份策略:
備份目標(biāo)庫(kù)和catalog庫(kù)
周一0級(jí)全備,周三周五為1級(jí)。
每天12點(diǎn)5分開(kāi)始備份
本文標(biāo)題:oracle備份策略
網(wǎng)頁(yè)路徑:http://muchs.cn/article6/gjsjig.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供手機(jī)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)公司、網(wǎng)站設(shè)計(jì)公司、服務(wù)器托管、企業(yè)建站、外貿(mào)建站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)