Sometimes we may need to take a datafile offline and online in oracle. In this article we will take a look at these operations and examine recovering data file after taking offline.
To take a datafile offline, first we should query the datafile as follows;
1 | SQL> select * from dba_data_files; |
or
1 | SQL> select * from v$datafile; |
A data file in ARCHIVELOG mode can be taken offline as follows. Recovery is required when a datafile in ARCHIVELOG mode has taken offline.
1 | SQL> alter database datafile 4 offline; |
When a database in ARCHIVE mode wants to be taken from offline mode to online mode, it needs a recovery process as follows.
1 | SQL> recover datafile 4; |
A data file is not in ARCHIVELOG mode can be taken offline as follows.
1 | SQL> alter database datafile offline for drop; |
When we want to take the database that is not in archive mode online again, we need to do the recovery process as follows. The recovery process is performed using “Redo Log” files. If too much time has passed and the “Redos” are crushed, the recovery process will not be successful.
1 | SQL> recover datafile 4; |