OS:

Oracle Linux Server release 5.7

DB:

Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

1.

如何获取数据库的DBID

由于DBID在控制文件和数据文件都存在记录,所以如果能够mount数据库就可以查询v$database视图获得

SQL> select dbid from v$database;

DBID
----------
675362528

SQL>

2.

在nomount状态时

[root@yoon ~]# cd /u01/archivelog/
[root@yoon archivelog]# ls -lr
total 19872
-rw-r----- 1 oracle oinstall 10158080 Sep 15 12:47 c-675362528-20130915-01
-rw-r----- 1 oracle oinstall 10158080 Sep 11 16:20 c-675362528-20130911-01
[root@yoon archivelog]#

这里的675362528就是DBID

3.

连接到RMAN

[oracle@yoon ~]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Sun Sep 15 12:56:09 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.All rights reserved.

connected to target database (not started)

RMAN>

4.

关闭数据库

RMAN> shutdown immediate

database closed
database dismounted
Oracle instance shut down

RMAN>

5.delete controlfile

RMAN> host;

[oracle@yoon ~]$ cd /u01/oracle/oradata/yoon/
[oracle@yoon yoon]$ rm -rf control01.ctl
[oracle@yoon yoon]$

6.由于目标数据库控制文件丢失,在此处必须指定dbid

RMAN> startup nomount

connected to target database (not started)
Oracle instance started

Total System Global Area1653518336 bytes

Fixed Size2228904 bytes
Variable Size956304728 bytes
Database Buffers687865856 bytes
Redo Buffers7118848 bytes

RMAN>

RMAN> set dbid 675362528

executing command: SET DBID

RMAN> restore controlfile from '/u01/archivelog/c-675362528-20130915-01';

Starting restore at 15-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:01
output file name=/u01/oracle/oradata/yoon/control01.ctl
output file name=/u01/oracle/fast_recovery_area/yoon/control02.ctl
Finished restore at 15-SEP-13

RMAN>

RMAN> sql 'alter database mount';

sql statement: alter database mount
released channel: ORA_DISK_1

RMAN>

RMAN> restore database;

Starting restore at 15-SEP-13
Starting implicit crosscheck backup at 15-SEP-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK
Crosschecked 1 objects
Finished implicit crosscheck backup at 15-SEP-13

Starting implicit crosscheck copy at 15-SEP-13
using channel ORA_DISK_1
Finished implicit crosscheck copy at 15-SEP-13

searching for all files in the recovery area
cataloging files...
no files cataloged

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/oracle/oradata/yoon/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/oracle/oradata/yoon/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/oracle/oradata/yoon/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/oracle/oradata/yoon/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/oracle/fast_recovery_area/YOON/backupset/2013_09_15/o1_mf_nnndf_TAG20130915T124630_93bgx6qx_.bkp

channel ORA_DISK_1: piece handle=/u01/oracle/fast_recovery_area/YOON/backupset/2013_09_15/o1_mf_nnndf_TAG20130915T124630_93bgx6qx_.bkp tag=TAG20130915T124630
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:05
Finished restore at 15-SEP-13

RMAN>

RMAN> recover database;

Starting recover at 15-SEP-13
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 1 is already on disk as file /u01/oracle/oradata/yoon/redo01.log
archived log file name=/u01/oracle/oradata/yoon/redo01.log thread=1 sequence=1
media recovery complete, elapsed time: 00:00:00
Finished recover at 15-SEP-13

RMAN>

RMAN> sql 'alter database open resetlogs';

sql statement: alter database open resetlogs

RMAN>

注意:because of‘resetlogs',建议立即对数据库进行一次全备

RMAN - "丢失控制文件的恢复"的更多相关文章

  1. RMAN备份之丢失数据文件及控制文件的恢复

    About Recovery with a Backup Control FileIf all copies of the current control file are lost or damag ...

  2. RMAN数据库恢复之丢失数据文件的恢复

    删除某一数据文件:SQL> HOST del D:\app\Administrator\oradata\orcl\USERS01.dbf 启动数据库,提示丢失数据文件4,此时数据库处理MOUNT ...

  3. Oracle DB备份恢复篇之丢失控制文件

    实验目的 本篇主要模拟控制文件丢失后,如何根据实际情况恢复数据库,才能使数据库尽可能不丢失数据. 实验环境 1)Linux系统环境 [oracle@DG1 ~]$ lsb_release -a LSB ...

  4. RMAN数据库恢复 之归档模式有(无)备份-丢失数据文件的恢复

    1.归档模式有备份,丢失数据文件的恢复归档模式有备份,不管丢失什么数据文件,直接在RMAN下RESTOER--->RECOVER--->OPEN即可. RMAN> STARUP MO ...

  5. rman备份控制文件

    rman备份控制文件分为两种情况. 1.自动备份需要配置configure controlfile autobackup on配置之后,控制文件和spfile会在每次rman备份之后自动备份contr ...

  6. 使用RMAN对控制文件进行restore

    控制文件的默认备份格式是: c-IIIIIIIIII-YYYYMMDD-QQ 其中: c:表示控制文件 IIIIIIIIII:表示DBID YYYYMMDD:备份的时间戳 QQ:16进制的序列号,从0 ...

  7. 使用RMAN对数据文件进行恢复

    (1)备份数据库 在使用RMAN进行数据库恢复之前,先用RMAN进行全库备份 [oracle@redhat6 ~]$ rman target / Recovery Manager: Release : ...

  8. oracle 备份恢复篇(五)---rman 剩下控制文件和spfile

    一,环境准备 ❤ 拥有全量备份文件

  9. RMAN数据库恢复之控制文件和参数文件恢复

    一.控制文件的恢复1.查询控制文件的路径 SQL> SELECT * FROM V$CONTROLFILE; STATUS NAME IS_RECOVERY_DEST_FILE BLOCK_SI ...

随机推荐

  1. It English 每日更新

    unary operator 一元运算符 short circuit evaluation 短路经查询

  2. 三方框架之masonry

    这个详细的介绍:http://www.cocoachina.com/ios/20141219/10702.html Masonry 源码:https://github.com/Masonry/Maso ...

  3. OSGI.NET 插件启动方法

    在使用OSGI.NET框架来开发插件过程中,有时为了测试一个插件,或运行一个插件,需要启动主个插件,如果没有主窗口程序,那么该 如何启动一个插件,而不是再开发一个主窗口程序(那样是不是太麻烦,仅仅是为 ...

  4. 洛谷P2733 家的范围 Home on the Range

    P2733 家的范围 Home on the Range• o 26通过o 61提交• 题目提供者该用户不存在• 标签USACO• 难度普及+/提高 提交 讨论 题解 最新讨论• 暂时没有讨论题目背景 ...

  5. 洛谷P2085 最小函数值(minval)

    P2085 最小函数值(minval) 218通过 487提交 题目提供者该用户不存在 标签堆高级数据结构 难度普及+/提高 提交该题 讨论 题解 记录 最新讨论 暂时没有讨论 题目描述 有n个函数, ...

  6. C++异常:no matching function for call to "Matrix(Matrix&)"

    C++异常:no matching function for call to "Matrix(Matrix&)" 我定义了一个类叫Matrix,其中构造函数explicit ...

  7. ionic pull to refresh 下拉更新頁面

    有些項目都用到了下拉更新頁面的效果: 1. 在index.html 中添加ion-refresher 指令 且在我們需要更新內容的外面 添加 如 <ion-refresher pulling-t ...

  8. ionic cordova file download and load

    1.先添加插件 cordova plugin add org.apache.cordova.file cordova plugin add org.apache.cordova.file-transf ...

  9. spring注解 构造函数问题

    因为类首先被Spring实例化的时候,会调用构造函数.只有实例化后,才会注入.你等于没注入就调用了,所以报错. 把DAO实现类注入到service实现类中,把service的接口(注意不要是servi ...

  10. 关于Oracle的rac集群和mysql Galera Cluster的想法

    到了新公司,公司用的是rac,我比较熟悉mysql第三方的集群方案Galera Cluster这类多主集群, 下面是我参考了他人对rac的介绍,然后和mysql方案进行的臆测级别的分析对比. rac和 ...