在非归档模式下缺失Redo Log后的恢复

将之前的归档模式修改为非归档

SQL> shutdown immediate;
SQL> startup mount
SQL> alter database noarchivelog;
SQL> alter database open;
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 4
Current log sequence 6

1.Inactive redo log丢失或损坏的恢复

SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE      MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ ---------
1 1 10 52428800 512 2 NO INACTIVE 9783033 06-JUN-19 9783036 06-JUN-19
2 1 11 52428800 512 1 NO INACTIVE 9783036 06-JUN-19 9783039 06-JUN-19
3 1 12 52428800 512 1 NO CURRENT 9783039 06-JUN-19 2.8147E+14 SQL> col member format a50
SQL> select * from v$logfile; GROUP# STATUS TYPE MEMBER IS_
---------- ------- ------- -------------------------------------------------- ---
2 ONLINE /u01/app/oracle/oradata/orcl/redo02.log NO
1 ONLINE /u01/app/oracle/oradata/orcl/redo01.log NO
3 ONLINE /u01/app/oracle/oradata/orcl/redo03.log NO
1 ONLINE /u01/app/oracle/oradata/orcl/redo11.log NO
[oracle@DSI ~]$ dd if=/dev/null of=/u01/app/oracle/oradata/orcl/redo02.log bs=512 count=20
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.00010096 s, 0.0 kB/s
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started. Total System Global Area 784998400 bytes
Fixed Size 2257352 bytes
Variable Size 478154296 bytes
Database Buffers 297795584 bytes
Redo Buffers 6791168 bytes
Database mounted.
ORA-03113: end-of-file on communication channel
Process ID: 6945
Session ID: 125 Serial number: 5
SQL> exit

alert日志

[oracle@DSI ~]$ tail -f -n 300 /u01/app/oracle/diag/rdbms/orcl/orcl/trace/alert_orcl.log
ALTER DATABASE OPEN
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_lgwr_6925.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/orcl/redo02.log'
ORA-27047: unable to read the header block of file
Linux-x86_64 Error: 25: Inappropriate ioctl for device
Additional information: 1
Thu Jun 06 11:18:37 2019
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_m000_7006.trc:
ORA-00316: log 2 of thread 1, type 0 in header is not log file
ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/orcl/redo02.log'
Checker run found 2 new persistent data failures
Completed: alter database clear logfile group 2
[oracle@DSI ~]$ sqlplus / as sysdba
SQL> startup mount
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ ---------
1 1 10 52428800 512 2 NO INACTIVE 9783033 06-JUN-19 9783036 06-JUN-19
3 1 12 52428800 512 1 NO CURRENT 9783039 06-JUN-19 2.8147E+14
2 1 11 52428800 512 1 NO INACTIVE 9783036 06-JUN-19 9783039 06-JUN-19
SQL> alter database clear logfile group 2;
Database altered. SQL> alter database open;
Database altered. SQL> alter system switch logfile;
System altered. SQL> /
System altered.
SQL> select count(*) from test.t7; COUNT(*)
----------
1000

2.Active redo log丢失或损坏的恢复

SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE      MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ ---------
1 1 17 52428800 512 2 NO ACTIVE 9792160 06-JUN-19 9792165 06-JUN-19
2 1 16 52428800 512 1 NO ACTIVE 9783839 06-JUN-19 9792160 06-JUN-19
3 1 18 52428800 512 1 NO CURRENT 9792165 06-JUN-19 2.8147E+14
[oracle@DSI ~]$ dd if=/dev/null of=/u01/app/oracle/oradata/orcl/redo02.log bs=512 count=20
0+0 records in
0+0 records out
0 bytes (0 B) copied, 8.7827e-05 s, 0.0 kB/s insert into t7 values(11,'AAAAAA');
alter system switch logfile;
SQL> select count(*) from t7; COUNT(*)
----------
1001
进行多次切换后,
SQL> select * from v$log; GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ ---------
1 1 26 52428800 512 2 NO ACTIVE 9792529 06-JUN-19 9792536 06-JUN-19
2 1 25 52428800 512 1 NO ACTIVE 9792524 06-JUN-19 9792529 06-JUN-19
3 1 27 52428800 512 1 NO CURRENT 9792536 06-JUN-19 2.8147E+14

发现被dd的redo02.log 没有任何影响,只要不关闭数据库
这里分别使用shutdown immediate/shutdown abort进行测试

##shutdown immediate;

SQL> shutdown immediate;
ORA-01031: insufficient privileges
SQL> conn / as sysdba
Connected.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started. Total System Global Area 784998400 bytes
Fixed Size 2257352 bytes
Variable Size 478154296 bytes
Database Buffers 297795584 bytes
Redo Buffers 6791168 bytes
Database mounted.
ORA-03113: end-of-file on communication channel
Process ID: 7956
Session ID: 125 Serial number: 5

alert log

ALTER DATABASE OPEN
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_lgwr_7936.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '/u01/app/oracle/oradata/orcl/redo02.log'
ORA-27047: unable to read the header block of file
Linux-x86_64 Error: 25: Inappropriate ioctl for device
Additional information: 1
SQL> set linesize 1000
SQL> select * from v$log; GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ ---------
1 1 26 52428800 512 2 NO INACTIVE 9792529 06-JUN-19 9792536 06-JUN-19
3 1 27 52428800 512 1 NO CURRENT 9792536 06-JUN-19 2.8147E+14
2 1 25 52428800 512 1 NO INACTIVE 9792524 06-JUN-19 9792529 06-JUN-19
SQL> alter database clear logfile group 2; Database altered. SQL> alter database open; Database altered. SQL> select * from v$log; GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ ---------
1 1 26 52428800 512 2 NO INACTIVE 9792529 06-JUN-19 9792536 06-JUN-19
2 1 0 52428800 512 1 NO UNUSED 9792524 06-JUN-19 9792529 06-JUN-19
3 1 27 52428800 512 1 NO CURRENT 9792536 06-JUN-19 2.8147E+14
SQL> alter system switch logfile;
SQL> select * from v$log;

##使用shutdown abort测试

SQL> conn test/test
Connected.
SQL> insert into t7 values(11,'AAAAAA');
SQL> select * from v$log; GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ ---------
1 1 32 52428800 512 2 NO ACTIVE 9793080 06-JUN-19 9793110 06-JUN-19
2 1 34 52428800 512 1 NO CURRENT 9793115 06-JUN-19 2.8147E+14
3 1 33 52428800 512 1 NO ACTIVE 9793110 06-JUN-19 9793115 06-JUN-19
[oracle@DSI ~]$ dd if=/dev/null of=/u01/app/oracle/oradata/orcl/redo03.log bs=512 count=20
SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup
ORACLE instance started. Total System Global Area 784998400 bytes
Fixed Size 2257352 bytes
Variable Size 478154296 bytes
Database Buffers 297795584 bytes
Redo Buffers 6791168 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'
ORA-27047: unable to read the header block of file
Linux-x86_64 Error: 25: Inappropriate ioctl for device
Additional information: 1
---
ALTER DATABASE OPEN
Beginning crash recovery of 1 threads
parallel recovery started with 2 processes
Started redo scan
Errors in file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_8099.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-27047: unable to read the header block of file
Linux-x86_64 Error: 25: Inappropriate ioctl for device
Additional information: 1
---
SQL> alter database clear logfile group 3;
alter database clear logfile group 3
*
ERROR at line 1:
ORA-01624: log 3 needed for crash recovery of instance orcl (thread 1)
ORA-00312: online log 3 thread 1: '/u01/app/oracle/oradata/orcl/redo03.log'
SQL> alter database open resetlogs;
alter database open resetlogs
*
ERROR at line 1:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery SQL> recover database until cancel;
ORA-00279: change 9793080 generated at 06/06/2019 15:42:14 needed for thread 1
ORA-00289: suggestion :
/u01/app/oracle/fra/ORCL/archivelog/2019_06_06/o1_mf_1_32_%u_.arc
ORA-00280: change 9793080 for thread 1 is in sequence #32 Specify log: {<RET>=suggested | filename | AUTO | CANCEL} ORA-00308: cannot open archived log
'/u01/app/oracle/fra/ORCL/archivelog/2019_06_06/o1_mf_1_32_%u_.arc'
ORA-27037: unable to obtain file status
Linux-x86_64 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/app/oracle/oradata/orcl/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/app/oracle/oradata/orcl/system01.dbf'

与归档模式下的active恢复类似,添加2个隐含参数

SQL> shutdown immediate;
SQL> startup pfile='/tmp/pfile.ora' mount;
SQL> alter database open resetlogs;
SQL> set linesize 1000
SQL> select * from v$log; GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ ---------
1 1 1 52428800 512 2 NO CURRENT 9793081 06-JUN-19 2.8147E+14
2 1 0 52428800 512 1 YES UNUSED 0 0
3 1 0 52428800 512 1 YES UNUSED 0 0
SQL> alter system switch logfile;
SQL> select * from v$log; GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ ---------
1 1 4 52428800 512 2 NO INACTIVE 9793443 06-JUN-19 9793446 06-JUN-19
2 1 5 52428800 512 1 NO INACTIVE 9793446 06-JUN-19 9793449 06-JUN-19
3 1 6 52428800 512 1 NO CURRENT 9793449 06-JUN-19 2.8147E+14 SQL> select count(*) from test.t7; COUNT(*)
----------
1005
[oracle@DSI ~]$ tail -f -n 300 /u01/app/oracle/diag/rdbms/orcl/orcl/trace/alert_orcl.log

07 oracle 非归档模式 inactive/active/current redo log损坏的恢复的更多相关文章

  1. 07 oracle 归档模式 inactive/current redo log损坏修复--以及错误ORA-00600: internal error code, arguments: [2663], [0], [9710724], [0], [9711142], [], [], [], [], [], [], []

    07 oracle 归档模式 inactive/current redo log损坏修复--以及错误ORA-00600: internal error code, arguments: [2663], ...

  2. Oracle非归档模式下脱机数据文件

    正常情况下,要想对数据文件脱机,必须在归档模式下,这是ORACLE自动保护的一种措施,防止在非归档模式下对数据文件脱机,造成数据丢失.如果想在非归档模式下执行数据文件脱机操作,则需要加上“for dr ...

  3. oracle非归档模式下的冷备份和恢复

    查看归档的相关信息 SQL> archive log list数据库日志模式             非存档模式自动存档             禁用存档终点            USE_DB ...

  4. Oracle归档模式与非归档模式设置

    (转自:http://www.cnblogs.com/spatial/archive/2009/08/01/1536429.html) Oracle的日志归档模式可以有效的防止instance和dis ...

  5. 怎样将Oracle数据库设置为归档模式及非归档模式

    怎样将Oracle数据库设置为归档模式及非归档模式 1.Oracle日志分类 分三大类: Alert log files--警报日志,Trace files--跟踪日志(用户和进程)和 redo lo ...

  6. Oracle归档模式和非归档模式

    一 什么是Oracle归档模式? Oracle数据库有联机重做日志,这个日志是记录对数据库所做的修改,比如插入,删除,更新数据等,对这些操作都会记录在联机重做日志里.一般数据库至少要有2个联机重做日志 ...

  7. Oracle归档与非归档模式

    一.什么是Oracle归档模式 Oracle数据库有联机重做日志,这个日志是记录对数据库所做的修改,比如插入,删除,更新数据等,对这些操作都会记录在联机重做日志里.一般数据库至少要有2个联机重做日志组 ...

  8. Oracle归档模式和非归档模式的区别

    一.查看oracle数据库是否为归档模式: Sql代码1.select name,log_mode from v$database; NAME LOG_MODE ------------------ ...

  9. 测试Oracle 11gr2 RAC 非归档模式下,offline drop数据文件后的数据库的停止与启动测试全过程

    测试Oracle 11gr2 RAC 非归档模式下,offline drop数据文件后的数据库的停止与启动测试全过程 最近系统出现问题,由于数据库产生的日志量太大无法开启归档模式,导致offline的 ...

随机推荐

  1. 梯度下降算法(Gradient descent)GD

    1.我们之前已经定义了代价函数J,可以将代价函数J最小化的方法,梯度下降是最常用的算法,它不仅仅用在线性回归上,还被应用在机器学习的众多领域中,在后续的课程中,我们将使用梯度下降算法最小化其他函数,而 ...

  2. HTML-图片和多媒体

    1.图片和多媒体 (1)    图片:img元素 src 属性:图片路径: alt 属性:图片无法显示时使用的替代文字: title:鼠标悬停时显示的文字 : <img src="图片 ...

  3. mailto - 简单多媒体邮件发送程序

    SYNOPSIS mailto  [-a] [-c] [-s] [recipient name(s)] DESCRIPTION mailto 程序是一个用于发送MIME格式的多媒体邮件(MIME格式是 ...

  4. Django中间件拦截未登录url

    1.利用装饰器在视图中拦截未登录的url @login_required(login_url='/user/login/') def homepage(request): pass 这种方法适合于程序 ...

  5. Codeforces Round #430 (Div. 2) - B

    题目链接:http://codeforces.com/contest/842/problem/B 题意:给定一个圆心在原点(0,0)半径为r的大圆和一个圆内的圆环长度d,然后给你n个小圆,问你有多少个 ...

  6. jmeter性能压测瓶颈排查-网络带宽

    问题: 有一台机器做性能压测的时候,无论开多少个线程,QPS一直压不上去,而服务器和数据库的性能指标(主要是CPU和内存)一直维持在很低的水平. 希望帮忙排查一下原因. 过去看了下进行压测的接口代码, ...

  7. Tomcat与jdk在Linux上的安装与配置

    本人qq群也有许多的技术文档,希望可以为你提供一些帮助(非技术的勿加). QQ群:   281442983 (点击链接加入群:http://jq.qq.com/?_wv=1027&k=29Lo ...

  8. 二进制sersync部署安装

    一.为什么要用rsync+sersync架构? 1.sersync是基于inotify开发的,类似于inotify-tools的工具 2.sersync可以记录下被监听目录中发生变化的(包括增加.删除 ...

  9. bzoj4165 矩阵 堆维护多路归并

    题目传送门 https://lydsy.com/JudgeOnline/problem.php?id=4165 题解 大概多路归并是最很重要的知识点了吧,近几年考察也挺多的(虽然都是作为签到题的). ...

  10. php----等比缩放图片

    <?php /** * Created by PhpStorm. * User: admin * Date: 2019/11/19 * Time: 8:54 */ $filename = 'lo ...