oracle11gr1 RMAN bakcup and restore
rman target /
RMAN>CONFIGURE CONTROLFILE AUTOBACKUP ON;
backupscript.:
run
{
Crosscheck backup;
Crosscheck archivelog all;
delete NOPROMPT expired backup;
delete NOPROMPT OBSOLETE;
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
backup full database tag 'FullBackup' format '/oracle/backup/db_full_%T_%d_%t_%s_%p_bak0' ;
sql 'alter system archive log current';
backup format '/oracle/backup/arch_%T_%d_%t_%s_%p_bak0' archivelog all delete input;
backup spfile include current controlfile format '/oracle/backup/spfile_controlfile_%T_%d_%t_%s_%p_bak0';
release channel c1;
release channel c2;
release channel c3;
}
#########restore&&recover#####################
rman nocatalog target /
RMAN>startup nomount;
###[恢復引數檔案]########
RMAN>
RMAN>
恢復引數檔案指令碼:
run
{
restore spfile from '/oracle/backup/spfile_controlfile_20120809_CCDB_790856516_27_1_bak0';
}
##########恢復控制檔案###############
RMAN>
恢復控制檔案指令碼:
run{
restore controlfile from '/oracle/backup/spfile_controlfile_20120809_CCDB_790856510_26_1_bak0';
}
特別注意:
RMAN>
1:恢復控制檔案成功,注意控制檔案的輸出位置;
2:此時如果mount ,則由於控制檔案的位置不同造成失敗
3:修改引數檔案,指定控制檔案的位置
#################資料檔案RESTORE######################
RMAN> list backup of database;
可以看到有7個資料檔案,由於源資料庫採用ASM儲存,需要進行轉儲resotre
run{
set newname for datafile 1 to '/oracle/oradata/ccdb/system01.dbf';
set newname for datafile 2 to '/oracle/oradata/ccdb/sysaux01.dbf';
set newname for datafile 3 to '/oracle/oradata/ccdb/undotbs01.dbf';
set newname for datafile 4 to '/oracle/oradata/ccdb/users01.dbf';
set newname for datafile 5 to '/oracle/oradata/ccdb/system03.dbf';
set newname for datafile 6 to '/oracle/oradata/ccdb/system02.dbf';
set newname for datafile 7 to '/oracle/oradata/ccdb/test.dbf';
restore database;
switch datafile all;
}
本機是用檔案系統:
所以不用轉儲
方法1:
run{
startup force mount;
restore datafile 1;
recover datafile 1;
restore datafile 2;
recover datafile 2;
restore datafile 3;
recover datafile 3;
restore datafile 4;
recover datafile 4;
restore datafile 5;
recover datafile 5;
restore datafile 6;
recover datafile 6;
restore datafile 7;
recover datafile 7;
sql 'alter database open';
}
方法2:
run{
startup force mount;
restore database;
recover database;
sql 'alter database open';
}
總結:
資料庫最重要的是資料,資料最重要最安全的是定期做備份!資料重於一切;備份高於一切;恢復保障資料安全有效!
RMAN>CONFIGURE CONTROLFILE AUTOBACKUP ON;
backupscript.:
run
{
Crosscheck backup;
Crosscheck archivelog all;
delete NOPROMPT expired backup;
delete NOPROMPT OBSOLETE;
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
backup full database tag 'FullBackup' format '/oracle/backup/db_full_%T_%d_%t_%s_%p_bak0' ;
sql 'alter system archive log current';
backup format '/oracle/backup/arch_%T_%d_%t_%s_%p_bak0' archivelog all delete input;
backup spfile include current controlfile format '/oracle/backup/spfile_controlfile_%T_%d_%t_%s_%p_bak0';
release channel c1;
release channel c2;
release channel c3;
}
#########restore&&recover#####################
rman nocatalog target /
RMAN>startup nomount;
###[恢復引數檔案]########
RMAN>
RMAN>
恢復引數檔案指令碼:
run
{
restore spfile from '/oracle/backup/spfile_controlfile_20120809_CCDB_790856516_27_1_bak0';
}
##########恢復控制檔案###############
RMAN>
恢復控制檔案指令碼:
run{
restore controlfile from '/oracle/backup/spfile_controlfile_20120809_CCDB_790856510_26_1_bak0';
}
特別注意:
RMAN>
1:恢復控制檔案成功,注意控制檔案的輸出位置;
2:此時如果mount ,則由於控制檔案的位置不同造成失敗
3:修改引數檔案,指定控制檔案的位置
#################資料檔案RESTORE######################
RMAN> list backup of database;
可以看到有7個資料檔案,由於源資料庫採用ASM儲存,需要進行轉儲resotre
run{
set newname for datafile 1 to '/oracle/oradata/ccdb/system01.dbf';
set newname for datafile 2 to '/oracle/oradata/ccdb/sysaux01.dbf';
set newname for datafile 3 to '/oracle/oradata/ccdb/undotbs01.dbf';
set newname for datafile 4 to '/oracle/oradata/ccdb/users01.dbf';
set newname for datafile 5 to '/oracle/oradata/ccdb/system03.dbf';
set newname for datafile 6 to '/oracle/oradata/ccdb/system02.dbf';
set newname for datafile 7 to '/oracle/oradata/ccdb/test.dbf';
restore database;
switch datafile all;
}
本機是用檔案系統:
所以不用轉儲
方法1:
run{
startup force mount;
restore datafile 1;
recover datafile 1;
restore datafile 2;
recover datafile 2;
restore datafile 3;
recover datafile 3;
restore datafile 4;
recover datafile 4;
restore datafile 5;
recover datafile 5;
restore datafile 6;
recover datafile 6;
restore datafile 7;
recover datafile 7;
sql 'alter database open';
}
方法2:
run{
startup force mount;
restore database;
recover database;
sql 'alter database open';
}
總結:
資料庫最重要的是資料,資料最重要最安全的是定期做備份!資料重於一切;備份高於一切;恢復保障資料安全有效!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/14661773/viewspace-740485/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- guarantee restore points-Flashback after RMAN restoreREST
- rman restore archivelog logRESTHive
- 轉貼_RMAN-DBMS_BACKUP_RESTOREREST
- HowTo Restore RMAN Disk backups of RACREST
- rman restore database(spfile,controlfile, datafile)RESTDatabase
- RMAN DUPLICATE/RESTORE/RECOVER 混合平臺支援REST
- ORA-19573&rman restore失敗REST
- RMAN : Consistent Backup, Restore and Recovery using RMAN (Doc ID 162855.1)REST
- How to restore and recover a database from an RMAN backup_881395.1RESTDatabase
- Oracle rman中recover和restore的區別:OracleREST
- rman備份驗證(之restore validate)REST
- RMAN restore validate database報ORA-19693RESTDatabase
- rman 還原歸檔日誌(restore archivelogRESTHive
- rman 還原歸檔日誌(restore archivelog)RESTHive
- 使用RMAN backup和restore方式部署物理備庫REST
- RMAN-06100: no channel to restore a backup or copy of datafileREST
- RMAN Restore Performance from Tape is Very Poor (Doc ID 850988.1)RESTORM
- RMAN DUPLICATE/RESTORE/RECOVER Mixed Platform Support [ID 1079563.1]RESTPlatform
- RMAN-06023 no backup or copy of datafile 1 found to restoreREST
- oracle10g_rman_語法測試_restore專題OracleREST
- restore database報RMAN-06026和RMAN-06023錯誤RESTDatabase
- Restore Rman Backups On A Different Node When The Directory Are Diff_419137.1REST
- rman_restore controlfile_and_autobackup之關係測試REST
- RMAN RAC Archivelog Restore Fails with RMAN-20242 (Doc ID 180169.1)HiveRESTAI
- ORACLE11GR1 中的SecureFilesOracle
- HowTo Restore RMAN Disk backups of RAC Database to Single Instance On Another NoRESTDatabase
- How To Restore 12cR1DB to New Host File System using RMAN(一)REST
- RMAN 資料庫修復(restore)與資料庫恢復(recover)介紹資料庫REST
- Restore Controlfile from SBT Tape Fails RMAN-6172 (Doc ID 1314134.1)RESTAI
- 應對 "RMAN-06023: no backup or copy of datafile 1 found to restore"錯誤REST
- canvas restore()CanvasREST
- RESTORE POINTREST
- 同事在QQ群提出的rman restore spfile報錯ORA-15046的問題REST
- netbackup rman restore archivelog 報ora-19511錯誤處理過程RESTHive
- HowTo Restore RMAN Disk backups of RAC Database to Single Instance On Another Node [ID 415579.1]RESTDatabase
- 【Oracle】Windows安裝oracle11gR1 database 11.1.0.6OracleWindowsDatabase
- Restore ArchivelogRESTHive
- 應對RMAN-06026錯誤,使用dbms_backup_restore進行恢復REST