日期:2014-05-16  浏览次数:20509 次

logfile文件损坏的问题处理(ORA-00327)

1, 数据库日志报错ORA-00327,注意此处有乱码

Errors in file /oracle/app/oracle/diag/rdbms/tyolap/tyolap3/trace/tyolap3_lgwr_22388.trc:
ORA-00327: 脠脮脮I 31 (脌M戮<80> 3 碌脛): <8c><8d>贸w麓贸脨隆 102400 脡脵矛露脣霉脨猫脪陋碌脛 1048576
ORA-00312: 戮<80>脡脧脠脮脮I 31 脌M戮<80> 3: '+DATA/tyolap/onlinelog/redo31a'
Errors in file /oracle/app/oracle/diag/rdbms/tyolap/tyolap3/trace/tyolap3_lgwr_22388.trc:
ORA-00321: 脠脮脮I 31 (脌M戮<80> 3 碌脛): <9f>o路篓赂眉脨脗脠脮脮I<99>n<98>脣卯^
ORA-00312: 戮<80>脡脧脠脮脮I 31 脌M戮<80> 3: '+DATA/tyolap/onlinelog/redo31a'

查看报错具体内容,应该是redo文件+DATA/tyolap/onlinelog/redo31a损坏

[oracle@dtydb5 scripts]$ oerr ora 327
00327, 00000, "log %s of thread %s, physical size %s less than needed %s"
// *Cause:  A log file has shrunk in size. This is likely
//          to have been caused by operator or operating system error.
// *Action: Restore the log file from backup.  If backup is not available,
//          drop this log and re-create.  If the database was shut down
//          cleanly, no further action should be required; otherwise
//          incomplete recovery may be required.

[oracle@dtydb5 scripts]$ oerr ora 312
00312, 00000, "online log %s thread %s: '%s'"
// *Cause:  This message reports the filename for details of another message.
// *Action: Other messages will accompany this message. See the
//          associated messages for the appropriate action to take.

[oracle@dtydb5 scripts]$ oerr ora 321
00321, 00000, "log %s of thread %s, cannot update log file header"
// *Cause:  Cannot write to the log file.
// *Action: Restore the access to the file.

2,进一步查看trc文件,具体原因没看明白,但基本已可以确定是日志文件损坏

DE: Problem Key 'ORA 313' was flood controlled (0x1) (no incident)
ORA-00313: ?????? 31 (???? 3) ?????
ORA-00313: ?????? 31 (???? 3) ?????
DDE rules only execution for: ORA 312
----- START Event Driven Actions Dump ----
---- END Event Driven Actions Dump ----
----- START DDE Actions Dump -----
Executing SYNC actions
----- START DDE Action: 'DB_STRUCTURE_INTEGRITY_CHECK' (Async) -----
DDE Action 'DB_STRUCTURE_INTEGRITY_CHECK' was flood controlled
----- END DDE Action: 'DB_STRUCTURE_INTEGRITY_CHECK' (FLOOD CONTROLLED, 5 csec) -----
Executing ASYNC actions
----- END DDE Actions Dump (total 0 csec) -----

3,查看此redo文件的状态,status为INVALID,另一个为stale,系统还在正常运行中.

        31          3        575          2        536,870,912 YES ACTIVE

        32          3        576          2        536,870,912 NO  CURRENT

    GROUP# STATUS  TYPE    MEMBER                                             IS_
---------- ------- ------- -------------------------------------------------- ---
        31 STALE   ONLINE  +DATA/tyolap/onlinelog/redo31a                     NO
                   ONLINE  +DATA/tyolap/onlinelog/redo31b                     NO

        32 INVALID ONLINE  +DATA/tyolap/onlinelog/redo32a                     NO
                   ONLINE  +DATA/tyolap/onlinelog/redo32b                     NO

STATUS 	VARCHAR2(7) 	Status of the log member:

    INVALID - File is inaccessible

    STALE - File's contents are incomplete

    DELETED - File is no longer used

    null - File is in use

4,日志文件损坏,最简单的方法就是在线重建日志文件了

sys@TYOLAP3(dtydb5)> ALTER DATABASE DROP LOGFILE MEMBER '+DATA/tyolap/onlinelog/redo31a'; 

数据库已更改。


sys@TYOLAP3(dtydb5)> ALTER DATABASE ADD LOGFILE MEMBER '+DATA/tyolap/onlinelog/redo31a' to group 31;   

数据库已更改。

sys@TYOLAP3(dtydb5)> alter system switch logfile;

系统日志恢复正常

    GROUP# STATUS  TYPE    MEMBER                                             IS_
---------- ------- ------- -------------------------------------------------- ---