使用RMAN backup和restore方式部署物理備庫

db_wjw發表於2016-06-14
本文件不包含以下內容:
主資料庫配置、引數、建立相關目錄、監聽器配置、tnsnames.ora配置、密碼檔案配置等,只列出主要步驟

一、主:

建立/u01/oracle_backup目錄:
備份引數檔案:
SQL> create pfile='/u01/oracle_backup/initlis.ora' from spfile;
備份資料:
rman target /
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate channel c5 type disk;
backup as compressed backupset format '/u02/orabackup/level0/ncf_db%U' database plus archivelog;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
}
備份控制檔案:
run{
allocate channel c1 type disk;
backup format '/u02/orabackup/level0/control%U' current controlfile for standby;
release channel c1;
}



二、複製備份檔案到備庫主機,也就是/u01/oracle_backup


三、備:

按需修改目標端引數檔案

rman target /
RMAN> startup nomount;
RMAN> restore standby controlfile from '/u01/oracle_backup/control1bqgo42a_1_1';
RMAN> sql 'alter database mount standby database';
restore資料庫
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate channel c5 type disk;
restore database;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
}

recover資料庫
RMAN> list backup of archivelog all;
找到要恢復到的最大序列號,比如有36的話,那就應該until 37
RMAN> recover database until sequence 37;
RMAN> exit

sqlplus / as sysdba;
SQL> alter database recover managed standby database using current logfile disconnect;
SQL> alter database recover managed standby database cancel;
SQL> alter database open;
SQL> alter database recover managed standby database using current logfile disconnect;


在主庫上多切換幾次日誌,使用以下命令檢查備庫狀態:
select process,status from v$managed_standby;


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26194851/viewspace-2120137/,如需轉載,請註明出處,否則將追究法律責任。

相關文章