Quantcast
Channel: Doyensys Allappsdba Blog..
Viewing all articles
Browse latest Browse all 1640

Database DEFAULT TEMPORARY TABLESPACE and Restrictions

$
0
0
Oracle 9i Database DEFAULT TEMPORARY TABLESPACE and Restrictions:
=================================================================


To retrieve the name of the DEFAULT TEMPORARY TABLESPACE for a database, do the
following select:

   SQL> select * from database_properties
        where property_name = 'DEFAULT_TEMP_TABLESPACE';


   PROPERTY_NAME           PROPERTY_VALUE   DESCRIPTION
   ----------------------- ---------------  ------------------------------------
   DEFAULT_TEMP_TABLESPACE TEMP             Name of default temporary tablespace



Restrictions on the DEFAULT TEMPORARY TABLESPACE:
-------------------------------------------------

1. The DEFAULT TEMPORARY TABLESPACE must be of TEMPORARY type:

   SQL> alter database default temporary tablespace tools;
   alter database default temporary tablespace tools
   *
   ERROR at line 1:
   ORA-12902: default temporary tablespace must be SYSTEM or of TEMPORARY type


2. The DEFAULT TEMPORARY TABLESPACE cannot be converted to PERMANENT once it
   has been defined as the DEFAULT TEMPORARY TABLESPACE:

   SQL> alter tablespace temp2 permanent;
   alter tablespace temp2 permanent
   *
   ERROR at line 1:
   ORA-12904: default temporary tablespace cannot be altered to PERMANENT type


3. Before dropping the DEFAULT TEMPORARY TABLESPACE, create another one:

   SQL> drop tablespace temp including contents and datafiles;
   drop tablespace temp including contents and datafiles
   *
   ERROR at line 1:
   ORA-12906: cannot drop default temporary tablespace

   SQL> create tablespace TEMP2
     2  datafile '/export/home1/ora900/oradata/V900/temp2_01.dbf'
     3  size 100k
     4  TEMPORARY;

   Tablespace created.

   SQL> alter database default temporary tablespace TEMP2;
   Database altered.

   SQL> drop tablespace temp including contents and datafiles;
   Tablespace dropped.


4. The DEFAULT TEMPORARY TABLESPACE cannot be taken OFFLINE:

   SQL> alter tablespace temp offline;
   alter tablespace temp offline
   *
   ERROR at line 1:
   ORA-12905: default temporary tablespace cannot be brought OFFLINE


5. The temporary tablespace for users must be of TEMPORARY type in Oracle9i.
   (Please note, this is not a restriction in Oracle8 and Oracle8i.)

   SQL>  alter user scott temporary tablespace TOOLS;
    alter user scott temporary tablespace TOOLS
   *
   ERROR at line 1:
   ORA-12911: permanent tablespace cannot be temporary tablespace

   SQL> create tablespace temp2
     2  datafile  '/export/home1/ora900/oradata/V900/temp2_01.dbf' 
     3  size 100k
     4  temporary;

   Tablespace created.

   SQL> alter user scott temporary tablespace temp2;
   User altered.


6. If you drop the temporary tablespace of a user, and this temporary
   tablespace is not the DEFAULT TEMPORARY TABLESPACE for the database, the
   user's temporary tablespace is not automatically switched to the DEFAULT
   TEMPORARY TABLESPACE.


   SQL> select tablespace_name, contents from dba_tablespaces
     2  where tablespace_name like 'TEMP%';


   TABLESPACE_NAME                CONTENTS
   ------------------------------ ---------
   TEMP                           TEMPORARY
   TEMP2                          TEMPORARY

   SQL> select TEMPORARY_TABLESPACE from dba_users where username='SCOTT';

   TEMPORARY_TABLESPACE
   ------------------------------
   TEMP2


   SQL> drop tablespace TEMP2 including contents and datafiles;
   Tablespace dropped.


   SQL> select TEMPORARY_TABLESPACE from dba_users where username='SCOTT';

   TEMPORARY_TABLESPACE
   ------------------------------
   TEMP2

Viewing all articles
Browse latest Browse all 1640

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>