【備份恢復】非歸檔模式下丟失任意資料檔案 恢復操作
非歸檔模式下丟失任意資料檔案
前提需要有備份檔案
1) 檢視資料庫歸檔模式,修改為非歸檔模式
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/backup
Oldest online log sequence 1
Next log sequence to archive 2
Current log sequence 2
SQL> alter database noarchivelog;
Database altered.
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /u01/app/backup
Oldest online log sequence 1
Current log sequence 2
2) 資料庫啟動到 mount 模式
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 830930944 bytes
Fixed Size 2257800 bytes
Variable Size 503319672 bytes
Database Buffers 322961408 bytes
Redo Buffers 2392064 bytes
Database mounted.
3) 備份資料庫(在非歸檔模式下, rman 備份需要資料庫在 mount 模式下,以將冷備的資訊記錄到控制檔案中,控制檔案資料檔案庫)
[oracle@wang ORA11GR2]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Fri Sep 23 13:45:13 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORA11GR2 (DBID=237843809, not open)
RMAN> backup database format '/u01/app/backup/db_%U.rmn';
Starting backup at 23-SEP-16
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/ORA11GR2/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/ORA11GR2/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/ORA11GR2/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/ORA11GR2/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/ORA11GR2/users01.dbf
channel ORA_DISK_1: starting piece 1 at 23-SEP-16
channel ORA_DISK_1: finished piece 1 at 23-SEP-16
piece handle=/u01/app/backup/db_06rghfmn_1_1.rmn tag=TAG20160923T134702 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 23-SEP-16
channel ORA_DISK_1: finished piece 1 at 23-SEP-16
piece handle=/u01/app/backup/db_07rghfo4_1_1.rmn tag=TAG20160923T134702 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 23-SEP-16
4) 開啟資料庫
SQL> alter database open;
Database altered.
5) 刪除所有資料檔案
[oracle@wang trace]$ cd /u01/app/oracle/oradata/ORA11GR2/
[oracle@wang ORA11GR2]$ ls *.dbf
example01.dbf system01.dbf undotbs01.dbf
sysaux01.dbf temp01.dbf users01.dbf
[oracle@wang ORA11GR2]$
[oracle@wang ORA11GR2]$ rm *.dbf
[oracle@wang ORA11GR2]$
[oracle@wang ORA11GR2]$ ls *.dbf
ls: *.dbf: No such file or directory
[oracle@wang ORA11GR2]$
6) 此時再登陸 sqlplus 會出現如下錯誤:
[oracle@wang ORA11GR2]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Sep 23 13:55:08 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-01075: you are currently logged on
Enter user-name:
注:由於所有資料檔案全部丟失,但資料庫的後臺程式都啟動著,所以會出現如上錯誤,解決辦法是 kill掉所有資料庫的程式和分配的記憶體
7) Kill 程式和記憶體,再次登陸 sqlplus,沒有任何問題
[oracle@wang ~]$ ps -ef |grep $ORACLE_SID |grep -v grep|awk '{print $2}' | xargs kill -9
[oracle@wang ~]$
[oracle@wang ~]$ ipcs -m | grep oracle | awk '{print $2}' | xargs ipcrm shm
resource(s) deleted
[oracle@wang ~]$
[oracle@wang ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Fri Sep 23 13:57:38 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup mount; (在mount狀態下修復)
ORACLE instance started.
Total System Global Area 830930944 bytes
Fixed Size 2257800 bytes
Variable Size 503319672 bytes
Database Buffers 322961408 bytes
Redo Buffers 2392064 bytes
Database mounted.
1) 透過 rman 恢復丟失的資料檔案
[oracle@wang dbs]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Fri Sep 23 15:26:22 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORA11GR2 (DBID=237843809, not open)
RMAN> restore database;(重儲)
Starting restore at 23-SEP-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device type=DISK
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/ORA11GR2/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/ORA11GR2/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/ORA11GR2/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/ORA11GR2/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/ORA11GR2/example01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/backup/db_06rghfmn_1_1.rmn
channel ORA_DISK_1: piece handle=/u01/app/backup/db_06rghfmn_1_1.rmn tag=TAG20160923T134702
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 23-SEP-16
RMAN> recover database;(恢復)
Starting recover at 23-SEP-16
using channel ORA_DISK_1
starting media recovery
archived log for thread 1 with sequence 1 is already on disk as file /u01/app/oracle/oradata/ORA11GR2/redo01_a.log
archived log for thread 1 with sequence 2 is already on disk as file /u01/app/oracle/oradata/ORA11GR2/redo02.log
archived log file name=/u01/app/oracle/oradata/ORA11GR2/redo02.log thread=1 sequence=2
media recovery complete, elapsed time: 00:00:01
Finished recover at 23-SEP-16
2) 以 resetlogs 方式開啟資料庫
RMAN> alter database open resetlogs;
database opened
RMAN> host 'ls /u01/app/oracle/oradata/ORA11GR2/*.dbf';
(rman下只認host)
/u01/app/oracle/oradata/ORA11GR2/example01.dbf
/u01/app/oracle/oradata/ORA11GR2/sysaux01.dbf
/u01/app/oracle/oradata/ORA11GR2/system01.dbf
/u01/app/oracle/oradata/ORA11GR2/temp01.dbf
/u01/app/oracle/oradata/ORA11GR2/undotbs01.dbf
/u01/app/oracle/oradata/ORA11GR2/users01.dbf
host command complete
資料檔案全部恢復回來了!!!!!!!!!!!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31397003/viewspace-2126765/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- rman恢復--歸檔模式有備份,丟失資料檔案的恢復模式
- rman恢復--歸檔模式無備份,丟失資料檔案的恢復模式
- 非歸檔無備份下控制檔案丟失的恢復
- 【備份恢復】歸檔模式下丟失系統關鍵資料檔案 利用RMAN備份恢復模式
- 歸檔模式無備份丟失資料檔案後恢復模式
- 歸檔模式有備份丟失資料檔案後恢復模式
- 恢復案例:歸檔模式下丟失全部資料檔案的恢復模式
- 歸檔模式下資料檔案丟失的恢復模式
- RMAN資料庫恢復 之歸檔模式有(無)備份-丟失資料檔案的恢復資料庫模式
- 【備份恢復】恢復 丟失已歸檔重做日誌檔案
- 恢復案例:歸檔模式下丟失非系統表空間資料檔案的恢復模式
- 歸檔模式下丟失普通資料檔案並恢復模式
- Oracle備份與恢復【丟失資料檔案的恢復】Oracle
- 備份&恢復之四:非歸檔模式下的備份與恢復模式
- 備份恢復之資料檔案丟失
- 【備份恢復】 丟失一個控制檔案 之恢復操作
- 非歸檔模式下非當前日誌檔案的丟失的恢復模式
- 備份&恢復之五:歸檔模式下丟失或損壞一個資料檔案模式
- 非歸檔丟失日誌檔案的恢復
- 沒備份,歸檔日誌存在,丟失資料檔案的恢復
- 備份&恢復之八:RMAN備份歸檔模式下損壞(丟失)多個資料檔案,進行整個資料庫的恢復模式資料庫
- RMAN恢復案例:丟失非系統資料檔案恢復
- 歸檔模式有備份丟失控制檔案和資料檔案後恢復模式
- 在歸檔模式下丟失日誌檔案的恢復模式
- 恢復之非歸檔模式下的恢復模式
- 恢復之非歸檔模式下資料庫非正常關閉的備份與恢復模式資料庫
- 丟失已歸檔日誌檔案下恢復資料庫資料庫
- rman 非歸檔模式下停庫備份與恢復模式
- dg丟失歸檔,使用rman增量備份恢復
- 利用增量備份恢復gap歸檔丟失DG
- 歸檔模式,恢復沒有備份的資料檔案模式
- 【備份恢復】無備份線上恢復非關鍵資料檔案
- rman 恢復---歸檔丟失and資料檔案損壞
- Oracle RMAN 不完全恢復(只有資料檔案備份,丟失歸檔日誌備份)Oracle
- 非歸檔模式恢復資料庫模式資料庫
- 無備份恢復(歸檔模式)模式
- 備份與恢復--資料檔案損壞或丟失
- 非歸檔模式下,丟失日誌檔案的一次恢復過程模式