This Oracle tutorial explains how to use the Oracle ALTER TABLESPACE statement with syntax and examples.
Description
The ALTER TABLESPACE statement is used to modify a tablespace or one of its data files or temp files. A tablespace is used to allocate space in the Oracle database where schema objects are stored.
Syntax
The syntax for the ALTER TABLESPACE statement in Oracle/PLSQL is:
Parameters or Arguments
tablespace_name
The name of the tablespace to remove from the Oracle database.
storage_clause
The syntax for the the storage_clause is:
file_specification
The syntax for the file_specification is:
Example - Rename Datafile
Let's look at an ALTER TABLESPACE statement that renames a datafile associated with a tablespace.
For example:
This ALTER TABLESPACE statement would take the tablespace offline, rename the datafile from tbl_perm_01.dat to tbl_perm_01_new.dat, and then bring the tablespace back online again.
Example - Add Datafile
Let's look at an ALTER TABLESPACE statement that adds a datafile to a tablespace.
For example:
This ALTER TABLESPACE statement add the datafile called tbs_perm_02.dat to the tbs_perm_02 tablespace.
Example - Drop Datafile
Let's look at an ALTER TABLESPACE statement that drops a datafile from a tablespace.
For example:
This ALTER TABLESPACE statement drops the datafile called tbs_perm_03.dat to the tbs_perm_03 tablespace.
Example - Add Tempfile
Let's look at an ALTER TABLESPACE statement that adds a tempfile to a tablespace.
For example:
This ALTER TABLESPACE statement add the tempfile called tbs_temp_04.dat to the tbs_temp_04 tablespace.
Example - Drop Tempfile
Let's look at an ALTER TABLESPACE statement that drops a tempfile from a tablespace.
For example:
This ALTER TABLESPACE statement drops the tempfile called tbs_temp_05.dat to the tbs_temp_05 tablespace.