--模拟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. RADIUS and IPv6[frc-3162译文]

    如今项目中需要涉及到RADIUS及IPv6的使用,而网络中的资料相对较少,现对frc-3162进行中文翻译,分享出来. 由于英语水平有限,翻译不恰当的地方,还请提出,便于在下及时修改. 原文链接 这份 ...

  2. Git恢复指定文件

    Git恢复指定文件 修改这个文件的commit有哪些? git log -- <文件路径> 猜测需要还原的commit. 这个文件作了哪些更改? git diff <需要还原的com ...

  3. Maven学习专题--Maven入门及安装

    因为项目需要,新项目需要使用Maven开发,但是组内大部分没有接触过maven.我就毅然承担搭建maven环境的任务了.因为一切重头开始,就想把自己的整个搭建环境.项目创建.框架整合和模块管理整个过程 ...

  4. Eclipse工程有乱码

    处理:把整个工程的“Text file encoding”属性设为GBK,就不会有乱码了.设置方法:在eclipse中右击工程,点击弹出框最下面的“Properties”,然后在弹出的窗口左侧点击“R ...

  5. 包装类、数组、string类浅析及练习

    String s1 = "abc"; String s2 = "abc"; System.out.println(s1==s2); //返回true Strin ...

  6. 扩展SQLite使其能从apk文件中读取db

    游戏中会大量使用到配置文件,每个项目组根据自己不同的需求会选择不同的存储格式,比如使用Json或者SQLite来存储数据.此处我们只对使用SQLite的情况来做讨论.一般情况下会选择把它放在可读写目录 ...

  7. ES6中的箭头函数

    关于函数表达式中的this:自动引用正在调用当前方法的.前的对象1.obj.fun()中的this fun中的this -> obj2.new Fun() Fun中的this -> 正在创 ...

  8. 解决win10注册错误 错误代码0x8002801c

    使用win10的过程中经常碰到各种注册错误,让人抓狂!!! 现在分享一个完美的解决方法(非原创): 最简洁的办法是:1.自行将msinet.ocx(win10系统64位)组件复制到C:\Windows ...

  9. [Android]Android内存泄漏你所要知道的一切(翻译)

    以下内容为原创,欢迎转载,转载请注明 来自天天博客:http://www.cnblogs.com/tiantianbyconan/p/7235616.html Android内存泄漏你所要知道的一切 ...

  10. hadoop环境中误删除tmp文件夹的恢复

    情景描述: 种种原因,不小心把系统根目录中的tmp文件删除了!发现jps之后看不到 master主机上面的namenode,resourcemanager,secondarynamenode三个进程了 ...