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.
在有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.
相关文章推荐
- SQL语句统计每天、每月、每年的数据
- Oracle学习 第5天之高级查询
- MySQL5.7安装过程以及参数和设置说明
- SQLServer查询操作
- Redis学习笔记二
- MySql 密码忘记了怎么办?
- 关于Redis缓存
- MySQL水平分割示例
- 面向对象的方式访问数据库
- mysql集群
- 关系数据库&&NoSQL数据库
- MySQL 数据库性能优化第四篇文章之SQL优化
- 关于数据库中表被锁定时如何操作表
- oracle存储过程之游标
- 数据库中Schema和Database有什么区别
- redis系列--list命令
- MySQL 数据库性能优化第二篇文章之表结构优化
- NoSQL
- MySQL 数据库性能优化第一篇文章之缓存参数优化
- 《Redis实战》读书笔记