--模拟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. VS2015 +Qt5 串口工具

    简单的小工具是VS2015 + Qt5.6.1实现的,界面部分是Qt实现,串口是封装的WinAPI,把串口收发模块封装成了个Serialport.dll 供Qt界面调用. 由于VS2015需要CRT运 ...

  2. 前端解读Webview

    作为盛行已久的开发方式,Hybrid的相关介绍已经是相当普遍了.不过看到博客园里基本上都是从android或者ios的角度来讲解的,对于h5的前端来说看起来只能是一直半解.感觉有必要从前端的角度来理解 ...

  3. 安装 Node 和 gulp

    gulp 是基于 node 实现的,那么我们就需要先安装 node. Node 是一个基于Chrome JavaScript V8引擎建立的一个平台,可以利用它实现 Web服务,做类似PHP的事. 打 ...

  4. c++ new delete 常踩的坑

    WeTest 导读 c++ 是公司开发最常用的语言之一, 那New和Delete 这两个函数是所有开发者即爱又恨的函数.由new 和delete引发的bug , coredump , 让多少程序员加了 ...

  5. 测试框架:使用SONAR分析代码质量

    介绍 Sonar是一个用于代码质量管理的开源平台,用于管理Java源代码的质量.通过插件机制,Sonar 可以集成不同的测试工具,代码分析工具,以及持续集成工具,比如pmd-cpd.checkstyl ...

  6. Vue.js学习笔记(三) - 修饰符

    本篇将简单介绍常用的修饰符. 在上一篇中,介绍了 v-model 和 v-on 简单用法.除了常规用法,这些指令也支持特殊方式绑定方法,以修饰符的方式实现.通常都是在指令后面用小数点“.”连接修饰符名 ...

  7. nodejs 实践:express 最佳实践 (一)

    express 最佳实践 (一) 最近,一直在使用 nodejs 做项目,对 nodejs 开发可以说深有体会. 先说说 nodejs 在业务中的脚色,, 在 web同构 方面, nodejs 的优势 ...

  8. tomcat一个端口配置多个项目

    在server.xml中增加host节点 <Host name="localhost" appBase="webapps" <!--这是默认的--- ...

  9. Oracle 10gR2分析函数

    Oracle 10gR2分析函数汇总 (Translated By caizhuoyi 2008‐9‐19) 说明:  1. 原文中底色为黄的部分翻译存在商榷之处,请大家踊跃提意见:  2. 原文中淡 ...

  10. Oozie安装时放置Mysql驱动包的总结(网上最全)

    不多说,直接上干货! 对于在oozie里放置Mysql驱动包的总结 根据网上的参考以及我个人经验安装的使用 (1)放一份到$OOZIE_HOME/libext下 (是 mysql-connector- ...