oracle空间及归档查询sql
-----查看用户表所占用表空间 select OWNER, t.segment_name, t.segment_type, sum(t.bytes / 1024 / 1024) mmm from dba_segments t where /*t.owner = '你要查询的用户' */ /*and */t.segment_type='TABLE' group by OWNER, t.segment_name, t.segment_type order by mmm desc; -- 查看归档表空间使用情况 select trunc(first_time),count(*),round(sum(blocks*block_size)/1024/1024/1024,2) BLOCK5 from v$archived_log a where a.DEST_ID=1 group by trunc(first_time);
--查看还原空间使用情况(归档空间不足时查看) select t.object_name,bytes / 1024 / 1024/1024 as SIZE_M,t.original_name,t.operation,t.createtime,t.droptime from dba_recyclebin t join dba_segments t1 on t.object_name=t1.segment_name where t.owner='QR_USER' order by bytes desc; ; -- 查看表空间使用情况 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; -- 查看segment空间使用情况 SELECT segment_name, tablespace_name, r.status, (initial_extent / 1024) initialextent, (next_extent / 1024) nextextent, max_extents, v.curext curextent FROM dba_rollback_segs r, v$rollstat v WHERE r.segment_id = v.usn(+) ORDER BY segment_name;
分类:
20数据库 / 16oracle
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具