Sunday, January 7, 2018

Recreating Temporary Tablespace

Recreating Temporary Tablespace

Temp Tablespace size Extent size is uniform with 2097152 Bytes which is 2 MB which way too small which is the overhead for the Sort Segments.Bydefault uniform size is 1 MB.We should be change it to 128M.

1.       Create another Temporary Tablespace
CREATE TEMPORARY TABLESPACE TEMP1 TEMPFILE
  '+DATA' SIZE 24G AUTOEXTEND ON NEXT 100M MAXSIZE 24G,
  '+DATA' SIZE 24G AUTOEXTEND ON NEXT 100M MAXSIZE 24G,
  '+DATA' SIZE 24G AUTOEXTEND ON NEXT 100M MAXSIZE 24G,
  '+DATA' SIZE 24G AUTOEXTEND ON NEXT 100M MAXSIZE 24G
TABLESPACE GROUP ''
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128M;
     2.       Change default Database temporary tablespace
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP1;          
3.       Make sure No sessions are using your Old Temp tablespace
SELECT USERNAME, SESSION_NUM, SESSION_ADDR FROM V$SORT_USAGE;
If you find some sort of operation in progress, wait until the terms or manually end the process
4.       Drop old tablespace temp
DROP TABLESPACE TEMP INCLUDING CONTENTS AND DATAFILES;
5.       Recreate tablespace temp
CREATE TEMPORARY TABLESPACE TEMP TEMPFILE
  '+DATA' SIZE 24G AUTOEXTEND ON NEXT 100M MAXSIZE 24G,
  '+DATA' SIZE 24G AUTOEXTEND ON NEXT 100M MAXSIZE 24G,
  '+DATA' SIZE 24G AUTOEXTEND ON NEXT 100M MAXSIZE 24G,
  '+DATA' SIZE 24G AUTOEXTEND ON NEXT 100M MAXSIZE 24G
TABLESPACE GROUP ''
EXTENT MANAGEMENT LOCAL UNIFORM SIZE 128M;

6.       Move Tablespace Temp, back to new temp tablespace
ALTER DATABASE DEFAULT TEMPORARY TABLESPACE TEMP;
7.       Drop tablespace temp1 because default temporary tablespace is temp
DROP TABLESPACE TEMP1 INCLUDING CONTENTS AND DATAFILES;




No comments:

Post a Comment