博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Oracle数据恢复情景2-模拟redo log丢失(3)
阅读量:5939 次
发布时间:2019-06-19

本文共 2296 字,大约阅读时间需要 7 分钟。

hot3.png

在Oracle数据恢复情景2的前两篇中,我模拟的情况都是删除current redo log,基本上都是删除部分的redo logs,如果将DB中的所有redo logs全部删除呢?
DB version: Release 11.2.0.2.0
1.查看online redo logs
SQL> select t1.GROUP#,t1.MEMBER,t1.TYPE,t2.STATUS,t2.bytes from v$logfile t1,v$log t2 where t1.GROUP#=t2.GROUP#;GROUP# MEMBER                                   TYPE     STATUS        BYTES------ ---------------------------------------- -------- -------- ----------     3 /opt/oracle/oradata/ora/redo03.log   ONLINE   CURRENT    52428800     2 /opt/oracle/oradata/ora/redo02.log   ONLINE   INACTIVE   52428800     1 /opt/oracle/oradata/ora/redo01.log   ONLINE   INACTIVE   52428800

2.删除数据
SQL> @del.sqlSQL> select count(1) from UAS.DBA_TEMP1;  COUNT(1)----------     71000

3.移除所有redo logs
$ mv redo0* ..

4.试着日志切换,竟然也执行成功了
SQL> alter system switch logfile;System altered.SQL> alter system switch logfile;System altered.SQL> alter system switch logfile;   --hanging...alter system switch logfile*ERROR at line 1:ORA-01013: user requested cancel of current operation

5.恢复
SQL> alter database clear unarchived logfile group 1;Database altered.SQL> alter database clear unarchived logfile group 3;Database altered.SQL> alter database clear unarchived logfile group 2;

alter database clear unarchived logfile group 2
*
ERROR at line 1:
ORA-01624: log 2 needed for crash recovery of instance ora (thread 1)
ORA-00312: online log 2 thread 1: '/opt/oracle/oradata/ora/redo02.log'
此错误的解决方法是对DB做一下checkpoint:
SQL> ALTER SYSTEM CHECKPOINT GLOBAL;SQL> alter database clear unarchived logfile group 2;Database altered.SQL> alter system switch logfile;System altered.SQL> alter system switch logfile;System altered.SQL> alter system switch logfile;System altered.SQL> select t1.GROUP#,t1.MEMBER,t1.TYPE,t2.STATUS,t2.bytes from v$logfile t1,v$log t2 where t1.GROUP#=t2.GROUP#;GROUP# MEMBER                                   TYPE     STATUS        BYTES------ ---------------------------------------- -------- -------- ----------     3 /opt/oracle/oradata/ora/redo03.log   ONLINE   CURRENT    52428800     2 /opt/oracle/oradata/ora/redo02.log   ONLINE   INACTIVE   52428800     1 /opt/oracle/oradata/ora/redo01.log   ONLINE   INACTIVE   52428800

6.检查数据
SQL> select count(1) from UAS.DBA_TEMP1;  COUNT(1)----------     71000

转载于:https://my.oschina.net/liuliufa/blog/65070

你可能感兴趣的文章
scrollView + tableview 上下滑动失效
查看>>
UVa 10902
查看>>
Mathf.Sin正弦
查看>>
禁止浏览器缓存js
查看>>
【Redis】安装PHP的redis驱动(二)
查看>>
java中string和int互相转化
查看>>
什么是序列化,为什么要序列化
查看>>
Java保留小数点后有效数字
查看>>
CommonHelper
查看>>
excel操作for(lutai)
查看>>
Codeforces Round #162 (Div. 2) C. Escape from Stones
查看>>
2017 Multi-University Training Contest - Team 4 phone call(树+lca+并查集)
查看>>
Struts2文件下载
查看>>
error LNK2019: 无法解析的外部符号 _PhInitializePhLib,该符号在函数 _EnumHandle 中被引用...
查看>>
新学期的合作
查看>>
使用JavaScript获取CSS伪元素属性
查看>>
正则化
查看>>
javascript弹窗
查看>>
结对编程项目作业2-结对编项目设计文档
查看>>
百度地图实现思路--------未实践------未验证
查看>>