ORA-01113: file xxxx needs media recovery
2014-10-16 00:23 潇湘隐者 阅读(13722) 评论(0) 编辑 收藏 举报由于规范存储位置以及存储空间调整缘故需要移动表空间MRP_INDEX2的数据文件,如下所示,首先将表空间MRP_INDEX2脱机; 然后复制数据文件;接着重命名数据文件,最后将表空间MRP_INDEX2联机.
在操作过后,最后一步将表空间MRP_INDEX2联机上线时,出现了意外错误信息,如下所示:
SQL> ALTER TABLESPACE MRP_INDEX2 OFFLINE NORMAL;
Tablespace altered.
SQL> !cp /u03/flash_recovery_area/oradata/epps/mrp_index2_x01.dbf /u04/epps/oradata/mrp_index2_x01.dbf
SQL> !cp /u03/flash_recovery_area/oradata/epps/mrp_index2_x02.dbf /u04/epps/oradata/mrp_index2_x02.dbf
SQL> ALTER DATABASE RENAME FILE '/u03/flash_recovery_area/oradata/epps/mrp_index2_x01.dbf' TO '/u04/epps/oradata/mrp_index2_x01.dbf';
Database altered.
如下所示,在重命名文件时,其中一个文件路径'u04/epps/oradata/mrp_index2_x02.dbf'弄错了,当时一直没有留意到这个错误,怕耽搁Tablespace的联机上线时间。于是先将表空间MRP_INDEX2联机上线
SQL> ALTER DATABASE RENAME FILE '/u03/flash_recovery_area/oradata/epps/mrp_index2_x02.dbf' TO 'u04/epps/oradata/mrp_index2_x02.dbf'
*
ERROR at line 1:
ORA-01511: error in renaming log/data files
ORA-01141: error renaming data file 86 - new file
'u04/epps/oradata/mrp_index2_x02.dbf' not found
ORA-01110: data file 86:
'/u03/flash_recovery_area/oradata/epps/mrp_index2_x02.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
SQL> ALTER TABLESPACE MRP_INDEX2 ONLINE ;
Tablespace altered.
检查过后发现了上面脚本错误,于是接着处理,但是将表空间MRP_INDEX2脱机后,没有重新拷贝数据文件过去,直接重命名数据文件(SCN已经改变,导致下面ORA-01113错误),然后表空间联机上线时,出现了下面错误
SQL> ALTER TABLESPACE MRP_INDEX2 OFFLINE NORMAL;
Tablespace altered.
SQL> ALTER DATABASE RENAME FILE '/u03/flash_recovery_area/oradata/epps/mrp_index2_x02.dbf' TO '/u04/epps/oradata/mrp_index2_x02.dbf';
Database altered.
SQL>
SQL> ALTER TABLESPACE MRP_INDEX2 ONLINE ;
ALTER TABLESPACE MRP_INDEX2 ONLINE
*
ERROR at line 1:
ORA-01113: file 86 needs media recovery
ORA-01110: data file 86: '/u04/epps/oradata/mrp_index2_x02.dbf'
解决方法:
1:首先将对应报错的数据文件脱机
SQL> alter database datafile '/u04/epps/oradata/mrp_index2_x02.dbf' offline;
Database altered.
2:其次recover这个数据文件
SQL> alter database recover datafile '/u04/epps/oradata/mrp_index2_x02.dbf';
Database altered.
3:然后将该数据文件联机上线
SQL> alter database datafile '/u04/epps/oradata/mrp_index2_x02.dbf' online;
Database altered.
4:最后将该表空间MRP_INDEX2联机上线。
SQL> ALTER TABLESPACE MRP_INDEX2 ONLINE ;
当然也可以使用RMAN还原,这里感觉使用SQL命令还原要简单方便一点,最后删除拷贝前的文件
rm /u03/flash_recovery_area/oradata/epps/mrp_index2_x01.dbf
rm /u03/flash_recovery_area/oradata/epps/mrp_index2_x02.dbf
扫描上面二维码关注我
如果你真心觉得文章写得不错,而且对你有所帮助,那就不妨帮忙“推荐"一下,您的“推荐”和”打赏“将是我最大的写作动力!
本文版权归作者所有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接.