Tuesday, May 6, 2008

Recreate TEMP tablespace

1. Create another temp tablespace
SQL> CREATE TEMPORARY TABLESPACE temp2
2 TEMPFILE '/u02/oradata/TESTDB/temp2_01.dbf' SIZE 5M REUSE
3 AUTOEXTEND ON NEXT 1M MAXSIZE unlimited
4 EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;

2. Move default temporary tablespace on every user
SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp2;

3. Drop default tablespace
SQL> DROP TABLESPACE temp INCLUDING CONTENTS AND DATAFILES;

4. Create default temp tablespace
SQL> CREATE TEMPORARY TABLESPACE temp
2 TEMPFILE '/u02/oradata/TESTDB/temp01.dbf' SIZE 500M REUSE
3 AUTOEXTEND ON NEXT 100M MAXSIZE unlimited
4 EXTENT MANAGEMENT LOCAL UNIFORM SIZE 1M;

5. Re-move again default temp tablespace
SQL> ALTER DATABASE DEFAULT TEMPORARY TABLESPACE temp;

6. Drop second temp tablespace

SQL> DROP TABLESPACE temp2 INCLUDING CONTENTS AND DATAFILES;

No comments: