(Les16 执行数据库恢复)-重做日志文件恢复
恢复步骤:1.确定是否有缺失的日志文件2.恢复丢失的文件时,先删除丢失的重做日志成员ALTER DATABASE DROP LOGFILE MEMBER '+DATA/orcl/onlinelog/group_1.261.691672257';3.然后添加新成员来替代丢失的日志成员ALTER DATABASE ADD LOGFILE MEMBER '+DATA' TO GROUP 2;4.如果介质故障是由于磁盘或控制器缺失而造成的,需重命名丢失文件。5.如果重做日志组已归档,或者处于NOARCHIVELOG模式下,则可选择在清除日志组后重新创建缺失来解决问题,ALTER DATABASE CLEAR LOGFILE GROUP n;注意:清除未归档的日志组,应立即对整个数据库执行完全备份,否则,在发生其它故障的情况下,会导致数据丢失。ALTER DATABASE CLEAR UNARCHIVED LOGFILE GROUP #;
alter database add logfile group 4 ('/u01/app/oracle/oradata/xiocpt0/p_redo04_01.log','/u01/app/oracle/oradata/xiocpt0/p_redo04_02.log') size 128M;
alter database add logfile group 5 ('/u01/app/oracle/oradata/xiocpt0/p_redo05_01.log','/u01/app/oracle/oradata/xiocpt0/p_redo05_02.log') size 128M;
alter database add logfile group 6 ('/u01/app/oracle/oradata/xiocpt0/p_redo06_01.log','/u01/app/oracle/oradata/xiocpt0/p_redo06_02.log') size 128M;
SQL> set pagesize 600 select group#,sequence#,bytes/(1024*1024),members,archived,status from v$log;--查看重做日志成员状态信息 col member format a50 SQL> SQL>
GROUP# SEQUENCE# BYTES/(1024*1024) MEMBERS ARC STATUS
---------- ---------- ----------------- ---------- --- ----------------
1 4 50 1 YES INACTIVE
2 5 50 1 NO CURRENT
3 3 50 1 YES INACTIVE
4 0 128 2 YES UNUSED
5 0 128 2 YES UNUSED
6 0 128 2 YES UNUSED 6 rows selected. SQL> select group#,status,member from v$logfile;--查看重做日志成员,物理路径,这里存储方式为文件系统 GROUP# STATUS MEMBER
---------- ------- --------------------------------------------------
1 STALE /u01/app/oracle/oradata/xiocpt0/redo01.log
3 STALE /u01/app/oracle/oradata/xiocpt0/redo03.log
2 /u01/app/oracle/oradata/xiocpt0/redo02.log
4 /u01/app/oracle/oradata/xiocpt0/p_redo04_01.log
4 /u01/app/oracle/oradata/xiocpt0/p_redo04_02.log
5 /u01/app/oracle/oradata/xiocpt0/p_redo05_01.log
5 /u01/app/oracle/oradata/xiocpt0/p_redo05_02.log
6 /u01/app/oracle/oradata/xiocpt0/p_redo06_01.log
6 /u01/app/oracle/oradata/xiocpt0/p_redo06_02.log 9 rows selected. 手动删除group 1的物理文件 SQL> !rm /u01/app/oracle/oradata/xiocpt0/redo01.log group 1的状态以归档,INACTIVE SQL> select group#,sequence#,bytes/(1024*1024),members,archived,status from v$log; GROUP# SEQUENCE# BYTES/(1024*1024) MEMBERS ARC STATUS
---------- ---------- ----------------- ---------- --- ----------------
1 4 50 1 YES INACTIVE
2 5 50 1 NO CURRENT
3 3 50 1 YES INACTIVE
4 0 128 2 YES UNUSED
5 0 128 2 YES UNUSED
6 0 128 2 YES UNUSED 6 rows selected. 验证物理文件已被删除 SQL> !ls -l /u01/app/oracle/oradata/xiocpt0/redo01.log
ls: cannot access /u01/app/oracle/oradata/xiocpt0/redo01.log: No such file or directory 针对已归档的重做日志文件组,可以使用clear命令进行恢复 alter database clear logfile group 1; SQL> alter database clear logfile group 1; Database altered. 验证物理文件已恢复完成 SQL> !ls -l /u01/app/oracle/oradata/xiocpt0/redo01.log
-rw-r----- 1 oracle dba 52429312 May 22 13:42 /u01/app/oracle/oradata/xiocpt0/redo01.log
SQL> select group#,sequence#,bytes/(1024*1024),members,archived,status from v$log; GROUP# SEQUENCE# BYTES/(1024*1024) MEMBERS ARC STATUS
---------- ---------- ----------------- ---------- --- ----------------
1 6 50 1 YES INACTIVE
2 5 50 1 YES INACTIVE
3 3 50 1 YES INACTIVE
4 7 128 2 YES INACTIVE
5 8 128 2 YES INACTIVE
6 9 128 2 NO CURRENT 删除group 5中的 02成员 SQL> !ls -l /u01/app/oracle/oradata/xiocpt0/p_redo05_02.log
-rw-r----- 1 oracle dba 134218240 May 22 13:42 /u01/app/oracle/oradata/xiocpt0/p_redo05_02.log SQL> !rm /u01/app/oracle/oradata/xiocpt0/p_redo05_02.log SQL> !ls -l /u01/app/oracle/oradata/xiocpt0/p_redo05_02.log
ls: cannot access /u01/app/oracle/oradata/xiocpt0/p_redo05_02.log: No such file or directory SQL> alter system switch logfile; System altered.
SQL> /
SQL> /
SQL> /
SQL> / SQL> alter system checkpoint; System altered. oracle预警日志文件中提示/u01/app/oracle/oradata/xiocpt0/p_redo05_02.log以不存在,因为重做日志group 5有2个成员,数据依旧正常。 Errors in file /u01/app/oracle/diag/rdbms/xiocpt0/xiocpt0/trace/xiocpt0_arc0_1460.trc:
ORA-00313: open failed for members of log group 5 of thread 1
ORA-00312: online log 5 thread 1: '/u01/app/oracle/oradata/xiocpt0/p_redo05_02.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/xiocpt0/xiocpt0/trace/xiocpt0_arc0_1460.trc:
ORA-00313: open failed for members of log group 5 of thread 1
ORA-00312: online log 5 thread 1: '/u01/app/oracle/oradata/xiocpt0/p_redo05_02.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory 对group有多个成员的,单成员进行修复 alter database drop logfile member '/u01/app/oracle/oradata/xiocpt0/p_redo05_02.log'; alter database add logfile member '/u01/app/oracle/oradata/xiocpt0/p_redo05_02.log' to group 5; 先将丢失的成员从group中进行删除
SQL> alter database drop logfile member '/u01/app/oracle/oradata/xiocpt0/p_redo05_02.log'; Database altered. SQL> select group#,sequence#,bytes/(1024*1024),members,archived,status from v$log; GROUP# SEQUENCE# BYTES/(1024*1024) MEMBERS ARC STATUS
---------- ---------- ----------------- ---------- --- ----------------
1 12 50 1 YES INACTIVE
2 11 50 1 YES INACTIVE
3 16 50 1 NO CURRENT
4 13 128 2 YES INACTIVE
5 14 128 1 YES INACTIVE
6 15 128 2 YES INACTIVE 6 rows selected. 再新增成员
SQL> alter database add logfile member '/u01/app/oracle/oradata/xiocpt0/p_redo05_02.log' to group 5; Database altered. SQL> select group#,sequence#,bytes/(1024*1024),members,archived,status from v$log; GROUP# SEQUENCE# BYTES/(1024*1024) MEMBERS ARC STATUS
---------- ---------- ----------------- ---------- --- ----------------
1 12 50 1 YES INACTIVE
2 11 50 1 YES INACTIVE
3 16 50 1 NO CURRENT
4 13 128 2 YES INACTIVE
5 14 128 2 YES INACTIVE
6 15 128 2 YES INACTIVE 6 rows selected. 也可以对整个group 进行clear,但需注意此group 必须已归档 SQL> !rm /u01/app/oracle/oradata/xiocpt0/p_redo05_02.log SQL> !ls -l /u01/app/oracle/oradata/xiocpt0/p_redo05_02.log
ls: cannot access /u01/app/oracle/oradata/xiocpt0/p_redo05_02.log: No such file or directory SQL> alter database clear logfile group 5; Database altered. SQL> !ls -l /u01/app/oracle/oradata/xiocpt0/p_redo05_02.log
-rw-r----- 1 oracle dba 134218240 May 22 13:51 /u01/app/oracle/oradata/xiocpt0/p_redo05_02.log
SQL> select group#,sequence#,bytes/(1024*1024),members,archived,status from v$log; GROUP# SEQUENCE# BYTES/(1024*1024) MEMBERS ARC STATUS
---------- ---------- ----------------- ---------- --- ----------------
1 12 50 1 YES INACTIVE
2 11 50 1 YES INACTIVE
3 16 50 1 NO CURRENT
4 13 128 2 YES INACTIVE
5 0 128 2 YES UNUSED
6 15 128 2 YES INACTIVE 6 rows selected. SQL>
SQL> select group#,status,member from v$logfile; GROUP# STATUS MEMBER
---------- ------- --------------------------------------------------
1 /u01/app/oracle/oradata/xiocpt0/redo01.log
3 /u01/app/oracle/oradata/xiocpt0/redo03.log
2 /u01/app/oracle/oradata/xiocpt0/redo02.log
4 /u01/app/oracle/oradata/xiocpt0/p_redo04_01.log
4 /u01/app/oracle/oradata/xiocpt0/p_redo04_02.log
5 /u01/app/oracle/oradata/xiocpt0/p_redo05_01.log
5 /u01/app/oracle/oradata/xiocpt0/p_redo05_02.log
6 /u01/app/oracle/oradata/xiocpt0/p_redo06_01.log
6 /u01/app/oracle/oradata/xiocpt0/p_redo06_02.log 9 rows selected. SQL> !rm -rf /u01/app/oracle/oradata/xiocpt0/redo03.log SQL> !ls -l /u01/app/oracle/oradata/xiocpt0/redo03.log
ls: cannot access /u01/app/oracle/oradata/xiocpt0/redo03.log: No such file or directory SQL> alter system switch logfile; System altered. SQL> alter system checkpoint; System altered. SQL> alter database clear unarchived logfile group 3; Database altered. SQL> select group#,status,member from v$logfile; GROUP# STATUS MEMBER
---------- ------- --------------------------------------------------
1 /u01/app/oracle/oradata/xiocpt0/redo01.log
3 /u01/app/oracle/oradata/xiocpt0/redo03.log
2 /u01/app/oracle/oradata/xiocpt0/redo02.log
4 /u01/app/oracle/oradata/xiocpt0/p_redo04_01.log
4 /u01/app/oracle/oradata/xiocpt0/p_redo04_02.log
5 /u01/app/oracle/oradata/xiocpt0/p_redo05_01.log
5 /u01/app/oracle/oradata/xiocpt0/p_redo05_02.log
6 /u01/app/oracle/oradata/xiocpt0/p_redo06_01.log
6 /u01/app/oracle/oradata/xiocpt0/p_redo06_02.log 9 rows selected. SQL> !ls -l /u01/app/oracle/oradata/xiocpt0/redo03.log
-rw-r----- 1 oracle dba 52429312 May 22 13:52 /u01/app/oracle/oradata/xiocpt0/redo03.log
(Les16 执行数据库恢复)-重做日志文件恢复的更多相关文章
- oracle重做日志文件硬盘坏掉解决方法
rman target/ list backup; list backup summary; 删除数据库数据文件夹下的log日志,例如/u01/app/oracle/oradata/ORCL下的所有后 ...
- 初识oracle重做日志文件
转自 http://blog.csdn.net/indexman/article/details/7746948 以下易容翻译自oracle dba官方文档,不足之处还望指出. 管理重做日志文件 学习 ...
- 利用日志文件恢复MYSQL数据库
利用日志文件恢复MYSQL数据库 650) this.width=650;" onclick='window.open("http://blog.51cto.com/viewpic ...
- RMAN数据库恢复之恢复归档日志文件
恢复归档日志文件如果只是为了在恢复数据文件之后应用归档文件,那并不需要手动对归档文件进行恢复,RMAN会在RECOVER时自动对适当的归档进行恢复.单独恢复归档文件一般是有特别的需求,如创建了Data ...
- Oracle重做日志文件
一.联机重做日志的规划管理 1.联机重做日志 记录了数据的所有变化(DML,DDL或管理员对数据所作的结构性更改等) 提供恢复机制(对于意外删除或宕机利用日志文件实现数据恢复) 可以被分组管理 11 ...
- Oracle 联机重做日志文件(ONLINE LOG FILE)
--========================================= -- Oracle 联机重做日志文件(ONLINE LOG FILE) --================== ...
- Oracle数据库体系结构(6)数据库归档重做日志文件管理
归档重做日志文件的概念和选择 Oracle数据库能够把已经写满了的重做日志文件保存到一个或多个指定的离线位置,这种保存的文件为归档重做日志文件.通常情况下一个归档重做日志时一个被LGWR写满的重做日志 ...
- ORACLE 移动数据文件 控制文件 重做日志文件
ORACLE数据库有时候需要对存储进行调整,增加分区.IO调优等等,此时需要移动数据文件.重做日志文件.控制文件等等,下文结合例子总结一下这方面的知识点. 进行数据文件.重做日志文件.控制文件的迁移前 ...
- ORACLE - 管理重做日志文件
ORACLE重做日志文件用于在数据库崩溃等情况下用于恢复数据,默认情况下为三个文件redo01.log/redo02.log/redo03.log,文件组循环使用,在录入与更新操作比较多的应用中,日志 ...
随机推荐
- APM飞控系统详细介绍
APM飞控系统详细介绍2013-04-05 12:28:24 来源: 评论:2 点击:10303 APM飞控系统是国外的一个开源飞控系统,能够支持固定翼,直升机,3轴,4轴,6轴飞行器.在此我 ...
- Android Editable
在android的sdk中有讲,“This is the interface for text whose content and markup can be changed (as opposed ...
- Qt初学——我的第一个UI
第一次打开Qt的时候,我是一脸懵逼的.没学过c++,里面的程序都看不懂.按照套路,我开始看教程,上手实践.连着搞了3天之后,我开始渐渐明白怎么写UI. 我现在的理解是:UI = 界面设计 + 信号槽响 ...
- maven(18)-mybatis generator插件
generator的作用 使用mybatis框架,在初始项目或修改数据库时,相应的要在JAVA项目中去写一些数据模型文件,DAO,映射XML等配置,而这个插件的作用就是自动生成这些文件,以节省大 ...
- Linux虚拟机将ip改为自定义模式网络
查看当前ip:ifconfig 配置linux的ip地址:vi /etc/sysconfig/network-scripts/ifcfg-ens33 BOOTPROTO="dhcp" ...
- 传递给数据库 'model' 中的日志扫描操作的日志扫描号无效
状况描述:在服务器的管理中重新启动MSSQLSERVER启动后马上又停止 通过"事件查看器" 发现 错误: ,严重度: ,状态: LSN(::)无效.该 LSN 是传递给数据库 ...
- 定义类/实例(Class)
# -*- coding: UTF-8 -*- class pp(): '''Description''' def __init__(self,name): #初始化函数 self.nam ...
- Excel操作之级联菜单
设置级联菜单主要用的是excel的数据验证功能.下面以简单的设置城市选择框为例: 1.准备好数据 2.给所有省份起个名称(例如:省份),然后同样方法给每个省份所对应的城市以其省份命名,(例如:南京.苏 ...
- Druid学习---配置_DruidDataSource参考配置
[更多参考]https://www.cnblogs.com/niejunlei/p/5977895.html 配置_DruidDataSource参考配置 以下是一个参考的连接池配置: <bea ...
- SSH服务登陆验证
ssh服务登陆验证有两种方式: 1.基于用户名和密码 2.基于密钥 基于用户名和密码验证过程: 1)客户端想ssh服务器发起请求,服务器会把自己的公钥发送给客户端, 2)客户端用服务器的公钥加密自己的 ...