[20151028]理解資料檔案offline+drop.txt

lfree發表於2015-10-28
[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確實有點不好理解。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-1817029/,如需轉載,請註明出處,否則將追究法律責任。

相關文章