地市分站
用户名
密  码
您现在的位置是:树人网首页 / 计算机等级考试 / oracle认证 / 文章浏览
[学习教程]减少临时表使用空间的几种方法
发表时间:2006-09-08 点击次数

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



第 页

责任编辑:

相关文章
公告栏

“蓝焰杯”第二届河南教育十大新闻人物火热评选中!!

点击参加评选,为你心目中的新闻人物投上一票>>>>
频道内容精选
[计算机考试]程序员必考的知识点
论坛/博客精选