`

使用RMAN恢复完全损坏的数据库

 
阅读更多
The purpose of this article is to describe how to recover a database from a total failure using RMAN 8i.

This article is meant to assist you in performing an incomplete recovery after losing all datafiles, online redo logs, and control files.

You need Oracle Services for the database and an init.ora file. Additionally, if you have archive logs that have not been cataloged, you will be able to use them as part of the recovery.

1.RESTORE CONTROLFILE

set ORACLE_SID=PROD
svrmgr> connect internal
svrmgr> startup nomount pfile=<init.ora>
svrmgr> Exit

set ORACLE_SID=PROD
RMAN TARGET INTERNAL/password CATALOG rman/rman@rcat

RMAN> run {
allocate channel c1 type disk;
restore controlfile;
alter database mount;
release channel c1;
}

2.QUERY TARGET AND CATALOG DATABASE

Connect to the catalog database and issue the following:

set ORACLE_SID=RCAT
svrmgr> connect rman/rman
svrmgr>
select sequence#, thread#, low_scn, next_scn from rlh;

SEQUENCE# THREAD# LOW_SCN NEXT_SCN
---------- ---------- ---------- ----------
188 1 37278
189 1 37891
190 1 38231
191 1 38319
192 1 38389
193 1 38468
194 1 38562
195 1 38649
196 1 38708
197 1 38844

Note the last SCN is 197. This is the last System Change Number that the RMAN catalog is aware of.

Now connect to the target database:

set ORACLE_SID=PROD
svrmgr> connect internal
svrmgr> select * from v$log_history

RECID STAMP THREAD# SEQUENCE# FIRST_CHANGE# FIRST_TIM NEXT_CHANGE#
---------- ---------- ---------- ---------- - ------------ --------- ------------
188 410011317 1 188 & 37278
189 410011323 1 189 & 37891
190 410011328 1 190 & 38231
191 410011332 1 191 & 38319
192 410011338 1 192 & 38389
193 410011341 1 193 & 38468
194 410011345 1 194 & 38562
195 410011349 1 195 & 38649
196 410011352 1 196 & 38708
197 410011551 1 197 & 38844

Since the database has been mounted using a backup control file, the last Log Sequence Number that the control file is aware of is 197. This happens to match the last LSN known by the catalog because a resync has not been performed since the last backup. But if you look in the archive dump destination, you may see additional archive logs that have not been cataloged. You need to catalog these files so that RMAN can use them during the recovery.

Directory of D:/ORACLE/oradata/PROD/archive

0/03/00 11:46a <DIR> .
0/03/00 11:46a <DIR> ..
0/03/00 12:09p 11,264 PRODT001S00198.ARC
0/03/00 12:09p 11,264 PRODT001S00199.ARC
0/03/00 12:09p 1,024 PRODT001S00200.ARC
0/03/00 12:09p 1,024 PRODT001S00201.ARC

3. MANUALLY CATALOG ANY INTERMEDIATE ARCHIVED LOGS

Archive logs 198 through 201 are available but have not been recorded in the catalog.
Perform the following for each available archive log:

set ORACLE_SID=PROD
RMAN TARGET INTERNAL/password CATALOG rman/rman@rcat
RMAN> catalog archivelog 'd:/oracle/oradata/prod/archive/PRODT001S00198.ARC';

4. RESTORE AND RECOVER DATABASE

The last archive log available has a log sequence number of 201, so you can perform an incomplete recovery using logs up to and including PRODT001S00201.ARC.

RMAN> run {
allocate channel c1 type disk;
set until logseq 201 thread 1;
restore database;
recover database;
release channel c1;
sql "alter database open resetlogs";
}

5. RESET THE DATABASE

Before you can use RMAN again with a target database that has been opened with the RESETLOGS option, you must notify RMAN that you have reset the database incarnation. The reset database command directs RMAN to create a new database incarnation record in the recovery catalog.

RMAN> reset database;
RMAN> List Incarnation of database;

List of Database Incarnations
DB Key Inc Key DB Name DB ID CUR Reset SCN Reset Time
------- ------- -------- ---------------- ---- ------------ ------------
1 2 PROD 4116816026 NO 1 03-OCT-00
1 429 PROD 4116816026 YES 38872 03-OCT-00

6. BACKUP DATABASE

Immediately backup the database. Because the database is a new incarnation, the pre-RESETLOG backups are not usable. Prior to running the backup, remove the old archive log file from the archive dump destination.

RMAN> run {
shutdown immediate;
startup mount pfile=<init.ora>;
allocate channel c1 type disk format 'e:/oracle/oradata/backup/df_%d_%p_%c_%s';
backup database;
release channel c1;
allocate channel c1 type disk format 'e:/oracle/oradata/backup/archive/al_%d_%s_%c';
backup (archivelog all delete input);
sql 'alter database open';
release channel c1;
}
分享到:
评论

相关推荐

    rman的概述及其体系结构

    rman是一种用于集备份(backup)、还原(restore)和恢复(recover)数据库于一体的Oracle 工具,支持命令行及图形界面操作 能够备份整个数据库、表空间、数据文件、控制文件、归档文件以及Spfile参数文件。 支持增量...

    利用RMAN修改损坏的数据块

    当数据库在运行过程中出现坏块时,数据库可以在打开状态下可以使用RMAN来恢复,但是数据库必须是归档模式,同时必须有该块数据文件的备份以及所有的归档日志才能进行恢复

    RMAN测试演练即讲解

    (5) 进入rman使用restore和recover恢复表空间 restore tablespace apollo_data; recover tablespace apollo_data; 备注:从(4)、(5)开始的执行都没有成功,因为drop表空间后即使在系统表里 面也不再有改表...

    Oracle9i灾难恢复详细步骤 pdf

    编写本篇文档的目的是当Oracle9i 数据库出现灾难时怎样使用有效备份来进行数据库的不完全恢复。 二、本文档适合情况 1. 服务器崩溃,例如所有硬盘损坏、存储损坏,造成数据库崩溃,丢失所有数据 2. 有 datafile、...

    Oracle数据库实验操作

    实验128:rman的数据库不完全恢复 214 实验129:rman的数据库副本管理 214 实验130:rman的备份管理 214 第六部分数据库的优化 216 采集数据 216 实验131:优化工具utlbstat/utlestat的使用 216 实验132:优化工具...

    oracle10g课堂练习II(2)

    使用 RMAN 执行不完全恢复 5-20 使用 RMAN 的基于时间的恢复:示例 5-21 使用 RMAN 的日志序列恢复:示例 5-23 使用 Oracle Enterprise Manager 的不完全恢复 5-24 不完全备份和预警日志 5-25 还原点 5-26 不...

    Oracle四大宝典之三:Oracle备份与恢复 中文版

    任何数据库在长期使用过程中,都会存在一定的安全隐患。对于数据库管理员来说不能仅寄希望于计算机操作系统的安全运行,而是要建立一整套的数据库备份与恢复机制。...第七章 RMAN恢复 第八章 备份恢复示例

    oracle10g课堂练习II(1)

    使用 RMAN 执行不完全恢复 5-20 使用 RMAN 的基于时间的恢复:示例 5-21 使用 RMAN 的日志序列恢复:示例 5-23 使用 Oracle Enterprise Manager 的不完全恢复 不完全备份和预警日志 5-25 还原点 5-26 不完全...

    Oracle数据库不同损坏级别的恢复教程

    在 DBA 的日常工作中不可避免存在着数据库的损坏,本文将主要介绍 Oracle 数据库遇到不同损坏级别下的应该采用的恢复方法,供读者在遇到此类情景时,能的找到适合自己的恢复方法,提高工作效率。 数据块损坏的恢复 ...

    构建最高可用Oracle数据库系统 Oracle 11gR2 RAC管理、维护与性能优化

    12.3.3 RMAN恢复需要的文件 12.3.4 RMAN通道 12.4 RMAN备份介质 12.4.1备份集与备份片 12.4.2镜像拷贝 12.5 RMAN备份方式 12.5.1完全备份 12.5.2增量备份 12.5.3合并备份 12.6 RMAN备份命令 12.6.1永久参数...

    ORACLE 常用手册导入导出

    由于对数据库所做的全部改动就保存在日志文件中,如果因为包括介质失效在内的某种失效而导致数据库文件丢失的话,可以利用物理备份和归档日志完全恢复数据库,不会丢失任何数据。所有已经提交的事务都可以查到。 ·...

    OCPOCA认证考试指南全册:Oracle Database 11g(1Z0-051,1Z0-052,1Z0-053)--详细书签版(第2/2部分)

    2.4.2 使用DBCA创建一个数据库 63 2.4.3 DBCA 创建的脚本和其他文件 67 2.4.4 DBCA的其他功能 73 2.5 本章知识点回顾 74 2.6 自测题 75 2.7 自测题答案 78 第3章 实例管理 81 3.1 设置数据库初始化参数 82 ...

    OCPOCA认证考试指南全册:Oracle Database 11g(1Z0-051,1Z0-052,1Z0-053)--详细书签版(第1/2部分)

    2.4.2 使用DBCA创建一个数据库 63 2.4.3 DBCA 创建的脚本和其他文件 67 2.4.4 DBCA的其他功能 73 2.5 本章知识点回顾 74 2.6 自测题 75 2.7 自测题答案 78 第3章 实例管理 81 3.1 设置数据库初始化参数 82 ...

    ORACLE之常用FAQ V1.0(整理)

    [Q]怎么样创建RMAN恢复目录 31 [Q]怎么样在恢复的时候移动数据文件,恢复到别的地点 32 [Q]怎么从备份片(backuppiece)中恢复(restore)控制文件与数据文件 32 [Q]Rman的format格式中的%s类似的东西代表什么意义 33 ...

    oracle恢复工具-FY_Recover_Data

    由于在System表空间中已经记录了新的信息, 因此用当前的System信息是不能恢复过来的,在AUL/MyDUL中可以当作没有System时的情况来处理,在下面的命令中, 我们用Truncate后的数据对象号就不能进行恢复, 而使用Truncate...

    Oracle备份与还原技术文档

    为了能够最大限度地恢复数据库数据,保证数据库的安全运行,应该选择最合理的备份方法来防止各种故障所导致的用户数据丢失,本次主要介绍三种备份恢复技术,即RMAN技术、数据泵技术及闪回技术。

    Oracle9i的init.ora参数中文说明

    默认值: nls_length_semantics 的数据库字符集的字符所使用的度量单位。BYTE。 nls_date_format: 说明: 指定与 TO_CHAR 和 TO_DATE 函数一同使用的默认日期格式。该参数的默认值由 NLS_TERRITORY 确定。该参数的值...

Global site tag (gtag.js) - Google Analytics