中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

oracle備份策略

發布時間:2020-07-03 20:11:12 來源:網絡 閱讀:505 作者:viking714 欄目:關系型數據庫

RMAN>  CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
RMAN>  CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;
啟用控制文件自動備份及備份存放位置配置
RMAN> configure controlfile autobackup on;
查看配置信息
RMAN> show all;


-------------------------------------------------
--創建文件夾
$mkdir /home/oracle/backup
mkdir /home/oracle/backup/script
mkdir /home/oracle/backup/log
mkdir /home/oracle/backup/export

--備份目的地
mkdir /home/oracle/rman_backup

創建備份表空間

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;

創建備份用戶
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用戶數據腳本exp_rman.par (即備份catalog庫)


userid=rman/rman
file=/home/oracle/backup/export/rman.dmp
log=/home/oracle/backup/log/rman.log


-- 倒出RMAN數據SHELL腳本exp_rman.sh
#!/bin/bash
cd $HOME
. .bash_profile
cd $HOME/backup/script
exp parfile=exp_rman.par

--------------

---零級備份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;

--零級備份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

 

一級差異增量備份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;

--一級差異增量備份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下定時執行備份腳本

crontab -e -u oracle
SHELL=/bin/bash --以下腳本在bash下執行
MAILTO=oracle --執行日志以郵件形式郵給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

 

一周差異備份策略:
備份目標庫和catalog庫
周一0級全備,周三周五為1級。
每天12點5分開始備份

 

 

 

 

 

 

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

湖北省| 垦利县| 闽清县| 常宁市| 潼南县| 思茅市| 醴陵市| 阿尔山市| 同仁县| 天水市| 融水| 日土县| 苍梧县| 涞水县| 广饶县| 都江堰市| 朔州市| 简阳市| 和平区| 宿州市| 仁布县| 麟游县| 阜宁县| 鄢陵县| 五华县| 北海市| 桑植县| 长寿区| 南昌县| 讷河市| 城市| 永德县| 雅江县| 邳州市| 大洼县| 都兰县| 万源市| 营口市| 北海市| 教育| 左权县|