Oracle RMAN備份還原方案

來源:互聯網
上載者:User

標籤:locate   amp   目錄   disk   關閉   etl   tab   open   ora   

1、修改rman配置,能夠恢複到7天內的任一時間點
su - oracle
rman target /
configure retention policy to recovery window of 7 days;
show all;

2、建立備份資料庫和歸檔日誌rman指令碼online_database_archivelog.rman
#建立備份目錄
mkdir -pv /backup/oraclebk/database
mkdir -pv /backup/oraclebk/archivelog
chown -R oracle.oinstall
su - oracle
mkdir scripts
cd scripts
vim online_database_archivelog.rman
#rman指令碼內容
run {
allocate channel t1 type disk;
allocate channel t2 type disk;
backup as compressed backupset database format ‘/backup/oraclebk/database/database.%T.%U.rman‘;
backup as compressed backupset archivelog all delete all input format ‘/backup/oraclebk/archivelog/archivelog.%T.%U.rman‘;
}
delete noprompt obsolete;
#delete noprompt obsolete; 刪除無效或到期的備份組

3、建立備份shell指令碼
su - oracle
mkdir scripts
cd scripts
vim rman_backup.sh
#shell指令碼內容
#!/bin/bash
source ~/.bash_profile
rman target / @/home/oracle/scripts/online_database_archivelog.rman > /home/oracle/scripts/backup.log

4、添加定時任務每天04:00備份
su - oracle
crontab -e
00 04 * sh /home/oracle/scripts/rman_backup.sh >/dev/null 2>&1

5、執行基於時間點不完全恢複(要求歸檔日誌和重做日誌完整,RAC環境需要將另一執行個體關閉)
run {
shutdown immediate;
startup mount;
set until time = "to_date(‘02-02-18 16:20:00‘,‘dd-mm-yy hh24:mi:ss‘)";
restore database;
recover database;
alter database open resetlogs;
}

Oracle RMAN備份還原方案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.