Saturday, 27 August 2016

Making Tablespace Online or Offline in Oracle Database

Making Tablespace Online or Offline in Oracle Database


Taking tablespaces Offline or Online

You can take an online tablespace offline so that it is temporarily unavailable for general use. The rest of the database remains open and available for users to access data. Conversely, you can bring an offline tablespace online to make the schema objects within the tablespace available to database users. The database must be open to alter the availability of a tablespace.

We usually take tablespaces offline for maintenance purposes.

To alter the availability of a tablespace, use the ALTER TABLESPACE statement. You must have the ALTER TABLESPACE or MANAGE TABLESPACE system privilege.

To Take a Tablespace Offline give the following command

SQL> alter tablespace ica offline;

To again bring it back online give the following command.

SQL> alter tablespace ica online;

To take individual datafile offline type the following command

SQL> alter database datafile ‘/u01/oracle/ica/ica_tbs01.dbf’ offline;

Again to bring it back online give the following command

SQL> alter database datafile ‘/u01/oracle/ica/ica_tbs01.dbf’ online;

Note: You can’t take individual datafiles offline it the database is running in NOARCHIVELOG mode.  If the datafile has become corrupt or missing when the database is running in NOARCHIVELOG mode then you can only drop it by giving the following command


SQL> alter database datafile ‘/u01/oracle/ica/ica_tbs01.dbf’ offline for drop;

No comments:

Post a comment