Oracle7 Server Administrator's Guide

Contents Index Home Previous Next

Altering Datafile Availability

This section describes ways to alter datafile availability, and includes the following topics:

In very rare situations, you might need to bring specific datafiles online (make them available) or take specific files offline (make them unavailable). For example, when Oracle7 has problems writing to a datafile, it can automatically take the datafile offline. You might need to take the damaged datafile offline or bring it online manually.

Note: You can make all datafiles in a tablespace, other than the files in the SYSTEM tablespace, temporarily unavailable by taking the tablespace offline. You must leave these files in the tablespace to bring the tablespace back online.

Offline datafiles cannot be accessed. Bringing a datafile in a read-only tablespace online makes the file readable. No one can write to the file unless its associated tablespace is returned to the read-write state. The files of a read-only tablespace can independently be taken online or offline using the DATAFILE option of the ALTER DATABASE command.

To bring a datafile online or take it offline, in either archiving mode, you must have the ALTER DATABASE system privilege. You can perform these operations only when the database is open in exclusive mode.

Bringing Datafiles Online in ARCHIVELOG Mode

To bring an individual datafile online, issue the SQL command ALTER DATABASE, and include the DATAFILE parameter.

Note: To use this option of the ALTER DATABASE command, the database must be in ARCHIVELOG mode. This requirement prevents you from accidentally losing the datafile, since taking the datafile offline while in NOARCHIVELOG mode is likely to result in losing the file.

The following statement brings the specified datafile online:

ALTER DATABASE DATAFILE 'filename' ONLINE;

See Also: For more information about bringing datafiles online during media recovery, see [*].

Taking Datafiles Offline in NOARCHIVELOG Mode

To take a datafile offline when the database is in NOARCHIVELOG mode, use the ALTER DATABASE command with the DATAFILE parameter and the OFFLINE DROP option. This allows you to take the datafile offline and drop it immediately. It is useful, for example, if the datafile contains only data from temporary segments and has not been backed up, and the database is in NOARCHIVELOG mode.

The following statement brings the specified datafile offline:

ALTER DATABASE DATAFILE 'filename' OFFLINE DROP;


Contents Index Home Previous Next