Oracle表空間中的實(shí)際數(shù)據(jù)文件丟失的恢復(fù)
以下的文章主要介紹的是Oracle表空間的實(shí)際數(shù)據(jù)文件丟失的恢復(fù),我們假設(shè)Oracle數(shù)據(jù)庫其處于歸檔模式。我們?cè)跀?shù)據(jù)庫里重建一個(gè)Oracle表空間,一共有3個(gè)相關(guān)的數(shù)據(jù)文件。各10M,表空間內(nèi)有一張23M的表。
- SQL> select count(*) from ldy.t1;
- COUNT(*)
- 605136
- SQL> col segment_name for a20
- SQL> col tablespace_name for a20
- SQL> select segment_name,tablespace_name,bytes/1024/1024 mb from dba_segments where owner='LDY';
- SEGMENT_NAME TABLESPACE_NAME MB
- T1 LDY 23
關(guān)閉數(shù)據(jù)庫,將Oracle表空間的其中一個(gè)數(shù)據(jù)文件刪除,啟動(dòng)后報(bào)錯(cuò):
- SQL> startup
Oracle例程已經(jīng)啟動(dòng)。
- Total System Global Area 612368384 bytes
- Fixed Size 1250428 bytes
- Variable Size 230689668 bytes
- Database Buffers 373293056 bytes
- Redo Buffers 7135232 bytes
數(shù)據(jù)庫裝載完畢。
ORA-01157: 無法標(biāo)識(shí)/鎖定數(shù)據(jù)文件 6 - 請(qǐng)參閱 DBWR 跟蹤文件
ORA-01110: 數(shù)據(jù)文件 6: 'E:\ORACLE\ORADATA\LDY01.DBF'
此時(shí)數(shù)據(jù)庫為mount狀態(tài)。
- SQL> select open_mode from v$database;
- OPEN_MODE
- MOUNTED
增加回該數(shù)據(jù)文件。
- SQL>alter database create datafile 'E:\ORACLE\ORADATA\LDY01.DBF';
數(shù)據(jù)庫已更改。
介質(zhì)恢復(fù)。
- SQL>recover datafile 6;
完成介質(zhì)恢復(fù)。
數(shù)據(jù)庫打開,正常查詢。
- SQL> alter database open;
數(shù)據(jù)庫已更改。
- SQL> select count(*) from ldy.t1;
- COUNT(*)
- 605136
以上的相關(guān)內(nèi)容就是對(duì)@Oracle表空間的數(shù)據(jù)文件丟失的恢復(fù)的介紹,望你能有所收獲。
【編輯推薦】