--模拟controlfile丢失与重建
----------------------------------------------------------------2013/09/21
1. 关闭数据库。
2. 将controlfile重命名模拟丢失。
[Oracle@localhost august]$ mv control01.ctl control01.ctl_bkp
[Oracle@localhost august]$ mv control02.ctl control02.ctl_bkp
3. 使用rman启动数据库。
RMAN> startup mount;
Oracle instance started
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of startup command at 09/20/2013 20:03:34
ORA-00205: error in identifying control file, check alert log for more info
没有control file只能启动到nomount状态。
 
4. 即使没有控制文件,RMAN还是能识别自己的autobackup目录,可以直接使用下面命令
RMAN> restore controlfile to '/u01/app/oracle/oradata/august/august/control01.ctl' from autobackup;
我们可以也通过直接指定自动备份集来进行恢复。
RMAN> restore controlfile to '/u01/app/oracle/oradata/august/august/control01.ctl' from '/u01/app/oracle/flash_recovery_area/august/AUGUST/autobackup/2013_09_20/o1_mf_s_826618674_93rss9os_.bkp';
 
Starting restore at 20-SEP-13
using channel ORA_DISK_1
 
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 20-SEP-13
 
启动数据库到mount
 
RMAN> alter database mount;
 
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 09/20/2013 20:22:24
ORA-00205: error in identifying control file, check alert log for more info
 
--因为ORACLE这里要求所有的控制的文件都要被一致的恢复,在此数据库中有两份控制文件,我们这里只恢复了一份,它不能识别。这些信息在参数文件中指定好了。
RMAN>  restore controlfile to '/u01/app/oracle/flash_recovery_area/august/august/control02.ctl' from autobackup;
 
Starting restore at 20-SEP-13
using channel ORA_DISK_1
 
recovery area destination: /u01/app/oracle/flash_recovery_area/august
database name (or database unique name) used for search: AUGUST
channel ORA_DISK_1: AUTOBACKUP /u01/app/oracle/flash_recovery_area/august/AUGUST/autobackup/2013_09_20/o1_mf_s_826618674_93rss9os_.bkp found in the recovery area
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20130920
channel ORA_DISK_1: restoring control file from AUTOBACKUP /u01/app/oracle/flash_recovery_area/august/AUGUST/autobackup/2013_09_20/o1_mf_s_826618674_93rss9os_.bkp
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
Finished restore at 20-SEP-13
 
RMAN> alter database mount;
 
database mounted
released channel: ORA_DISK_1
 
恢复另一份控制文件后,就可以正常mount了。
 
或者我们可以直接采用下面这种方式,ORACLE自己决定恢复的目录。
 
RMAN> restore controlfile from '/u01/app/oracle/flash_recovery_area/august/AUGUST/autobackup/2013_09_20/o1_mf_s_826618674_93rss9os_.bkp';
 
Starting restore at 20-SEP-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK
 
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
output file name=/u01/app/oracle/oradata/august/august/control01.ctl
output file name=/u01/app/oracle/flash_recovery_area/august/august/control02.ctl
Finished restore at 20-SEP-13
 
RMAN> alter database mount;
 
database mounted
released channel: ORA_DISK_1
 
由于控制文件恢复,进行数据库恢复,同步文件信息。
 
RMAN> recover database;
 
Starting recover at 20-SEP-13
Starting implicit crosscheck backup at 20-SEP-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK
Crosschecked 3 objects
Finished implicit crosscheck backup at 20-SEP-13
 
Starting implicit crosscheck copy at 20-SEP-13
using channel ORA_DISK_1
Finished implicit crosscheck copy at 20-SEP-13
 
searching for all files in the recovery area
cataloging files...
cataloging done
 
List of Cataloged Files
=======================
File Name: /u01/app/oracle/flash_recovery_area/august/AUGUST/autobackup/2013_09_20/o1_mf_s_826618674_93rss9os_.bkp
 
using channel ORA_DISK_1
/*完成更新同步控制文件中的备份信息*/
starting media recovery
 
archived log for thread 1 with sequence 1 is already on disk as file /u01/app/oracle/oradata/august/august/redo01.log
archived log file name=/u01/app/oracle/oradata/august/august/redo01.log thread=1 sequence=1
media recovery complete, elapsed time: 00:00:09
Finished recover at 20-SEP-13
/*完成介质恢复*/
 
--转储数据文件头文件
SQL> alter session set events 'immediate trace name file_hdrs level 10';
 
*** 2013-09-20 21:06:30.810
DUMP OF DATA FILES: 4 files in database
 
DATA FILE #1:
  name #7: /u01/app/oracle/oradata/august/august/system01.dbf
creation size=0 block size=8192 status=0xe head=7 tail=7 dup=1
 tablespace 0, index=1 krfil=1 prev_file=0
 unrecoverable scn: 0x0000.00000000 01/01/1988 00:00:00
 Checkpoint cnt:105 scn: 0x0000.000d0471 09/20/2013 19:59:32    /*853105 : <1> 845017 --2.8147E+14 1号日志文件*/
 Stop scn: 0x0000.000d0471 09/20/2013 19:59:32
 
--转储新的控制信息
 
-DATABASE
Database checkpoint: Thread=1 scn: 0x0000.000ce4dc /*847180*/
-CHECKPOINT
low cache rba:(0x1.3.0) on disk rba:(0x1.72.0)
on disk scn: 0x0000.000ce57a 09/20/2013 08:17:51  /*845178*/  /*检查点都没有得到更新,数据库还没打开也可以理解*/
-DATAFILE
Checkpoint cnt:105 scn: 0x0000.000d0471 09/20/2013 19:59:32
 Stop scn: 0x0000.000d0471 09/20/2013 19:59:32    /*datafile的信息都同步为最新*/
 
--打开数据库
 
RMAN> alter database open;
 
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of alter db command at 09/20/2013 20:59:08
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
 
RMAN> alter database open noresetlogs;
 
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "identifier": expecting one of: "resetlogs, ;"
RMAN-01008: the bad identifier was: noresetlogs
RMAN-01007: at line 1 column 21 file: standard input
 
--可见即使信息同步了,我们也只能以resetlogs方式打开数据库。这里需要指出常见的几种情况,需要以resetlogs方式打开数据库。
1. 在执行了不完全恢复之后。
2. 在使用了备份的控制文件进行恢复后。
3. 使用带有resetlogs选项创建的控制文件恢复之后。
 
RMAN> alter database open resetlogs;
 
database opened
 
 

模拟controfile丢失与重建的更多相关文章

  1. 模拟数据库丢失undo表空间

    数据库无事务情况下丢失undo表空间数据文件 1. 查看当前undo表空间,并删除物理undo文件 SYS@userdata>show parameter undo_tablespace; NA ...

  2. Oracle主库归档丢失,备库日志有gap,在不重建备库的情况下,恢复备库

    本文主要描述Oracle备库日志与主库日志之间有gap,切主库这部分gap的归档日志已经删除或丢失,如何在不重建备库的情况下,恢复备库. 欢迎转载,请注明作者.出处. 作者:张正 blog:http: ...

  3. ORACLE模拟临时文件、日志成员、口令文件丢失情况与恢复【weber出品】

    一.临时表空间文件.日志文件和口令文件都属于非关键性文件,因为这些文件丢失后并不会影响到整个数据库的完整性. 但是,当这些文件丢失后我们需要快速的找回这些文件.接下来我将模拟临时表空间文件.日志文件和 ...

  4. 【DATAGUARD】物理dg在主库丢失归档文件的情况下的恢复(七)

    [DATAGUARD]物理dg在主库丢失归档文件的情况下的恢复(七) 一.1  BLOG文档结构图 一.2  前言部分 一.2.1  导读 各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到 ...

  5. dataguard 归档丢失(主库中无此丢失归档处理),备库基于SCN恢复

    dataguard 归档丢失(主库中无此丢失归档处理),备库基于SCN恢复 环境: OS: CentOS 6.5 DB: Oracle 10.2.0.5 1.主备库环境 主库: SQL> sel ...

  6. Oracle数据库坏块的恢复

    模拟数据块坏块: 对于发生数据块不一致的数据块,如果当前数据库有备份且处于归档模式,那么就可以利用rman工具数据块恢复功能 对数据块进行恢复,这种方法最简单有效,而且可以在数据文件在线时进行,不会发 ...

  7. 对Oracle数据库坏块的理解

    1.物理坏块和逻辑坏块 在数据库中有一个概念叫做数据块的一致性,Oracle的数据块的一致性包括了两个层次:物理一致性和逻辑一致性,如果一个数据块在这两个层次上存在不一致性,那就对应到了我们今天要要说 ...

  8. 【原】Linux Raid 实验

    本文参照以下两个链接,将实验重做了一遍,目的就是加深印象及提升实操能力 参照链接:http://www.opsers.org/base/learning-linux-the-day-that-the- ...

  9. Redis,Memcache比较

    简单比较: Redis不仅仅支持简单的k/v类型的数据,同时还提供list,set,hash等数据结构的存储.memcache只支持简单的K/V类型数据, 不过memcache可以缓存其他东西如图片, ...

随机推荐

  1. Ionic Demo 解析

    Ionic Demo 解析 index.html 解析 1.引入所需要的类库 <link rel="manifest" href="manifest.json&qu ...

  2. 学习java 的经验

    一.学习java首先应该对他有个全局的看法 ,他由几部分组成 1.java 的基础语法 2.使用Swing 来做桌面应用,可做嵌入式开发. 3.JDBC数据库的链接 4.网络编程,主要是socket编 ...

  3. 数据结构(C语言版)链表相关操作算法的代码实现

    这次实现的是带头结点的单链表的初始化.遍历.创建.插入.删除.判断链表是否为空.求链表长度函数,编译环境是vs2013. 其中插入和删除函数中循环的条件目前还不太明白. #include<ios ...

  4. JS数组例子

    输入10个成绩,求总和,最高和最低 var arr=new Array(97,56,67,56,77,78,67,76,89,98); var sum=0; var minx=100; var max ...

  5. dict-字典功能介绍

    叨逼叨:#字典 可变类型 意思就是修改的是自己本身#可变类型,当修改后,内存里的值也会对应着修改#不可变类型,当修改后,会在内存里开启一块新的空间,放新的值#1.清空 # name = { # 'na ...

  6. js实现图片旋转、模板文件查看图片大图之记录篇[二]

    一个小小的前端需求送给大家,使用js实现图片旋转,并且点击图片能够实现规定格式的大图. 主要使用的是jQuery的delegate()方法实现图片旋转,该方法主要的功能就是给某个组件绑定一个或一组事件 ...

  7. objc[20556]:Class JavaLaunchHelper is implemented in both xxx 警告处理

    今天在Mac上对IntelliJ Idea 进行了升级 升级到2017.01后,运行程序时,出现以下红色警告: objc[20556]: Class JavaLaunchHelper is imple ...

  8. 中缀表达式变后缀表达式、后缀表达式(逆波兰)求值(python版本)

    定义: 中缀表达式: 在通常的表达式中,二元运算符总是置于与之相关的两个运算对象之间,这种表示法也称为中缀表达式 后缀表达式: 又叫逆波兰表达式 ,不包含括号,运算符放在两个运算对象的后面,所有的计算 ...

  9. 华为CloudIDE免费公测,带你出坑带你飞

    你的代码仓库上线了吗?是不是有时候遇到这样的问题? 只想浏览一下代码,却发现线上浏览效果不佳,高亮显示什么的都没有.而在桌面端浏览要需要先同步代码,再用桌面端的IDE打开.尤其是使用git的时候,先要 ...

  10. [信息安全] 3.HTTPS工作流程

    [信息安全]系列博客:http://www.cnblogs.com/linianhui/category/985957.html 0. 简单回顾 在前面两篇博客中介绍了密码相关的一些基本工具,包括(对 ...