rman 非歸檔模式下停庫備份與恢復
一 非歸檔模式
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 31
Current log sequence 33
二 關閉資料庫,掛載資料庫進行一致性備份
RMAN> shutdown immediate;
database closed
database dismounted
Oracle instance shut down
RMAN> startup mount
connected to target database (not started)
Oracle instance started
database mounted
Total System Global Area 1252663296 bytes
Fixed Size 2212936 bytes
Variable Size 805309368 bytes
Database Buffers 436207616 bytes
Redo Buffers 8933376 bytes
RMAN> run{
2> allocate channel c1 type disk format '/home/oracle/rman/chen_%U';
3> backup database include current controlfile;
4> }
allocated channel: c1
channel c1: SID=133 device type=DISK
Starting backup at 07-JUL-15
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/ogg1/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/ogg1/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/ogg1/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/ogg1/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/ogg1/users01.dbf
input datafile file number=00006 name=/u01/app/oracle/oradata/ogg1/chen01.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/ogg1/test01.dbf
channel c1: starting piece 1 at 07-JUL-15
channel c1: finished piece 1 at 07-JUL-15
piece handle=/home/oracle/rman/chen_0gqbf543_1_1 tag=TAG20150707T153219 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:35
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
including current control file in backup set
channel c1: starting piece 1 at 07-JUL-15
channel c1: finished piece 1 at 07-JUL-15
piece handle=/home/oracle/rman/chen_0hqbf557_1_1 tag=TAG20150707T153219 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 07-JUL-15
Starting Control File and SPFILE Autobackup at 07-JUL-15
piece handle=/u01/app/oracle/flash_recovery_area/OGG1/autobackup/2015_07_07/o1_mf_s_884446096_bsq059ok_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 07-JUL-15
released channel: c1
三 備份結束後開啟資料庫,生成測試表,插入資料
RMAN> startup
database is already started
database opened
SQL> conn chen/chen
Connected.
SQL> insert into t1 values(20000);
SQL> commit;
SQL> select * from t1;
ID
----------
10000
10000
20000
四 剪下資料庫檔案到其他目錄,模擬資料庫故障
SQL> shutdown immediate
[oracle@ogg1 ~]$ cd /u01/app/oracle/oradata/ogg1/
[oracle@ogg1 ogg1]$ cd ..
[oracle@ogg1 oradata]$ mv ogg1/ /home/oracle/
五 啟動資料庫失敗
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1252663296 bytes
Fixed Size 2212936 bytes
Variable Size 805309368 bytes
Database Buffers 436207616 bytes
Redo Buffers 8933376 bytes
資料庫掛載失敗(找不到控制檔案)
SQL> alter database mount;
alter database mount
*
ERROR at line 1:
ORA-00205: error in identifying control file, check alert log for more info
檢視警告日誌檔案
[oracle@ogg1 ~]$ vim /u01/app/oracle/diag/rdbms/ogg1/ogg1/trace/alert_ogg1.log
Tue Jul 07 15:41:46 2015
alter database mount
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/ogg1/control01.ctl'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Tue Jul 07 15:41:46 2015
Checker run found 1 new persistent data failures
ORA-205 signalled during: alter database mount...
六 關閉資料庫,rman恢復
[oracle@ogg1 ~]$ cd /u01/app/oracle/oradata/
[oracle@ogg1 oradata]$ mkdir ogg1
RMAN> shutdown immediate
Oracle instance shut down
RMAN> startup nomount
connected to target database (not started)
Oracle instance started
Total System Global Area 1252663296 bytes
Fixed Size 2212936 bytes
Variable Size 805309368 bytes
Database Buffers 436207616 bytes
Redo Buffers 8933376 bytes
先將控制檔案恢復出來
RMAN> restore controlfile from autobackup;
Starting restore at 07-JUL-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=134 device type=DISK
recovery area destination: /u01/app/oracle/flash_recovery_area
database name (or database unique name) used for search: OGG1
channel ORA_DISK_1: AUTOBACKUP /u01/app/oracle/flash_recovery_area/OGG1/autobackup/2015_07_07/o1_mf_s_884446096_bsq059ok_.bkp found in the recovery area
AUTOBACKUP search with format "%F" not attempted because DBID was not set
channel ORA_DISK_1: restoring control file from AUTOBACKUP /u01/app/oracle/flash_recovery_area/OGG1/autobackup/2015_07_07/o1_mf_s_884446096_bsq059ok_.bkp
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=/u01/app/oracle/oradata/ogg1/control01.ctl
output file name=/u01/app/oracle/flash_recovery_area/ogg1/control02.ctl
Finished restore at 07-JUL-15
掛載資料庫,進行資料庫恢復
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
RMAN> run{
2> restore database;
3> recover database;
4> }
......
starting media recovery
RMAN-08187: WARNING: media recovery until SCN 1590816 complete
Finished recover at 07-JUL-15
RMAN> alter database open;
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 07/07/2015 15:56:43
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
RMAN> alter database open resetlogs;
database opened
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 1
Current log sequence 1
SQL> conn chen/chen
Connected.
恢復成功,丟失一部分資料
SQL> select * from t1;
ID
----------
10000
10000
歡迎關注我的微信公眾號"IT小Chen",共同學習,共同成長!!!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29785807/viewspace-1726532/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- rman 非歸檔模式下open庫備份與mount恢復模式
- 備份&恢復之四:非歸檔模式下的備份與恢復模式
- 恢復之非歸檔模式下資料庫非正常關閉的備份與恢復模式資料庫
- 【備份恢復】非歸檔模式下丟失任意資料檔案 恢復操作模式
- RMAN備份、恢復實驗室 之 備份篇 【歸檔模式】模式
- 【備份恢復】歸檔模式下丟失系統關鍵資料檔案 利用RMAN備份恢復模式
- 非歸檔資料庫RMAN備份資料庫
- 無備份恢復(歸檔模式)模式
- 恢復之非歸檔模式下的恢復模式
- rman恢復--歸檔模式有備份,丟失資料檔案的恢復模式
- rman恢復--歸檔模式無備份,丟失資料檔案的恢復模式
- oracle RMAN 非歸檔資料庫恢復Oracle資料庫
- 非歸檔模式恢復資料庫模式資料庫
- 非歸檔模式下恢復資料庫兩例模式資料庫
- RMAN資料庫恢復 之歸檔模式有(無)備份-丟失資料檔案的恢復資料庫模式
- 非歸檔無備份下控制檔案丟失的恢復
- 歸檔模式下,offline表空間備份與恢復模式
- Oracle的奇葩設定之非歸檔模式與RMAN備份Oracle模式
- Rman Crosscheck刪除失效歸檔-備份恢復ROS
- 非RMAN熱備份資料庫和恢復資料庫
- 基於非歸檔的冷備份恢復
- rman datafile恢復(歸檔模式)模式
- 備份&恢復之八:RMAN備份歸檔模式下損壞(丟失)多個資料檔案,進行整個資料庫的恢復模式資料庫
- rman在歸檔與非歸檔時備份資料庫的簡單示例資料庫
- 非歸檔模式下的資料備份模式
- dg丟失歸檔,使用rman增量備份恢復
- RMAN在歸檔/非歸檔,庫關閉/mounted/開啟狀態下的備份
- 資料庫備份與恢復(使用歸檔後滾)資料庫
- rman資料庫全庫備份與恢復資料庫
- 【備份恢復】noarchive模式下使用增量備份恢復資料庫Hive模式資料庫
- 歸檔模式下,使用RMAN的同一備份兩次用於不完全恢復模式
- RMAN恢復(rman只備份資料庫,但不備份歸檔,歸檔透過簡單的rsync或scp來傳送到異地備份)資料庫
- RMAN備份及恢復歸檔日誌的語法
- 備份與恢復--從備份的歸檔日誌中恢復資料
- RMAN備份與恢復之加密備份加密
- RMAN備份與恢復(新舊控制檔案及歸檔日誌)測試
- ORACLE非歸檔下的恢復Oracle
- RMAN備份恢復整個庫