備份與恢復--資料檔案損壞或丟失
恢復辦法適用於:
資料檔案損壞或丟失,且損壞或丟失的資料檔案沒有備份。
前提條件:
資料庫為archive模式,且保留著所有的從這個表空間建立起到現在的歸檔日誌。
方法:
首先建立一個新的空資料檔案,然後利用完全的歸檔日誌來恢復表空間中的資料。
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 4
Next log sequence to archive 6
Current log sequence 6
SQL> CREATE TABLESPACE test DATAFILE '/u01/app/oracle/oradata/orcl/test01.dbf' SIZE 10M
AUTOEXTEND OFF;
Tablespace created.
SQL> CREATE TABLESPACE test DATAFILE '/u01/app/oracle/oradata/orcl/test01.dbf' SIZE 10M
AUTOEXTEND OFF;
Tablespace created.
SQL> conn jglu/jglu
Connected.
SQL> create table test1
2 tablespace test
3 as select * from all_objects;
Table created.
SQL> select count(*) from jglu.test1;
COUNT(*)
----------
40689
SQL> commit;
Commit complete.
SQL> conn / as sysdba
Connected.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@rhel131 backup]$ cd /u01/app/oracle/oradata/
[oracle@rhel131 oradata]$ cd orcl
[oracle@rhel131 orcl]$ mv test01.dbf test01.bak
[oracle@rhel131 orcl]$ sqlplus / as sysdba
SQL> startup
ORACLE instance started.
Total System Global Area 335544320 bytes
Fixed Size 1219280 bytes
Variable Size 130024752 bytes
Database Buffers 201326592 bytes
Redo Buffers 2973696 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 8 - see DBWR trace file
ORA-01110: data file 8: '/u01/app/oracle/oradata/orcl/test01.dbf'
SQL> alter database datafile 8 offline;
Database altered.
SQL> alter database open;
Database altered.
SQL> SELECT * FROM V$RECOVER_FILE;
FILE# ONLINE ONLINE_ ERROR CHANGE# TIME
----- ---------- ------- -------------------- ----------- ---------------
8 OFFLINE OFFLINE FILE NOT FOUND 0
SQL> alter database create datafile '/u01/app/oracle/oradata/orcl/test01.dbf'
2 as '/u01/app/oracle/oradata/orcl/test02.dbf';
Database altered.
SQL> recover datafile '/u01/app/oracle/oradata/orcl/test02.dbf';
Media recovery complete.
SQL> select ts#,name,status from v$datafile;
TS# NAME STATUS
---------- -------------------------------------------------- -------
0 /u01/app/oracle/oradata/orcl/system01.dbf SYSTEM
1 /u01/app/oracle/oradata/orcl/undotbs01.dbf ONLINE
2 /u01/app/oracle/oradata/orcl/sysaux01.dbf ONLINE
4 /u01/app/oracle/oradata/orcl/users01.dbf ONLINE
6 /u01/app/oracle/oradata/orcl/example01.dbf ONLINE
7 /u01/app/oracle/oradata/orcl/jglu01.dbf ONLINE
7 /u01/app/oracle/oradata/orcl/jglu02.dbf ONLINE
8 /u01/app/oracle/oradata/orcl/test02.dbf OFFLINE
8 rows selected.
SQL> alter database datafile '/u01/app/oracle/oradata/orcl/test02.dbf' online;
Database altered.
SQL> select ts#,name,status from v$datafile;
TS# NAME STATUS
---------- -------------------------------------------------- -------
0 /u01/app/oracle/oradata/orcl/system01.dbf SYSTEM
1 /u01/app/oracle/oradata/orcl/undotbs01.dbf ONLINE
2 /u01/app/oracle/oradata/orcl/sysaux01.dbf ONLINE
4 /u01/app/oracle/oradata/orcl/users01.dbf ONLINE
6 /u01/app/oracle/oradata/orcl/example01.dbf ONLINE
7 /u01/app/oracle/oradata/orcl/jglu01.dbf ONLINE
7 /u01/app/oracle/oradata/orcl/jglu02.dbf ONLINE
8 /u01/app/oracle/oradata/orcl/test02.dbf ONLINE
8 rows selected.
SQL> select count(*) from jglu.test1;
COUNT(*)
----------
40688
這個操作需要注意的是:需要表空間建立後所有的歸檔日誌,且控制檔案中必須包含受損檔名。另外,
這種方式的恢復不能用於SYSTEM表空間。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/271283/viewspace-1016105/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 備份&恢復之五:歸檔模式下丟失或損壞一個資料檔案模式
- 資料檔案丟失損壞的恢復--
- rman 恢復---歸檔丟失and資料檔案損壞
- Oracle備份與恢復【丟失資料檔案的恢復】Oracle
- 備份與恢復--重建控制檔案後資料檔案損壞的恢復
- 備份恢復之資料檔案丟失
- 磁碟損壞導致資料檔案丟失的恢復
- REDO檔案丟失或者損壞的恢復
- Oracle重做日誌檔案損壞或丟失後的恢復Oracle
- 備份&恢復之八:RMAN備份歸檔模式下損壞(丟失)多個資料檔案,進行整個資料庫的恢復模式資料庫
- undo檔案丟失或損壞
- RMAN_部分資料檔案丟失或者損壞的恢復
- 資料檔案損壞、丟失
- oracle控制檔案的損壞或完全丟失的恢復辦法Oracle
- TEMP表空間的檔案丟失或損壞後的恢復
- Oracle不同檔案丟失/損壞的恢復方法Oracle
- 非系統資料檔案損壞,rman備份恢復
- rman恢復--歸檔模式有備份,丟失資料檔案的恢復模式
- rman恢復--歸檔模式無備份,丟失資料檔案的恢復模式
- 歸檔模式無備份丟失資料檔案後恢復模式
- 歸檔模式有備份丟失資料檔案後恢復模式
- 【備份恢復】非歸檔模式下丟失任意資料檔案 恢復操作模式
- 無備份丟失部分資料檔案和控制檔案恢復 [轉]
- 備份與恢復系列 九 丟失表空間資料檔案的還原與恢復
- 2.7.10 恢復丟失或損壞的伺服器引數檔案(SPFILE)伺服器
- 【備份恢復】歸檔模式下丟失系統關鍵資料檔案 利用RMAN備份恢復模式
- INDEX表空間檔案丟失或者損壞的恢復Index
- coreldraw檔案丟失(損壞)的恢復處理辦法
- 備份&恢復之十三:損壞全部控制檔案
- 【備份恢復】恢復 丟失已歸檔重做日誌檔案
- 沒備份,歸檔日誌存在,丟失資料檔案的恢復
- RMAN資料庫恢復 之歸檔模式有(無)備份-丟失資料檔案的恢復資料庫模式
- oracle實驗記錄(恢復-丟失未備份資料檔案)Oracle
- 【備份恢復】 丟失一個控制檔案 之恢復操作
- 【備份與恢復】恢復受損的口令檔案
- 備份&恢復之十二:損壞單個控制檔案
- Oracle RMAN 不完全恢復(只有資料檔案備份,丟失歸檔日誌備份)Oracle
- RMAN_資料庫的絕大部分資料檔案丟失或者損壞的恢復資料庫