1.創(chuàng)建一個表T2插入兩行數(shù)據(jù),第一行數(shù)據(jù)寫如果歸檔日志,第二行數(shù)據(jù)在聯(lián)機(jī)日志中
SQL> create table t2(
a1 number(10),
a2 char(10)) tablespace users; -
SQL> insert into t2 values (11,'aa');
SQL> commit;
SQL> alter system switch logfile;
SQL> insert into t2 values(22,'bb');
SQL> commit;
2.查詢?nèi)罩疚募?br />
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/database/ykg/ykg1a.log
/database/ykg/ykg2a.log
3.正常關(guān)閉數(shù)據(jù)庫
SQL> shutdown immediate
Database closed.
Database dismounted.
Oracle instance shut down.
4.模擬聯(lián)機(jī)日志文件損壞
SQL> host rm -rf /database/ykg/ykg*.log
5.正常啟動數(shù)據(jù)庫報錯
SQL> startup
Oracle instance started.
Total System Global Area 293601280 bytes
Fixed Size 2020392 bytes
Variable Size 92277720 bytes
Database Buffers 197132288 bytes
Redo Buffers 2170880 bytes
Database mounted.
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/database/ykg/ykg1a.log'
6.查看當(dāng)前聯(lián)機(jī)日志的SEQUENCE號
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 191
Next log sequence to archive 192
Current log sequence 192
7.假裝執(zhí)行不完全恢復(fù)來恢復(fù)日志組
RMAN> run {
2> recover database until sequence 193 thread 1;
3> alter database open resetlogs;}
8.驗(yàn)證日志成員已恢復(fù),數(shù)據(jù)沒有丟失
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/database/ykg/ykg1a.log
/database/ykg/ykg2a.log
本文出自:億恩科技【mszdt.com】
服務(wù)器租用/服務(wù)器托管中國五強(qiáng)!虛擬主機(jī)域名注冊頂級提供商!15年品質(zhì)保障!--億恩科技[ENKJ.COM]
|