ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 数据库日志损坏

数据库日志损坏

原创 Linux操作系统 作者:zsy0951 时间:2019-06-19 16:06:06 0 删除 编辑

 

 也是2007年的事情了,记录下

 

门店发现启动数据库报错。手工启动检查:

SQL> alter database open;

alter database open

*

ERROR at line 1:

ORA-00368: checksum error in redo log block

ORA-00353: log corruption near block 937 change 4256112933 time 05/29/2006

11:04:05

ORA-00312: online log 4 thread 1: '/oradata/m220_db/redofile/redo04.log'

 检查日志

SQL> select * from v$log;

     GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS

---------- ---------- ---------- ---------- ---------- --- ----------------

FIRST_CHANGE# FIRST_TIM

------------- ---------

         1          1     681131    1048576          1 NO  INACTIVE

   4256111609 29-MAY-06

          2          1     681132    1048576          1 NO  ACTIVE

   4256111623 29-MAY-06

     GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS

---------- ---------- ---------- ---------- ---------- --- ----------------

FIRST_CHANGE# FIRST_TIM

------------- ---------

         4          1     681134    1048576          1 NO  CURRENT

   4256112923 29-MAY-06

          5          1     681130    1048576          1 NO  INACTIVE

   4256111580 29-MAY-06

 发现当前日志损坏。

尝试切换日志组和

SQL> alter database switch logfile;

alter database switch logfile

                      *

ERROR at line 1:

ORA-02231: missing or invalid option to ALTER DATABASE

 SQL> alter system switch logfile;

alter system switch logfile

*

ERROR at line 1:

ORA-01109: database not open

 2、尝试清理当前日志组失败。

SQL> alter database clear unarchived logfile group 4;

alter database clear unarchived logfile group 4

*

ERROR at line 1:

ORA-01624: log 4 needed for crash recovery of thread 1

ORA-00312: online log 4 thread 1: '/oradata/m220_db/redofile/redo04.log'

 没有办法,强制恢复。

具体更改:

1、  更改初始化文件,增加_ALLOW_RESETLOGS_CORRUPTION = true。

2、  连接数据库,并mount

oracle@rzyzpos oracle]$ sqlplus "/ as sysdba"

SQL*Plus: Release 9.2.0.6.0 - Production on Mon May 29 14:52:51 2006

 Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

 Connected to an idle instance.

 SQL> startup pfile=/oradata/m220_db/pfile/initm220.ora mount;

ORACLE instance started.

 Total System Global Area  336663892 bytes

Fixed Size                   451924 bytes

Variable Size             251658240 bytes

Database Buffers           83886080 bytes

Redo Buffers                 667648 bytes

Database mounted.

SQL>

 3、  恢复

SQL> recover database until cancel;

ORA-00279: change 4256112932 generated at 05/29/2006 11:04:05 needed for thread

1

ORA-00289: suggestion : /u01/oracle/product/9.2.0.6/dbs/arch1_681134.dbf

ORA-00280: change 4256112932 for thread 1 is in sequence #681134

 Specify log: {=suggested | filename | AUTO | CANCEL}

cancel

ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below

ORA-01194: file 1 needs more recovery to be consistent

ORA-01110: data file 1: '/oradata/m220_db/datafile/system01.dbf'

 ORA-01112: media recovery not started

 4、  不必理会错误,打开数据库

SQL> alter database open resetlogs; 

Database altered.

 5、  导出全库dmp

6、  重建数据库实例

7、  导入dmp

8、  重新编译失效对象。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/14740/viewspace-624389/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2002-06-26

  • 博文量
    35
  • 访问量
    35259