700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > Oracle当前日志组出错 【案例】Oracle报错ORA-00313 ORA-00312 ORA-27037当前联机日志损坏恢复...

Oracle当前日志组出错 【案例】Oracle报错ORA-00313 ORA-00312 ORA-27037当前联机日志损坏恢复...

时间:2019-11-13 10:48:38

相关推荐

Oracle当前日志组出错 【案例】Oracle报错ORA-00313 ORA-00312 ORA-27037当前联机日志损坏恢复...

天萃荷净

运维DBA反映Oracle数据库在启动时报错ORA-00313 ORA-00312 ORA-27037,分析原因为数据库redo联机日志文件损坏导致

环境模拟

删除状态为active的联机日志,然后强行关闭数据库

1.数据库报错ORA-00313 ORA-00312 ORA-27037

SQL> startup

ORACLE instance started.

Total System Global Area 167772160 bytes

Fixed Size 1260720 bytes

Variable Size 142607184 bytes

Database Buffers 16777216 bytes

Redo Buffers 7127040 bytes

Database mounted.

ORA-00313: open failed for members of log group 1 of thread 1

ORA-00312: online log 1 thread 1: ‘/u01/oradata/xienfei/redo01.log’

ORA-27037: unable to obtain file status

Linux Error: 2: No such file or directory

Additional information: 3

Alert.log 日志中错误

Wed Aug 24 00:26:33

Errors in file /u01/admin/xienfei/udump/xff_ora_9186.trc:

ORA-00313: open failed for members of log group 1 of thread 1

ORA-00312: online log 1 thread 1: ‘/u01/oradata/xienfei/redo01.log’

ORA-27037: unable to obtain file status

Linux Error: 2: No such file or directory

Additional information: 3

xff_ora_9186.trc文件中错误

ORA-00313: open failed for members of log group 1 of thread 1

ORA-00312: online log 1 thread 1: ‘/u01/oradata/xienfei/redo01.log’

ORA-27037: unable to obtain file status

Linux Error: 2: No such file or directory

Additional information: 3

查询当前日志组状态

SQL> select a.group#,a.status,b.member from v$log a,v$logfile b where a.group#=b.group#;

GROUP# STATUS MEMBER

———- —————- ———————————————

1 CURRENT /u01/oradata/xienfei/redo01.log

3 INACTIVE /u01/oradata/xienfei/redo03.log

2 ACTIVE /u01/oradata/xienfei/redo02.log

2.尝试删除redo日志

SQL> alter database drop logfile group 1;

alter database drop logfile group 1

*

ERROR at line 1:

ORA-01623: log 1 is current log for instance xff (thread 1) – cannot drop

ORA-00312: online log 1 thread 1: ‘/u01/oradata/xienfei/redo01.log’

发现是当前日志不能被删除,尝试切换日志

SQL> alter system switch logfile;

alter system switch logfile

*

ERROR at line 1:

ORA-01109: database not open

在数据库未打开状态,不能切换日志,只能尝试清空日志

SQL> alter database clear unarchived logfile group 1;

alter database clear unarchived logfile group 1

*

ERROR at line 1:

ORA-01624: log 1 needed for crash recovery of instance xff (thread 1)

ORA-00312: online log 1 thread 1: ‘/u01/oradata/xienfei/redo01.log’

因为数据库恢复需要使用,不能被清空,尝试不完成恢复

SQL> recover database until cancel;

ORA-00279: change 1272687 generated at 08/24/ 00:20:05 needed for thread 1

ORA-00289: suggestion : /u01/archive/1_27_756841839.arc

ORA-00280: change 1272687 for thread 1 is in sequence #27

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

auto

ORA-00279: change 1272903 generated at 08/24/ 00:25:17 needed for thread 1

ORA-00289: suggestion : /u01/archive/1_28_756841839.arc

ORA-00280: change 1272903 for thread 1 is in sequence #28

ORA-00278: log file ‘/u01/archive/1_27_756841839.arc’ no longer needed for this

recovery

ORA-00308: cannot open archived log ‘/u01/archive/1_28_756841839.arc’

ORA-27037: unable to obtain file status

Linux Error: 2: No such file or directory

Additional information: 3

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: ‘/u01/oradata/xienfei/system01.dbf’

已经提示数据不一致,尝试着打开数据库

SQL> alter database open resetlogs;

alter database open resetlogs

*

ERROR at line 1:

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

ORA-01110: data file 1: ‘/u01/oradata/xienfei/system01.dbf’

创建pfile文件,添加隐含参数,使之不进行检查点一致性校验

SQL> create pfile=’/tmp/pfile’ from spfile;

File created.

修改pfile ,添加以下参数

*._allow_resetlogs_corruption=TRUE

*._allow_error_simulation=TRUE

SQL> shutdown abort

ORACLE instance shut down.

使用pfile打开数据库

SQL> startup pfile=’/tmp/pfile’

ORACLE instance started.

Total System Global Area 167772160 bytes

Fixed Size 1260720 bytes

Variable Size 150995792 bytes

Database Buffers 8388608 bytes

Redo Buffers 7127040 bytes

Database mounted.

ORA-38760: This database instance failed to turn on flashback database

发现flashback导致数据库不能被正常打开,尝试关闭它

SQL> alter database flashback off;

Database altered.

尝试直接open数据库

SQL> alter database open;

alter database open

*

ERROR at line 1:

ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

根据提示,使用resetlogs打开数据库

SQL> alter database open resetlogs;

Database altered.

查询日志状态

SQL> select a.group#,a.status,b.member from v$log a,v$logfile b where a.group#=b.group#;

GROUP# STATUS MEMBER

———- —————- ———————————————

3 UNUSED /u01/oradata/xienfei/redo03.log

2 UNUSED /u01/oradata/xienfei/redo02.log

1 CURRENT /u01/oradata/xienfei/redo01.log

因为group1错误,而当前日志组在group 1上,所以切换日志组

SQL> alter system switch logfile;

System altered.

SQL> select a.group#,a.status,b.member from v$log a,v$logfile b where a.group#=b.group#;

GROUP# STATUS MEMBER

———- —————- ———————————————

3 UNUSED /u01/oradata/xienfei/redo03.log

2 CURRENT /u01/oradata/xienfei/redo02.log

1 ACTIVE /u01/oradata/xienfei/redo01.log

SQL> alter system checkpoint;

System altered.

SQL> select a.group#,a.status,b.member from v$log a,v$logfile b where a.group#=b.group#;

GROUP# STATUS MEMBER

———- —————- ———————————————

3 UNUSED /u01/oradata/xienfei/redo03.log

2 CURRENT /u01/oradata/xienfei/redo02.log

1 INACTIVE /u01/oradata/xienfei/redo01.log

4.删除有问题的group 1日志组

SQL> alter database drop logfile group 1;

Database altered.

SQL> alter system switch logfile;

System altered.

添加日志组并检查是否正确

SQL> select a.group#,a.status,b.member from v$log a,v$logfile b where a.group#=b.group#;

GROUP# STATUS MEMBER

———- —————- ———————————————

3 CURRENT /u01/oradata/xienfei/redo03.log

2 ACTIVE /u01/oradata/xienfei/redo02.log

SQL> alter database add logfile group 1 ‘/u01/oradata/xienfei/redo01.log’ size 50m reuse;

Database altered.

SQL> alter system switch logfile;

System altered.

SQL> select a.group#,a.status,b.member from v$log a,v$logfile b where a.group#=b.group#;

GROUP# STATUS MEMBER

———- —————- ———————————————

3 ACTIVE /u01/oradata/xienfei/redo03.log

2 ACTIVE /u01/oradata/xienfei/redo02.log

1 CURRENT /u01/oradata/xienfei/redo01.log

注意:根据oracle官方建议,使用oracle隐含参数运行数据库可能存在很多不稳定因素,建议立即导出数据库数据,然后新建库,重新导入数据

--------------------------------------ORACLE-DBA----------------------------------------

最权威、专业的Oracle案例资源汇总之【案例】Oracle报错ORA-00313 ORA-00312 ORA-27037当前联机日志损坏恢复

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。