临时表空间过大解决方法

解决临时表空间过大有两种方法,方法一增加临时表空间的大小,方法二重建临时表空间,解决临时表空间过大的问题。

方案一:增加临时表空间的大小
--1.临时表空间的使用情况
SELECT D.tablespace_name,
       SPACE "SUM_SPACE(M)",       
       blocks "SUM_BLOCKS",      
       used_space "USED_SPACE(M)",       
       Round(Nvl(used_space, 0) / SPACE * 100, 2) "USED_RATE(%)",       
       SPACE - used_space "FREE_SPACE(M)"
  FROM (SELECT tablespace_name,              
               Round(SUM(bytes) / (1024 * 1024), 2) SPACE,               
               SUM(blocks) BLOCKS        
          FROM dba_temp_files        
         GROUP BY tablespace_name) D,       
       (SELECT tablespace,               
               Round(SUM(blocks * 8192) / (1024 * 1024), 2) USED_SPACE        
          FROM v$sort_usage        
         GROUP BY tablespace) F
 WHERE D.tablespace_name = F.tablespace(+)      
   AND D.tablespace_name like 'TEMP%';

--查看临时表空间的总大小和最大扩展大小(能看到数据文件)
select file_name,
       tablespace_name,
       bytes / 1024 / 1024 MB,
       autoextensible,
       maxbytes / 1024 / 1024 MAX_MB
  from dba_temp_files;

--增加临时表空间的大小
alter tablespace temp1 add tempfile '/data/prod/proddata/temp013.dbf' size 4G;
alter tablespace temp2 add tempfile '/data/prod/proddata/temp024.dbf' size 4G;

--方案二:重建临时表空间,解决临时表空间过大的问题。

--0.查看目前默认的临时表空间
select *
  from database_properties
 where property_name = 'DEFAULT_TEMP_TABLESPACE';

--1.创建中转临时表空间
create temporary tablespace temp3 tempfile '/data/prod/proddata/temp31.dbf' size 4G tablespace group temp;
create temporary tablespace temp4 tempfile '/data/prod/proddata/temp41.dbf' size 4G tablespace group temp;

--2.删除原临时表空间组中的临时表空间
--2.1从默认临时表空间组temp中移除temp1和temp2;
ALTER TABLESPACE temp1 TABLESPACE GROUP '';
ALTER TABLESPACE temp2 TABLESPACE GROUP '';

--2.2删除临时表空间temp1和temp2
drop tablespace temp1 including contents and datafiles;
drop tablespace temp2 including contents and datafiles;

--2.3如果删除表空间的时候,hang住的话,可以使用下列语句,先把运行在temp临时表空间的sql语句kill掉,这样的sql语句多为排序的语句
Select se.username,
       se.sid,
       se.serial#,
       su.extents,
       su.blocks * to_number(rtrim(p.value)) as Space,
       tablespace,
       segtype,
       sql_text
  from v$sort_usage su, v$parameter p, v$session se, v$sql s
 where p.name = 'db_block_size'
   and su.session_addr = se.saddr
   and s.hash_value = su.sqlhash
   and s.address = su.sqladdr
 order by se.username, se.sid;

--2.4 kill相关进程
alter system kill session '584,23181';
alter system kill session '196,64972';
alter system kill session '262,19832';
alter system kill session '324,40273';
alter system kill session '326,38967';
alter system kill session '1266,54596';
 
or
--重启DB
--关闭应用-->关闭监听-->shutdown immediate
--startup-->启动监听-->执行以下操作后打开应用

--2.5 创建临时表空间,并加入临时表空间组temp
create temporary tablespace temp1 tempfile '/data/prod/proddata/temp11.dbf' size 4G tablespace group temp;
create temporary tablespace temp2 tempfile '/data/prod/proddata/temp21.dbf' size 4G tablespace group temp;

--2.6 给临时表空间组temp的成员temp1,temp2,temp3,temp4 各增加一个成员。
alter tablespace temp1 add tempfile '/data/prod/proddata/temp12.dbf' size 4G;
alter tablespace temp2 add tempfile '/data/prod/proddata/temp22.dbf' size 4G;
alter tablespace temp3 add tempfile '/data/prod/proddata/temp32.dbf' size 4G;
alter tablespace temp4 add tempfile '/data/prod/proddata/temp42.dbf' size 4G;

--2.7查看临时表空间组temp
select * from dba_tablespace_groups;

--3 临时表空间组仍然使用99.98%,
--3.1为每个临时表空间添加4G空间
alter tablespace temp1 add tempfile '/data/prod/proddata/temp13.dbf' size 4G;
alter tablespace temp2 add tempfile '/data/prod/proddata/temp23.dbf' size 4G;
alter tablespace temp3 add tempfile '/data/prod/proddata/temp33.dbf' size 4G;
alter tablespace temp4 add tempfile '/data/prod/proddata/temp43.dbf' size 4G;

转载于:https://blog.51cto.com/peenboo/2083890

临时表空间过大解决方法相关推荐

  1. oracle临时表空间暴涨,如何解决Oracle临时表空间过大

    方案一:增加临时表空间的大小 1.临时表空间的使用情况题 SELECT D.tablespace_name, SPACE "SUM_SPACE(M)", blocks " ...

  2. C# Winform应用程序占用内存较大解决方法整理(转)-- SetProcessWorkingSetSize

    一.C# Winform应用程序占用内存较大解决方法整理(转) 原文:  http://www.jb51.net/article/56682.htm 背景: 微软的 .NET FRAMEWORK 现在 ...

  3. Linux1T大文件拷贝,U盘拷贝大于4G的iso文件时提示对于目标文件系统 文件过大解决方法全集...

    [文章导读] U盘在我们日常使用过程中已经在广泛的使用了,很多人都喜欢拷贝文件,u盘传输速度上的是非常快的,但是有不少用户在使用U盘过程中遇到问题,u盘不能拷贝超过4G的大文件,提示" U盘 ...

  4. SQL Server 2008 R2占用内存越来越大解决方法

    SQL Server 2008 R2占用内存越来越大解决方法 参考文章: (1)SQL Server 2008 R2占用内存越来越大解决方法 (2)https://www.cnblogs.com/pe ...

  5. C# Winform应用程序占用内存较大解决方法整理(转)

    C# Winform应用程序占用内存较大解决方法整理(转) 参考文章: (1)C# Winform应用程序占用内存较大解决方法整理(转) (2)https://www.cnblogs.com/xcsn ...

  6. 双系统(win7+ubuntu)ubuntu磁盘空间不足时解决方法

    双系统(win7+ubuntu)ubuntu磁盘空间不足时解决方法 参考文章: (1)双系统(win7+ubuntu)ubuntu磁盘空间不足时解决方法 (2)https://www.cnblogs. ...

  7. VMware中linux硬盘空间不足的解决方法

    VMware中linux硬盘空间不足的解决方法 参考文章: (1)VMware中linux硬盘空间不足的解决方法 (2)https://www.cnblogs.com/hbmlml/p/5511369 ...

  8. 计算机主机声音怎么办,电脑机箱声音大怎么办?电脑机箱声音大解决方法

    电脑机箱声音大怎么办? 电脑机箱声音大解决方法1.嗡嗡嗡的声音:如果只是嗡嗡的声音,则多数是风扇发出的声音,由于风扇使用过久,内部干燥等,自然会有一些小小的嗡嗡噪音,这些属于属于正常现象.如果需要解决 ...

  9. usb外接耳机声音过大解决方法

    usb外接耳机声音过大解决方法 前言 EqualizerAPO 前言 因为偶尔(每天)的打游戏需要,在某宝买了一个绿联的usb转3.5的转换器,因为机箱的前置3.5mm的插口有噪音,但是这个转换器声音 ...

最新文章

  1. C++中函数参数的默认值
  2. 网络:url?uri?
  3. SQL语法之排序查询(进阶3)and常见函数(进阶4)
  4. 初学__Python——Python数据类型之文件
  5. SparkStreaming Exception in thread main java.lang.IllegalArgumentException xxx is not a valid
  6. 使用基本工具类和预编译进行对数据库的增删改查
  7. 爆测一周,22年必看最细致代码托管工具测评
  8. golang python扩展_Python 利用Go语言编写 CPython 扩展 goPy的简单示例
  9. Maven 国内镜像
  10. PHP以指定字段为索引返回数组数据
  11. 带农历日期的html代码,网页日历代码 包含日期时间 阴历
  12. 股票成交量和价格关系
  13. uni-app生成pdf,依赖html2canvas和jspdf
  14. Jenkins不能正常trigger
  15. 抑郁症自我测试皮肤软件,皮肤瘙痒像虫子爬竟是抑郁症
  16. 打开Excel新窗口的方法
  17. 规范化:范式(主属性,非主属性,1NF,2NF,3NF,BCNF:定义,例子等)
  18. Rman Crosscheck删除失效归档(转)
  19. 论文写作神器,SCI 写作必备
  20. 在线Excel框架——luckysheet

热门文章

  1. SAP QM初阶之明明存在检验计划但是生成的检验批取不到?
  2. SAP QM Multiple Specifications的使用II
  3. SAP MM公司间STO里的一步法转库?
  4. 用于EAM的SAP PM移动应用程序
  5. 为什么用Go编写机器学习的基础架构,而不是Python?
  6. 刷手支付已来,亚马逊技术专利曝光,不侵犯隐私、秒速支付
  7. SAP QA32试图做UD,系统报错-工厂 BTYC中的 QM 基选设置需要维护
  8. 1亿参数4万样本BERT仍听不懂人话,我们离通用NLP能还有多远?
  9. python读写excel(合并单元格)
  10. python库pickle的用法