Return to site

Oracle Increase Temp Tablespace

broken image


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.

  • Our Database (Oracle 8.1.7) has 2 temporary tablespaces - TEMP (DMT) and TEMPTRUE (true temporary LMT). All application users have still default temporary tablespace TEMP. I found in v$sortusage that if the user perform some expansive SELECT operation with sorting - the TEMP tablespace is used.
  • Currently my Oracle 11g temp TABLESPACE value is 34GB. I need to increase the table space value to a large value (45GB) I tired the following sql command to increase the temp table space. ALTER TABLESPACE temp ADD TEMPFILE '/oradata/temp01.dbf' SIZE 45G The error.
  • It is normal that dbafreespace shows no free space in temporary tablespace because space is managed differently from permanent tablespaces. Hence, 100% full is normal and transactions will re-use the space as-needed. Here is a script that will display the contents of the TEMP tablespace. Set pagesize 60 linesize 132 verify off break on file.

The temporary (sort) segment of a given temporary tablespace is created at the time of the first sort operation, which has to write to disk to free up sort space in memory. The first disk sort (after instance startup) creates a sort segment in the temporary tablespace. Multiple transactions which need a sort on disk can share the same sort segment, however, they cannot share the same extent.

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.

Oracle Increase Temp Tablespace Size

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.

Temp

Example - Drop Datafile

Oracle Resize Temp Tablespace 12c

Let's look at an ALTER TABLESPACE statement that drops a datafile from a tablespace.

Oracle Increase Temp Tablespace Size

Jeezy the recession album tracklist. For example:

This ALTER TABLESPACE statement drops the datafile called tbs_perm_03.dat to the tbs_perm_03 tablespace.

Example - Add Tempfile

Oracle Increase Temp Tablespace

Oracle temporary tablespace

Example - Drop Datafile

Oracle Resize Temp Tablespace 12c

Let's look at an ALTER TABLESPACE statement that drops a datafile from a tablespace.

Oracle Increase Temp Tablespace Size

Jeezy the recession album tracklist. For example:

This ALTER TABLESPACE statement drops the datafile called tbs_perm_03.dat to the tbs_perm_03 tablespace.

Example - Add Tempfile

Oracle Increase Temp Tablespace

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:

Increase Size Of Temp Tablespace Oracle 10g

This ALTER TABLESPACE statement drops the tempfile called tbs_temp_05.dat to the tbs_temp_05 tablespace.





broken image