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进行数据库备份可以确保数据的安全和可靠性,减少数据丢失的风险,提高数据恢复的速度和效率。 oracle数据库备份的重要性: * 数据安全:数据库备份可以确保数据的安全和可靠性 * 数据恢复:数据库备份...
rman是一种用于集备份(backup)、还原(restore)和恢复(recover)数据库于一体的Oracle 工具,支持命令行及图形界面操作 能够备份整个数据库、表空间、数据文件、控制文件、归档文件以及Spfile参数文件。 支持增量...
RMAN 可以用来备份和恢复数据库文件、归档日志和控制文件,也可以用来执行完全或不完全的数据库恢复。RMAN 有三种不同的用户接口:COMMAND LINE 方式、GUI 方式(集成在 OEM 中的备份管理器)、API 方式(用于集成到...
当数据库在运行过程中出现坏块时,数据库可以在打开状态下可以使用RMAN来恢复,但是数据库必须是归档模式,同时必须有该块数据文件的备份以及所有的归档日志才能进行恢复
CSP数据库数据备份恢复应急演练方案 以下是对该文件的详细知识点分析: 标题:CSP数据库数据备份恢复应急演练方案 描述:该文件描述了CSP数据库数据备份恢复应急演练的方案,包括应急恢复演练的主要步骤、观察、...
(5) 进入rman使用restore和recover恢复表空间 restore tablespace apollo_data; recover tablespace apollo_data; 备注:从(4)、(5)开始的执行都没有成功,因为drop表空间后即使在系统表里 面也不再有改表...
编写本篇文档的目的是当Oracle9i 数据库出现灾难时怎样使用有效备份来进行数据库的不完全恢复。 二、本文档适合情况 1. 服务器崩溃,例如所有硬盘损坏、存储损坏,造成数据库崩溃,丢失所有数据 2. 有 datafile、...
实验128:rman的数据库不完全恢复 214 实验129:rman的数据库副本管理 214 实验130:rman的备份管理 214 第六部分数据库的优化 216 采集数据 216 实验131:优化工具utlbstat/utlestat的使用 216 实验132:优化工具...
使用 RMAN 执行不完全恢复 5-20 使用 RMAN 的基于时间的恢复:示例 5-21 使用 RMAN 的日志序列恢复:示例 5-23 使用 Oracle Enterprise Manager 的不完全恢复 5-24 不完全备份和预警日志 5-25 还原点 5-26 不...
任何数据库在长期使用过程中,都会存在一定的安全隐患。对于数据库管理员来说不能仅寄希望于计算机操作系统的安全运行,而是要建立一整套的数据库备份与恢复机制。...第七章 RMAN恢复 第八章 备份恢复示例
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永久参数...
使用 RMAN 执行不完全恢复 5-20 使用 RMAN 的基于时间的恢复:示例 5-21 使用 RMAN 的日志序列恢复:示例 5-23 使用 Oracle Enterprise Manager 的不完全恢复 不完全备份和预警日志 5-25 还原点 5-26 不完全...
在 DBA 的日常工作中不可避免存在着数据库的损坏,本文将主要介绍 Oracle 数据库遇到不同损坏级别下的应该采用的恢复方法,供读者在遇到此类情景时,能的找到适合自己的恢复方法,提高工作效率。 数据块损坏的恢复 ...
ORACLE数据库备份的方法有很多,例如使用ORACLE提供的备份工具,例如RMAN、EXP、IMP等。这些工具可以帮助用户快速、安全地备份数据库。同时,用户也可以使用第三方备份工具,例如第三方备份软件等。 ORACLE数据库...
冷备份是数据库没有打开的情况下,使用操作系统命令或 RMAN 进行备份,因数据库没有打开,数据库的数据是干净一致的,不存在活动事务。 热备份 热备份是数据库在 open 状态,事务还在活动,此时备份就是热备份,...
由于对数据库所做的全部改动就保存在日志文件中,如果因为包括介质失效在内的某种失效而导致数据库文件丢失的话,可以利用物理备份和归档日志完全恢复数据库,不会丢失任何数据。所有已经提交的事务都可以查到。 ·...
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 ...
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 ...