沒有備份、只有歸檔日志,如何恢復(fù)數(shù)據(jù)文件? 系統(tǒng)環(huán)境: 1、操作系統(tǒng):windows 2000 server,機(jī)器內(nèi)存128m 2、數(shù)據(jù)庫: oracle 8i r2 (8.1.6) for nt 企業(yè)版 3、安裝路徑:c:/oracle 模擬現(xiàn)象: 可通過重建數(shù)據(jù)文件來恢復(fù),前提是歸檔日志文件保存完整先將數(shù)據(jù)庫設(shè)置為歸檔模式sql*plusconn system/manager--創(chuàng)建實(shí)驗(yàn)表空間create tablespace test datafile'c:/test.ora' size 5mautoextend on next 1m maxsize unlimiteddefault storage (initial 128k next 1m pctincrease 0)/--創(chuàng)建實(shí)驗(yàn)用戶 drop user test cascade;create user test identified by test default tablespace test;grant connect,resource to test;conn test/testcreate table a(a number);insert into a values(1);insert into a select * from a;--反復(fù)插入,達(dá)到100萬條commit;--關(guān)閉數(shù)據(jù)庫svrmgr> connect internalsvrmgr> alter system switch logfile;--強(qiáng)制歸檔svrmgr> alter system switch logfile;svrmgr> alter system switch logfile;svrmgr> shutdown--操作系統(tǒng)下刪除test.ora文件--重新啟動數(shù)據(jù)庫svrmgr> connect internalsvrmgr> startup這時,可以mount上,但無法打開,因?yàn)閿?shù)據(jù)文件test.ora不存在,顯示錯誤如下:ora-01157: ????/?????? 8 - ??? dbwr ????ora-01110: ???? 8: 'c:/test.ora'svrmgr> connect internalsvrmgr> startup mountsvrmgr> alter database create datafile 'c:/test.ora';svrmgr> set autorecovery onsvrmgr> recover datafile 'c:/test.ora';svrmgr> alter database open;conn test/testselect count(*) from a;--數(shù)據(jù)又恢復(fù)到100萬條--刪除實(shí)驗(yàn)表空間conn system/manageralter tablespace test offline;drop tablespace test including contents;drop user test;--如果是非歸檔模式,也可以運(yùn)用以上方法,--前提是:輸入記錄所占空間的大小不超過所有聯(lián)機(jī)日志文件的大小--即:用聯(lián)機(jī)日志文件來恢復(fù)