備份&恢復之十:損壞非當前聯機日誌

mengzhaoliang發表於2008-05-08
2008/05/08    
備份&恢復之十:損壞非當前聯機日誌


測試環境:
1      作業系統:Redhat Linux 5
[oracle@mzl proc]$ cat /proc/version
Linux version 2.6.18-8.el5 (brewbuilder@ls20-bc2-14.build.redhat.com) (gcc version 4.1.1 20070105 (Red Hat 4.1.1-52)) #1 SMP Fri Jan 26 14:15:21 EST 2007

2     資料庫版本:Oracle10g
SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE    10.2.0.1.0      Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production


3  設定成歸檔模式.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  268435456 bytes
Fixed Size                  1218868 bytes
Variable Size              88082124 bytes
Database Buffers          171966464 bytes
Redo Buffers                7168000 bytes
Database mounted.
SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     16
Current log sequence           18
SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     16
Next log sequence to archive   18
Current log sequence           18
SQL>


4 當前的redo日誌為2
SQL> select group#,sequence#,archived,status from v$log;

    GROUP#  SEQUENCE# ARC STATUS
---------- ---------- --- ----------------
         1          0 YES UNUSED
         2          1 NO  CURRENT
         3          0 YES UNUSED


5   把日誌3移走,移動到資料夾“Old“中
[oracle@mzl orcl]$ mv redo03.log Old






6  關閉資料庫
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.



7  啟動
SQL> startup      
ORACLE instance started.

Total System Global Area  268435456 bytes
Fixed Size                  1218868 bytes
Variable Size              88082124 bytes
Database Buffers          171966464 bytes
Redo Buffers                7168000 bytes
Database mounted.
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/u01/app/oracle/oradata/orcl/redo03.log'

看alert_ORCL.log日誌:
Thu May  8 14:55:58 2008
ARC0: Archival started
ARC1: Archival started
LGWR: STARTING ARCH PROCESSES COMPLETE
ARC1 started with pid=17, OS id=6020
Thu May  8 14:55:58 2008
Errors in file /u01/app/oracle/admin/orcl/bdump/orcl_lgwr_5998.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/u01/app/oracle/oradata/orcl/redo03.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Thu May  8 14:55:58 2008
Errors in file /u01/app/oracle/admin/orcl/bdump/orcl_lgwr_5998.trc:
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/u01/app/oracle/oradata/orcl/redo03.log'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
Thu May  8 14:55:58 2008
ARC0: STARTING ARCH PROCESSES
Thu May  8 14:55:58 2008
ARC1: Becoming the 'no FAL' ARCH
ARC1: Becoming the 'no SRL' ARCH
Thu May  8 14:55:58 2008
ORA-313 signalled during: ALTER DATABASE OPEN...
Thu May  8 14:55:58 2008
ARC2: Archival started
ARC0: STARTING ARCH PROCESSES COMPLETE
ARC0: Becoming the heartbeat ARCH
ARC2 started with pid=18, OS id=6022


8  用CLEAR命令重建該日誌檔案
SQL> alter database clear logfile group 3;

Database altered.


開啟資料庫
SQL> alter database open;

Database altered.




說明:
1、如果損壞的是非當前的聯機日誌檔案,一般只需要clear就可以重建該日誌檔案,但是如果該資料庫處於歸檔狀態但該日誌還沒有歸檔,就需要強行clear。
2、建議clear,特別是強行clear後作一次資料庫的全備份。
3、此方法適用於歸檔與非歸檔資料庫
 
參考itpub上piner的備份與恢復案例:
http://www.itpub.net/viewthread.php?tid=126320&extra=page%3D4%26amp%3Bfilter%3Ddigest
在伺服器測試成功
 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12778571/viewspace-263320/,如需轉載,請註明出處,否則將追究法律責任。

相關文章