Tuesday, July 29, 2014

Resizing Temporary Table space

Resizing Temporary Table space


Before resize the temp table space make sure your   usage of the temp space following quarry can be use for find out the usage
SELECT A.tablespace_name tablespace, D.mb_total,
SUM (A.used_blocks * D.block_size) / 1024 / 1024 mb_used,
D.mb_total - SUM (A.used_blocks * D.block_size) / 1024 / 1024 mb_free
FROM v$sort_segment A,
(
SELECT B.name, C.block_size, SUM (C.bytes) / 1024 / 1024 mb_total
FROM v$tablespace B, v$tempfile C
WHERE B.ts#= C.ts#
GROUP BY B.name, C.block_size
) D
WHERE A.tablespace_name = D.name
GROUP by A.tablespace_name, D.mb_total;
Output should be as

TABLESPACE                        MB_TOTAL    MB_USED    MB_FREE
------------------------------- ---------- ---------- ----------
TEMP2                                 1024          0             1024
TEMP1                                 1024          .125         1023.875
Here we can reduce up to   100mb because currently it use only .125mb or you can  increase as your  requirement
SQL> alter database tempfile '/u02/oradata/TESTDB/temp01.dbf' resize 100M;
SQL> alter database tempfile '/u02/oradata/TESTDB/temp01.dbf' resize 2G;

No comments:

Post a Comment