One can’t move the temp tablespace during mount stage like other datafiles using “ALTER DATABASE RENAME FILE..” so a workaround this issue is to create a new temp tablespace.

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

— create a new temp tablespace
SQL> CREATE TEMPORARY TABLESPACE TEMP2
TEMPFILE ‘/u01/oradata/TESTDB/temp2_01.dbf’ SIZE 1000M AUTOEXTEND ON NEXT 100M MAXSIZE 5000M
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1024K
SEGMENT SPACE MANAGEMENT MANUAL
/

— change default temporary tablespace
SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp2;

— drop old temp tablespace
SQL> drop tablespace temp including contents and datafiles;

— recreate the temp with new file location
SQL> CREATE TEMPORARY TABLESPACE TEMP
TEMPFILE ‘/u03/oradata/TESTDB/temp_01.dbf’ SIZE 1000M AUTOEXTEND ON NEXT 100M MAXSIZE 5000M
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1024K
SEGMENT SPACE MANAGEMENT MANUAL
/

— make the temp default again
SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp;

— drop temp2 tablespace
SQL> drop tablespace temp2 including contents and datafiles;

2 responses to “How to move datafiles in temp tablespace?”

  1. reasahu Avatar

    Question: How can i get to know, the Name and Number of Datafile in the database at the NOMOUNT stage. Pls help.

    Like

    1. Amin Jaffer Avatar
      Amin Jaffer

      The database has to be in the mount stage to get list of datafiles as the controlfile has the list of the datafiles. When the database is mount it reads the control file. At nomount state the database has only read the pfile/spfile.

      Like

Leave a reply to reasahu Cancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.