某個資料檔案損壞完全恢復(三)
三、環境:某個資料檔案損壞,有rman備份,具體恢復過程如下:
在這種恢復方式中,資料庫處於OPEN狀態,適合除了system和undo以外的普通資料檔案的恢復。
[oracle@dbserv ~]$ export ORACLE_SID=test
[oracle@dbserv ~]$ sqlplus / as sysdba
SQL> select count(*) from tt;
COUNT(*)
----------
56
SQL> insert into tt select * from dba_users;
8 rows created.
SQL> /
8 rows created.
SQL> commit;
Commit complete.
[@more@]SQL> shutdown abort;
ORACLE instance shut down.
SQL> host rm -f /opt/oracle/oradata/test/users01.dbf
SQL> startup
ORACLE instance started.
Total System Global Area 2147483648 bytes
Fixed Size 1220432 bytes
Variable Size 486539440 bytes
Database Buffers 1644167168 bytes
Redo Buffers 15556608 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4: '/opt/oracle/oradata/test/users01.dbf'
--為了提高資料庫中其他資料的可用性,可以把損壞的資料檔案的狀態改為offline,這樣資料庫可以開啟:
SQL> alter database datafile '/opt/oracle/oradata/test/users01.dbf' offline;
Database altered.
SQL> alter database open;
Database altered.
SQL> select * from v$recover_file;
FILE# ONLINE ONLINE_
---------- ------- -------
ERROR CHANGE#
----------------------------------------------------------------- ----------
TIME
------------
4 OFFLINE OFFLINE
FILE NOT FOUND 0
SQL> exit
[oracle@dbserv ~]$ rman target /
Recovery Manager: Release 10.2.0.1.0 - Production on Thu Jun 21 12:05:44 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: TEST (DBID=2083742440)
RMAN> restore datafile '/opt/oracle/oradata/test/users01.dbf';
Starting restore at 21-JUN-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=139 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00004 to /opt/oracle/oradata/test/users01.dbf
channel ORA_DISK_1: reading from backup piece /opt/backup/full/testfull_TEST_20120610_11
channel ORA_DISK_1: restored backup piece 1
piece handle=/opt/backup/full/testfull_TEST_20120610_11 tag=TESTDB
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
Finished restore at 21-JUN-12
RMAN> recover tablespace users;
Starting recover at 21-JUN-12
using channel ORA_DISK_1
starting media recovery
archive log thread 1 sequence 22 is already on disk as file /opt/backup/1_22_785596008.dbf
archive log thread 1 sequence 23 is already on disk as file /opt/backup/1_23_785596008.dbf
archive log thread 1 sequence 24 is already on disk as file /opt/backup/1_24_785596008.dbf
archive log thread 1 sequence 25 is already on disk as file /opt/backup/1_25_785596008.dbf
archive log thread 1 sequence 26 is already on disk as file /opt/backup/1_26_785596008.dbf
archive log thread 1 sequence 1 is already on disk as file /opt/backup/1_1_786046849.dbf
archive log thread 1 sequence 2 is already on disk as file /opt/backup/1_2_786046849.dbf
archive log thread 1 sequence 1 is already on disk as file /opt/backup/1_1_786052580.dbf
archive log thread 1 sequence 2 is already on disk as file /opt/backup/1_2_786052580.dbf
archive log thread 1 sequence 3 is already on disk as file /opt/backup/1_3_786052580.dbf
archive log thread 1 sequence 4 is already on disk as file /opt/backup/1_4_786052580.dbf
archive log thread 1 sequence 5 is already on disk as file /opt/backup/1_5_786052580.dbf
archive log thread 1 sequence 6 is already on disk as file /opt/backup/1_6_786052580.dbf
archive log thread 1 sequence 7 is already on disk as file /opt/backup/1_7_786052580.dbf
archive log thread 1 sequence 8 is already on disk as file /opt/backup/1_8_786052580.dbf
archive log thread 1 sequence 9 is already on disk as file /opt/backup/1_9_786052580.dbf
archive log thread 1 sequence 10 is already on disk as file /opt/backup/1_10_786052580.dbf
archive log thread 1 sequence 1 is already on disk as file /opt/backup/1_1_786419885.dbf
archive log thread 1 sequence 2 is already on disk as file /opt/backup/1_2_786419885.dbf
archive log thread 1 sequence 3 is already on disk as file /opt/backup/1_3_786419885.dbf
archive log thread 1 sequence 4 is already on disk as file /opt/backup/1_4_786419885.dbf
archive log thread 1 sequence 5 is already on disk as file /opt/backup/1_5_786419885.dbf
archive log thread 1 sequence 6 is already on disk as file /opt/backup/1_6_786419885.dbf
archive log filename=/opt/backup/1_22_785596008.dbf thread=1 sequence=22
archive log filename=/opt/backup/1_23_785596008.dbf thread=1 sequence=23
archive log filename=/opt/backup/1_24_785596008.dbf thread=1 sequence=24
archive log filename=/opt/backup/1_25_785596008.dbf thread=1 sequence=25
archive log filename=/opt/backup/1_26_785596008.dbf thread=1 sequence=26
archive log filename=/opt/backup/1_1_786046849.dbf thread=1 sequence=1
archive log filename=/opt/backup/1_2_786046849.dbf thread=1 sequence=2
archive log filename=/opt/backup/1_1_786052580.dbf thread=1 sequence=1
archive log filename=/opt/backup/1_2_786052580.dbf thread=1 sequence=2
archive log filename=/opt/backup/1_3_786052580.dbf thread=1 sequence=3
archive log filename=/opt/backup/1_4_786052580.dbf thread=1 sequence=4
archive log filename=/opt/backup/1_5_786052580.dbf thread=1 sequence=5
archive log filename=/opt/backup/1_6_786052580.dbf thread=1 sequence=6
archive log filename=/opt/backup/1_7_786052580.dbf thread=1 sequence=7
archive log filename=/opt/backup/1_8_786052580.dbf thread=1 sequence=8
archive log filename=/opt/backup/1_9_786052580.dbf thread=1 sequence=9
archive log filename=/opt/backup/1_10_786052580.dbf thread=1 sequence=10
archive log filename=/opt/backup/1_1_786419885.dbf thread=1 sequence=1
archive log filename=/opt/backup/1_2_786419885.dbf thread=1 sequence=2
archive log filename=/opt/backup/1_3_786419885.dbf thread=1 sequence=3
archive log filename=/opt/backup/1_4_786419885.dbf thread=1 sequence=4
media recovery complete, elapsed time: 00:00:03
Finished recover at 21-JUN-12
RMAN> exit
Recovery Manager complete.
[oracle@dbserv ~]$ sqlplus / as sysdba
SQL> select count(*) from tt;
select count(*) from tt
*
ERROR at line 1:
ORA-00376: file 4 cannot be read at this time
ORA-01110: data file 4: '/opt/oracle/oradata/test/users01.dbf'
SQL> alter database datafile '/opt/oracle/oradata/test/users01.dbf' online;
Database altered.
SQL> select count(*) from tt;
COUNT(*)
----------
72
SQL>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/18841027/viewspace-1058610/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 某個控制檔案損壞的恢復案例
- system表空間檔案損壞----完全恢復
- PG 資料庫檔案損壞的另一個不完全恢復方案.資料庫
- 資料檔案丟失損壞的恢復--
- 使用RMAN恢復完全損壞的資料庫資料庫
- u盤檔案損壞怎麼恢復資料 u盤恢復損壞資料的有效方法
- rman 恢復---歸檔丟失and資料檔案損壞
- 恢復之單個控制檔案損壞
- 單個控制檔案損壞的恢復
- 某個表空間的資料檔案損壞的修復思路
- 備份與恢復--重建控制檔案後資料檔案損壞的恢復
- 【資料庫資料恢復】MongoDB資料庫檔案損壞的資料恢復案例資料庫資料恢復MongoDB
- u盤檔案損壞怎麼恢復資料 u盤損壞無法讀取怎麼恢復資料
- Oracle資料檔案損壞恢復例項二則Oracle
- REDO日誌損壞,非歸檔模式資料檔案恢復模式
- 損壞控制檔案的恢復方法
- SQL Server ldf 檔案損壞恢復SQLServer
- 非系統資料檔案損壞,rman備份恢復
- 磁碟損壞導致資料檔案丟失的恢復
- 備份與恢復--資料檔案損壞或丟失
- [ORACLE] 系統故障資料庫恢復--資料檔案無損壞Oracle資料庫
- 【伺服器資料恢復】某品牌ProLiant伺服器raid癱瘓資料庫檔案損壞的資料恢復伺服器資料恢復AI資料庫
- oracle控制檔案的損壞或完全丟失的恢復辦法Oracle
- PostgreSQL DBA(30) - Backup&Recovery#3(資料檔案損壞恢復)SQL
- RMAN_部分資料檔案丟失或者損壞的恢復
- 資料檔案或者tablespace損壞基於rman恢復測試
- 備份&恢復之十二:損壞單個控制檔案
- 線上日誌檔案損壞恢復方法
- system資料檔案頭損壞修復
- 【伺服器資料恢復】伺服器reiserfs檔案系統損壞的資料恢復案例伺服器資料恢復
- 【儲存資料恢復】IBM儲存檔案NTFS系統損壞的資料恢復案例資料恢復IBM
- 資料庫檔案壞塊損壞導致開啟時報錯的恢復方法資料庫
- 備份&恢復之五:歸檔模式下丟失或損壞一個資料檔案模式
- 【BBED】 SYSTEM檔案頭損壞的恢復(4)
- REDO檔案丟失或者損壞的恢復
- UNDO 表空間檔案損壞的恢復
- 一次控制檔案損壞的恢復
- Recovery from missing or corrupted datafile(多個資料檔案丟失或者損壞的恢復)