【點(diǎn)擊:】
阿木伯 著
|
|
如何使用歸檔日志進(jìn)行完全恢復(fù)? |
|
- 系統(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ù)庫設(shè)置為歸檔模式
SQL*Plus
--創(chuàng)建實(shí)驗(yàn)表空間
create tablespace test datafile
'c:\test.ora' size 5M
AUTOEXTEND ON NEXT 1M MAXSIZE UNLIMITED
default 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/test
create table a(a number);
insert into a values(1);
insert into a select * from a; --反復(fù)插入,達(dá)到10萬條
commit;
拷貝test.ora為test1.ora文件
insert into a select * from a; --20萬條
commit;
關(guān)閉數(shù)據(jù)庫
shutdown
刪除test.ora文件,把test1.ora拷貝為test.ora。
重新啟動(dòng)數(shù)據(jù)庫
這時(shí),可以mount上,但無法打開,因?yàn)楝F(xiàn)在使用的數(shù)據(jù)文件是舊的
只有10萬條記錄,與控制文件中記載的log number不一樣
startup mount
需要recover database,使數(shù)據(jù)庫記錄重新恢復(fù)到當(dāng)前的20萬條
C:\>svrmgrl
svrmgrl>connect internal
svrmgrl>shutdown
svrmgrl>startup mount
svrmgrl>set autorecovery on
svrmgrl>recover database;
svrmgrl>alter database open;
conn test/test
select count(*) from a; --數(shù)據(jù)又恢復(fù)到20萬條
conn system/manager
--刪除實(shí)驗(yàn)表空間
alter tablespace test offline;
drop tablespace test INCLUDING CONTENTS;
|
【最后更新:】 |
|