[20151028]理解数据文件offline+drop.txt
--前几天做删除数据文件的恢复测试,自己在理解offline drop的方式存在错误,做一个记录:
The ALTER DATABASE DATAFILE <datafile name> OFFLINE DROP command, is not meant to allow you to remove a datafile. What
the command really means is that you are offlining the datafile with the intention of dropping the tablespace.
If you are running in archivelog mode, you can also use:
ALTER DATABASE DATAFILE <datafile name> OFFLINE;
instead of OFFLINE DROP. Once the datafile is offline, Oracle no longer attempts to access it, but it is still
considered part of that tablespace. This datafile is marked only as offline in the controlfile and there is no SCN
comparison done between the controlfile and the datafile during startup (This also allows you to startup a database with
a non-critical datafile missing). The entry for that datafile is not deleted from the controlfile to give us the
opportunity to recover that datafile.
alter database datafile '...' offline drop; --非归档模式使用
alter database datafile '...' offline; --归档模式使用
--换一句话讲在归档模式下使用offline 或者 offline drop是一样的,不存在区别,而在非归档模式仅仅使用offline drop。
--而是实际上即使加入drop也不会移除数据文件,并且也不会从控制文件中剔除(注:这个是最迷惑人的地方)。
--可以理解为oracle这样设置,提示你在非归档下OFFLINE 一个DATAFILE 需要勇气,因为如果需要的REDO被覆盖,你将面临无法RECOVER
--的状况,也就没法ONLINE了.
--实际上在归档模式没有什么区别,在非归档模式必须加入drop,也许oracle想标识要恢复有点困难,必须要有一系列日志。
--理解这些对于恢复很重要!而且drop确实有点不好理解。