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. Google Protocol Buffer 的编码方式

    Google Protocol Buffer 使用到了两种编码方式:Varints 和 zigzag. 一 Varints 编码 每个 byte 只用 7bit 表示数字,最高位 bit作为标志位,如 ...

  2. 学习记录 java 哈希

    哈希表(Hash Table,又叫散列表),是存储键值对(Key-value)的表,之所以不叫它Map(键值对一起存储一般叫做Map),是因为它下面的特性:它能把关键码(key)映射到表中的一个位置来 ...

  3. 洛谷P1218 [USACO1.5]特殊的质数肋骨 Superprime Rib

    P1218 [USACO1.5]特殊的质数肋骨 Superprime Rib 284通过 425提交 题目提供者该用户不存在 标签USACO 难度普及- 提交  讨论  题解 最新讨论 超时怎么办? ...

  4. noip2008 火柴棒等式

    P1149 火柴棒等式 1.9K通过 3.7K提交 题目提供者该用户不存在 标签搜索/枚举模拟2008NOIp提高组 难度普及- 提交该题 讨论 题解 记录   题目描述 给你n根火柴棍,你可以拼出多 ...

  5. DNS协议 实践

    根据DNS协议发送UDP请求,然后获取IP地址 头文件: #ifndef __DNS__ #define __DNS__ #include <stdio.h> #include <s ...

  6. c#中如何得到百分比数值

    //此方法得到的百分比后小数太多,不行double percent=Convert.ToDouble(2)/Convert.ToDouble(34);string result=(percent*10 ...

  7. .Net 乱序方法

    前两天开发一个奇葩的功能,突然间想到了用打乱顺序的方式解决.记录代码如下: /// <summary> /// 把收集回来的列表打乱顺序之后返回 /// </summary> ...

  8. leetcode 101

    101. Symmetric Tree Given a binary tree, check whether it is a mirror of itself (ie, symmetric aroun ...

  9. leetcode 19

    最开始用一般的方法,首先遍历链表求出长度,进而求出需要删除节点的位置,最后进行节点的删除. 代码如下: /** * Definition for singly-linked list. * struc ...

  10. aspx网页相对布局

    网页的布局 <body bgcolor="#b6b7bc"> <form id="form1" runat="server" ...