oracle大表碎片分析整理 show_space分析

Oracle大表碎片分析整理

expdp导出表耗时6分钟,预估大小69.7GB,导出大小6.8GB,大概有61GB的碎片

利用show_space查看表的相关信息如下:

复制代码
Total Blocks............................9136640
Total Bytes.............................74847354880
Unused Blocks...........................0
Unused Bytes............................0
Last Used Ext FileId....................8
Last Used Ext BlockId...................1712256
Last Used Block.........................8192
The segment is analyzed.
0% -- 25% free space blocks.............6
0% -- 25% free space bytes..............49152
25% -- 50% free space blocks............9
25% -- 50% free space bytes.............73728
50% -- 75% free space blocks............19
50% -- 75% free space bytes.............155648
75% -- 100% free space blocks...........8006297
75% -- 100% free space bytes............65587585024  --->> ≈ 61GB
Unused Blocks...........................0
Unused Bytes............................0
Total Blocks............................1121012
Total bytes.............................9183330304
 -----------------------------------------------

清理碎片之前磁盘队列很高

对表做了truncate之后再次查看,以及过了8小时之后查看的结果对比如下:

复制代码
truncate后的数据:

PL/SQL 过程已成功完成。
Total Blocks............................8192 			 		---->总分配的数据块数量
Total Bytes.............................67108864 			---->总分配的数据块大小 8192*8*1024
Unused Blocks...........................8158   				---->未使用的数据块数量
Unused Bytes............................66830336			---->未使用的数据块大小 8158*8*1024
Last Used Ext FileId....................4
Last Used Ext BlockId...................875520
Last Used Block.........................34
The segment is analyzed.
0% -- 25% free space blocks.............0
0% -- 25% free space bytes..............0
25% -- 50% free space blocks............0
25% -- 50% free space bytes.............0
50% -- 75% free space blocks............0
50% -- 75% free space bytes.............0
75% -- 100% free space blocks...........0
75% -- 100% free space bytes............0
Unused Blocks...........................0
Unused Bytes............................0
Total Blocks............................0
Total bytes.............................0
 -----------------------------------------------

8小时后再次查看

PL/SQL 过程已成功完成。
Total Blocks............................8192
Total Bytes.............................67108864
Unused Blocks...........................7936
Unused Bytes............................65011712
Last Used Ext FileId....................4
Last Used Ext BlockId...................875520
Last Used Block.........................256
The segment is analyzed.
0% -- 25% free space blocks.............2
0% -- 25% free space bytes..............16384
25% -- 50% free space blocks............2
25% -- 50% free space bytes.............16384
50% -- 75% free space blocks............3
50% -- 75% free space bytes.............24576
75% -- 100% free space blocks...........69
75% -- 100% free space bytes............565248
Unused Blocks...........................142
Unused Bytes............................1163264
Total Blocks............................4
Total bytes.............................32768
 -----------------------------------------------

PL/SQL 过程已成功完成。

对表做一次统计信息收集后再查看一次

复制代码
execute dbms_stats.gather_table_stats(ownname => 'test',tabname => 'tabname' ,estimate_percent => null ,method_opt => 'for all indexed columns' ,cascade => true);

Total Blocks............................8192
Total Bytes.............................67108864
Unused Blocks...........................7936
Unused Bytes............................65011712
Last Used Ext FileId....................4
Last Used Ext BlockId...................875520
Last Used Block.........................256
The segment is analyzed.
0% -- 25% free space blocks.............1
0% -- 25% free space bytes..............8192
25% -- 50% free space blocks............3
25% -- 50% free space bytes.............24576
50% -- 75% free space blocks............1
50% -- 75% free space bytes.............8192
75% -- 100% free space blocks...........69
75% -- 100% free space bytes............565248
Unused Blocks...........................142
Unused Bytes............................1163264
Total Blocks............................6
Total bytes.............................49152
 -----------------------------------------------

PL/SQL 过程已成功完成。

清理之后磁盘队列基本为0

相关推荐
坐吃山猪18 分钟前
ChromaDB02-代码实战
数据库·向量数据库·chromadb
摇滚侠20 分钟前
MySQL 中 utf8mb4 字符集,字母a占几个字节,一个汉字占几个字节 / MySQL 中 utf8mb3 字符集,字母a占几个字节,一个汉字占几个字节
数据库·mysql
ChineHe26 分钟前
Redis数据类型篇001_数据类型梳理与选择指南
数据库·redis·缓存
Antoine-zxt30 分钟前
MySQL CPU飙升至500%的深度排查与优化实践
数据库·mysql
Awkwardx34 分钟前
MySQL数据库—MySQL基本查询
数据库·mysql
夜流冰34 分钟前
Excel - MS Support for Excel: 2 Collaborate
数据库·windows·excel
轻微的风格艾丝凡41 分钟前
嵌入式定时器计时技巧:用有符号数省略溢出判断的底层逻辑与实践
数据库·算法·dsp开发·嵌入式软件
Lonely丶墨轩1 小时前
从登录入口窥见架构:一个企业级双Token认证系统的深度拆解
java·数据库·sql
收获不止数据库1 小时前
黄仁勋2026CES演讲复盘:旧世界,裂开了!
大数据·数据库·人工智能·职场和发展
汽车仪器仪表相关领域2 小时前
工况模拟精准检测,合规减排赋能行业 ——NHASM-1 型稳态工况法汽车排气检测系统项目实战经验分享
数据库·算法·单元测试·汽车·压力测试·可用性测试