在没有备份的情况下重新创建丢失的数据文件 (Doc ID 1149946.1)

时间:2019-12-08
本文章向大家介绍在没有备份的情况下重新创建丢失的数据文件 (Doc ID 1149946.1),主要包括在没有备份的情况下重新创建丢失的数据文件 (Doc ID 1149946.1)使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。

Recreating a missing datafile with no backups (Doc ID 1149946.1)

APPLIES TO:

Oracle Database - Enterprise Edition - Version 10.2.0.2 and later
Information in this document applies to any platform.
***Checked for relevance on 16-Apr-2014***

GOAL

How to recreate a datafile that is missing at the operating system level. Missing/inaccessible files may be reported with one or more of these errors:

如何重新创建操作系统级别上缺少的数据文件。丢失/无法访问的文件可能会报告,其中包含以下一个或多个错误

ORA-01116: error in opening database file %s
ORA-27041: unable to open file
ORA-01157: cannot identify/lock data file %s - see DBWR trace file
ORA-01119: error in creating database file '%s'

No backup or copy of the datafile is required. We only need the redo logs starting from the time of the datafile creation to the current point in time.

无需备份或复制数据文件。我们只需要从创建数据文件到当前时间点的 redo logs

Note: plugged-in datafiles do not apply in this scenario and needs to be plugged-in again from its source.

注意:插入的数据文件在这种情况下不适用,需要从其源中再次插入

SOLUTION

When a datafile goes missing at the operating system level, you would normally need to restore and recover it from a backup. If you do not have backups of this datafile, but do have redo logs you can still create and recover the datafile. You only need the redo logs starting from the datafile creation time to now.

当数据文件在操作系统级别丢失时,通常需要从备份中还原和恢复它。如果您没有此数据文件的备份,但是有 redo logs,则仍然可以创建和恢复该数据文件。您只需要从数据文件创建时间到现在的 redo logs

Prior to 10g, you would use the following SQL command:  在10g之前,您将使用以下SQL命令

SQL> alter database create datafile 'missing name' as 'misisng name';
SQL> recover datafile 'missing name';
SQL> alter database datafile '<missing name>' online;

As of 10g, you can also do this in RMAN.  从10g开始,您也可以在RMAN中执行此操作

1) RMAN will create the datafile if there is no backups or copies of this datafile:

    如果没有该数据文件的备份或副本,RMAN将创建该数据文件

RMAN> restore datafile <missing file id>;

2) Recover the newly created datafile:  恢复新创建的数据文件

RMAN> recover datafile <missing file id>;

3) Bring it online:

RMAN> sql 'alter database datafile <missing file id> online';

Example:

RMAN> list copy of datafile 6;

specification does not match any datafile copy in the repository

RMAN> list backup of datafile 6;

specification does not match any backup in the repository

RMAN> restore datafile 6;

Starting restore at 14 JUL 10 10:20:02
using channel ORA_DISK_1

creating datafile file number=6 name=/opt/app/oracle/oradata/ORA112/datafile/o1_mf_leng_ts_63t08t64_.dbf
restore not done; all files read only, offline, or already restored
Finished restore at 14 JUL 10 10:20:05

RMAN> recover datafile 6;

Starting recover at 14 JUL 10 10:21:02
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 14 JUL 10 10:21:02

RMAN> sql 'alter database datafile 6 online';

sql statement: alter database datafile 6 online

  

原文地址:https://www.cnblogs.com/zylong-sys/p/12004746.html