您的位置:首页 > 数据库

RMAN restore恢复带有OFFLINE文件的数据库

2016-06-13 21:53 537 查看
现象:

在有OFFLINE数据文件的数据库中,执行RMAN备份(database + archivelog)后,恢复时需要单独处理OFFLINE的数据文件,否则recover database时将提示缺少(找不到)之前的某个归档日志。

处理办法如下:
1、重建控制文件:把OFFLINE的数据文件去掉

      参考:http://blog.csdn.net/lk_db/article/details/52576220

2、跳过OFFLINE的数据文件所在的表空间(该表空间包含多个数据文件的话,可能丢失数据较多),多用于OFFLINE所在的表空间仅有一个数据文件的情况。

select ts.ts#,ts.name from v$tablespace ts,v$datafile df where df.ts#=ts.ts# and df.file#=5;

RMAN> recover database skip tablespace 'TEST';

Starting recover at 13-JUN-16

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=20 device type=DISK

Executing: alter database datafile 5 offline

starting media recovery

archived log for thread 1 with sequence 17 is already on disk as file /u01/app/oracle/oradata/orcl/redo02.log

archived log for thread 1 with sequence 18 is already on disk as file /u01/app/oracle/oradata/orcl/redo01.log

archived log for thread 1 with sequence 19 is already on disk as file /u01/app/oracle/oradata/orcl/redo03.log

archived log file name=/u01/app/oracle/archivelog/1_8_914429606.dbf thread=1 sequence=8

archived log file name=/u01/app/oracle/archivelog/1_9_914429606.dbf thread=1 sequence=9

archived log file name=/u01/app/oracle/archivelog/1_10_914429606.dbf thread=1 sequence=10

archived log file name=/u01/app/oracle/archivelog/1_11_914429606.dbf thread=1 sequence=11

archived log file name=/u01/app/oracle/archivelog/1_12_914429606.dbf thread=1 sequence=12

archived log file name=/u01/app/oracle/archivelog/1_13_914429606.dbf thread=1 sequence=13

archived log file name=/u01/app/oracle/archivelog/1_14_914429606.dbf thread=1 sequence=14

archived log file name=/u01/app/oracle/archivelog/1_15_914429606.dbf thread=1 sequence=15

archived log file name=/u01/app/oracle/archivelog/1_16_914429606.dbf thread=1 sequence=16

archived log file name=/u01/app/oracle/oradata/orcl/redo02.log thread=1 sequence=17

archived log file name=/u01/app/oracle/oradata/orcl/redo01.log thread=1 sequence=18

archived log file name=/u01/app/oracle/oradata/orcl/redo03.log thread=1 sequence=19

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

Finished recover at 13-JUN-16

SQL> alter database open resetlogs;

Database altered.

SKIPTABLESPACE解释:

Use an optional SKIPTABLESPACE 'tablespace_name' argument to

avoid restoring specified tablespaces, which is useful when you want to

avoid restoring tablespaces containing temporary data.

If you specify SKIP FOREVER TABLESPACE, then RMAN specifies the DROP

option of ALTER DATABASE DATAFILE ... OFFLINE when taking the

datafiles that belong to the tablespace offline before the restore. The DROP

option indicates that RMAN does not intend to recover these files and

intends to drop their tablespaces from the database after the database is

opened again. In other words, FOREVER indicates that RMAN never

intends to do anything with the skipped tablespaces again.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: