Monday, June 16, 2008

ALTER TABLESPACE OFFLINE vs. ALTER DATABASE DATAFILE OFFLINE

There is a difference between:
Taking the tablespace offline and taking the datafiles offline

ALTER TABLESPACE (tablespace_name ) OFFLINE; does a checkpoint on all datafiles and then takes the datafiles offline.

ALTER DATABASE DATAFILE (datafile_path) OFFLINE;does not perform a checkpoint, so that if the database is open, you may need to perform media recovery when bringing it online.

That is the reason why:
You cannot do ‘alter database datafile (datafile_path) offline’ if you are in noarchivelog (but tablespace offline works)
You cannot do ‘alter tablespace (tablespace_name) offline’ if database is read-only (but datafile offline works)

Note that in both cases, you can check the STATUS column from v$datafile to see if the file is online, offline or needs recovery.

http://www.quest-pipelines.com/pipelines/dba/tips06.htm

No comments: