[Oracle]减少临时表使用空间的几种方法

王朝oracle·作者佚名  2006-11-24
宽屏版  字体: |||超大  

1、 第一种方式,直接resize tempfile , 虽然简单,但是很容易无效

sys@mescp> select tablespace_name,file_name ,2 file_id,bytes/1024/1024 as "size(M)"3 from dba_temp_files4 /TABLESPACE_NAME FILE_NAME FILE_ID size(M)-------------------- ---------------------------------- ---------- ----------TEMP /orabin/oradata/mescp/temp01.dbf 1 1024TEMP /orabin/oradata/mescp/tmp1_01.dbf 2 40962 rows selected.sys@mescp> alter database tempfile 1 resize 16M;alter database tempfile 1 resize 16M*ERROR at line 1:ORA-03297: file contains used data beyond requested RESIZE value-- 失败了

2、第二种,建立另一个临时表空间,并把它设为default temporary tablespace,再删除原来的temporary tablespace以及tempfile。

需要切换,复杂了点……

3、我提供的方式

sys@mescp> alter database tempfile 1 drop ;Database altered.sys@mescp> alter tablespace temp add tempfile2 '/orabin/oradata/mescp/temp01.dbf'3 size 16M reuse autoextend on next 16M maxsize 4096M;Tablespace altered.sys@mescp> alter database tempfile 2 drop ;Database altered.sys@mescp> alter tablespace temp add tempfile2 '/orabin/oradata/mescp/tmp1_01.dbf'3sys@mescp> 3 size 16M reuse autoextend on next 16M maxsize 4096M;sys@mescp> /Tablespace altered.sys@mescp> select tablespace_name,file_name ,2 file_id,bytes/1024/1024 as "size(M)"3 from dba_temp_files4 /TABLESPACE_NAME FILE_NAME FILE_ID size(M)-------------------- ---------------------------------- ---------- ----------TEMP /orabin/oradata/mescp/temp01.dbf 1 16TEMP /orabin/oradata/mescp/tmp1_01.dbf 2 162 rows selected.

无需重新建立temporary tablespace,无需修改database的default temporary tablespace

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有