当前联机日志损坏恢复

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

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

处理过程
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 2011
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

尝试删除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/2011 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/2011 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
删除有问题的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内容 请关注我:

转载于:https://my.oschina.net/5486002/blog/684048

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/294053.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Android之 如何解决ScrollView 和ListView滑动冲突的问题如何解决ScrollView can host only one direct child

android 采用ScrollView布局时出现异常:ScrollView can host only one direct child。 解决办法:主要是ScrollView内部只能有一个子元素,即不能并列两个子元素,所以需要把所有的子元素放到一个LinearLayout内部或 RelativeLayout等其他布局 如何解决ScrollView 和ListVi…

mysql 中执行的 sql 注意字段之间的反向引号和单引号

如下的数据表 create table test( id int(11) not null auto_increment primary key, user varchar(100) not null, flag char(2) not null default ok ); 当查询时应该写成 $sql "select user from test where flagok "; 字段是数据表的,用 &#xff08…

权威杂志评选出的十个最伟大的公式,爱因斯坦的质能方程竟然只能排第六!简直神仙打架....

全世界只有3.14 % 的人关注了爆炸吧知识难决高下各有千秋当数学家得出方程式和公式,如同看到雕像,美丽的风景,听到优美的曲调等等一样而得到充分的快乐。——柯普宁公式,是数学世界中一道美丽的风景,一个小小的等式&am…

在Idea中测试各JVM语言的交互性

为什么80%的码农都做不了架构师?>>> 背景: 假设出现这样的场景,一个Java项目中,需要用其他语言来编写相关模块,但需要能被Java调用 测试工具:Idea12 测试语言:Groovy、Scala、Ko…

android pcm调节音量,调整PCM语音数据的音量

通过编程实现调整PCM的音量,具体做法是乘上一个固定的数,但是要考虑数据的溢出问题,代码如下://调节PCM数据音量//comment : 对PCM数据的音量进行放大//parameter :// pData PCM数据// nLen PCM数据的长度// nBitsPerSample 每个S…

.NET 大会今日开幕 |这些白嫖福利不看肠子都悔青

{ 12.18 线上开幕 文末有福利 }2021 .NET 开发者大会,今日开幕你是否已经满怀期待,同时又有很多疑问“ 会场在哪里?” "哪些大咖会参加?"“ 技术主题有哪些?” “ 什么时间有福利?”…时间不多了…

Android之如何解决ScrollView起始位置不是最顶部的解决办法

最近遇到了打开带有ScrollView的页面布局默认起始位置不是最顶部的情况,最后发现问题是因为ScrollView内部嵌套了listview,只需要设置listview获取焦点为false即可。 listview.setFocusable(false); 如果内部嵌套的是其它,也是同样的处理方…

asp.net web常用控件FileUpload(文件上传控件)

2019独角兽企业重金招聘Python工程师标准>>> FileUpload控件的主要中能:向指定目录上传文件,该控件包括一个文本框和一个浏览按钮。 常用的属性:FileBytes,FileContent、FileName、HasFile、PostedFile。 常用的方法&a…

SQL、LINQ、Lambda 三种用法

颜色注释: SQL LinqToSql Lambda QA1、 查询Student表中的所有记录的Sname、Ssex和Class列。select sname,ssex,class from studentLinq: from s in Students select new { s.SNAME, s.SSEX, s.CLASS }Lambda: Students.Select( s…

android 拍照换头像,Android调用相机拍照,裁剪及更换头像功能的实现

1,点击弹出popwindow,选择相机或者相册这个就不多说了,在OnclickListener里写弹出的窗口位置和样式。2,选择拍照功能,调用手机相机。//调用相机Intent intent new Intent("android.media.action.IMAGE_CAPTURE&q…

win7 绑定arp

首先,需要查看可用网卡的id,使用命令netsh i i show interface ; 再绑定arp地址,netsh -c "i i" add neighbors idx IP地址 MAC地址 ; 若要删除绑定,可以使用netsh -c "i i" delete…

设计模式:面向对象的设计原则下(ISP、DIP、KISS、YAGNI、DRY、LOD)

本文继续来介绍接口隔离原则(ISP)和依赖倒置原则(DIP),这两个原则都和接口和继承有关。文章最后会简单介绍几个除了 SOLID 原则之外的原则。接口隔离原则(ISP)提起接口,开发人员的第…

Android之sqlite常见用法以及取最新多少条数据(包括删除和不删除之外的数据)

用sqlite的感受: sqlite和mysql很像,如果你对mysql有一定的经验,那么里面的sql写法也类似,比如常见的limit用法,mysql里面主要用limite分页,但是数据多了不建议,很影响效率。 sqlite常用用法函数总结如下: query: //need try catch and db.close();try{cursor…

ADB server didn't ACK

当我们通过eclipse开发Android应用时,会连接真机会使用模拟器进行仿真,有时候启动失败,会提示这样的错误。 工具/原料 Eclipse CMD命令窗口 方法/步骤 首先通过CMD启动adb服务。这个时候会提示启动失败。 服务启动失败的原因有很多&#xff0…

段落排版--行间距, 行高(line-height)

<!DOCTYPE HTML> <html> <head> <meta http-equiv"Content-Type" content"text/html; charsetutf-8"> <title>行间距</title> <style type"text/css">p{line-height:2em;} /*段落行间距为2倍。*/ <…

解析邮件归档技术 保护企业邮件安全(三)

&#xff08;接中集&#xff09;  主持人&#xff1a;我明白你的意思&#xff0c;等于你只是把技术提供给他们&#xff0c;他们来卖和他们平台结合在一起的东西&#xff1f; 梁京伟&#xff1a;对&#xff0c;这种方式更多一些。所以这个是我们更倾向于开发我们技术&#xff0…

android方块密码输入框,Android仿微信/支付宝的方块密码输入框

在用到支付类或者验证类app时&#xff0c;都有一个简密的输入框。百度了下有个不错的帖子点击打开链接不过自己也写了个简单的类似的。不废话了。没图说个席八。懒得运行&#xff0c;直接截layout.xml的效果图先。布局文件android:layout_width"fill_parent"android:…

童鞋,[HttpClient发送文件的技术实践]请查收

昨天有童鞋在群里面问&#xff1a;怎么使用HttpClient发送文件&#xff1f;01荒腔走板之前我写了一个《ABP小试牛刀之上传文件》&#xff0c;主要体现的是服务端&#xff0c;上传文件的动作是由前端小姐姐完成的&#xff0c; 我还真没有用HttpClient编程方式发送过文件。不过Ht…