oracle 回收表空间的数据文件大小
查看表空间的使用情况:
select a.tablespace_name,a.bytes/1024/1024 "Sum MB",(a.bytes-b.bytes)/1024/1024 "used MB",b.bytes/1024/1024 "free MB", round(((a.bytes-b.bytes)/a.bytes)*100,2) "percent_used" from (select tablespace_name,sum(bytes) bytes from dba_data_files group by tablespace_name) a, (select tablespace_name,sum(bytes) bytes,max(bytes) largest from dba_free_space group by tablespace_name) b where a.tablespace_name=b.tablespace_name order by ((a.bytes-b.bytes)/a.bytes) desc
回收表空间数据文件
select 'alter database datafile '''||a.file_name||''' resize ' ||round(a.filesize - (a.filesize - c.hwmsize-100) *0.8)||'M;',
a.filesize,c.hwmsize from ( select file_id,file_name,round(bytes/1024/1024) filesize from dba_data_files ) a, ( select file_id,round(max(block_id)*8/1024) HWMsize from dba_extents group by file_id) c where a.file_id = c.file_id and a.filesize - c.hwmsize > 100
执行回收reize数据文件的sql
alter database datafile '/home/oracledb/dbf/data_rhipgz.dbf' resize 2816M; alter database datafile '/home/oracledb/dbf/medical_supplies_demo.dbf' resize 126M; alter database datafile '/home/oracledb/dbf/ids_test.dbf' resize 118M; alter database datafile '/home/oracle/oracledb/oracledb/dbf/cis_pharmacy.dbf' resize 3646M; alter database datafile '/u01/app/oracle/oradata/orcl/data_pivas_nj.dbf' resize 2177M; alter database datafile '/home/oracledb/dbf/medical_supplies_demo2.dbf' resize 172M; alter database datafile '/home/oracledb/dbf/DATA_CIS_TEST_04.dbf' resize 28703M; alter database datafile '/home/oracledb/dbf/DATA_CIS_TEST_07.dbf' resize 28754M; alter database datafile '/home/oracledb/dbf/rhip.dbf' resize 105M; alter database datafile '/home/oracledb/dbf/hip_tend.dbf' resize 1529M;
本文来自博客园,作者:VipSoft 转载请注明原文链接:https://www.cnblogs.com/vipsoft/p/9516945.html
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
· C++代码改造为UTF-8编码问题的总结
· DeepSeek 解答了困扰我五年的技术问题
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· 清华大学推出第四讲使用 DeepSeek + DeepResearch 让科研像聊天一样简单!
· 实操Deepseek接入个人知识库
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
2012-08-22 DB2JAVIT:RC=9505解决方案