SQL查詢table或index異常增長問題 - space_usage (show_space)
前階段遇到的一個問題,一個Index在幾分鐘內忽然增長了6G左右,且增長的
這個block都是未格式化的塊,詳細情況見 :
http://www.itpub.net/thread-1349570-1-3.html
SQL> show serveroutput
serveroutput OFF
SQL>
SQL> set serveroutput on;
SQL> show serveroutput
serveroutput ON SIZE UNLIMITED FORMAT WORD_WRAPPED
SQL>
declare
l_fs1_bytes number;
l_fs2_bytes number;
l_fs3_bytes number;
l_fs4_bytes number;
l_fs1_blocks number;
l_fs2_blocks number;
l_fs3_blocks number;
l_fs4_blocks number;
l_full_bytes number;
l_full_blocks number;
l_unformatted_bytes number;
l_unformatted_blocks number;
begin
dbms_space.space_usage('DFMS',
'IDX1_WIP_D_WO_DETAIL_COMID',
'INDEX',
fs1_bytes=> l_fs1_bytes,
fs1_blocks => l_fs1_blocks,
fs2_bytes => l_fs2_bytes,
fs2_blocks => l_fs2_blocks,
fs3_bytes => l_fs3_bytes,
fs3_blocks => l_fs3_blocks,
fs4_bytes => l_fs4_bytes,
fs4_blocks => l_fs4_blocks,
full_bytes => l_full_bytes,
full_blocks => l_full_blocks,
unformatted_blocks => l_unformatted_blocks,
unformatted_bytes => l_unformatted_bytes );
dbms_output.put_line(' FS1 Blocks (0~25%) = '||l_fs1_blocks||' and Bytes = '||l_fs1_bytes);
dbms_output.put_line(' FS2 Blocks(25~50%) = '||l_fs2_blocks||' and Bytes = '||l_fs2_bytes);
dbms_output.put_line(' FS3 Blocks(50~75%) = '||l_fs3_blocks||' and Bytes = '||l_fs3_bytes);
dbms_output.put_line(' FS4 Blocks (75~100%)= '||l_fs4_blocks||' and Bytes = '||l_fs4_bytes);
dbms_output.put_line(' Full Blocks = '||l_full_blocks||' and Bytes = '||l_full_bytes);
dbms_output.put_line(' Unformatted Blocks = '||l_unformatted_blocks||' and Bytes = '||l_unformatted_bytes);
end;
/
FS1 Blocks(0~25%) = 0 and Bytes = 0
FS2 Blocks(25~50%) = 1548 and Bytes = 25362432
FS3 Blocks(50~75%) = 0 and Bytes = 0
FS4 Blocks(75~100%) = 0 and Bytes = 0
Full Blocks = 3405 and Bytes = 55787520
Unformatted Blocks = 1137328 and Bytes = 18633981952
目前為止,還沒有找到如何解決,為了及時發現類似bug導致的異常,我們需要定期檢視一些table, index,LOB等是否有異常增長的現象 。 我們可以設定如下SQL,
透過某個監控系統或schedule job定期查詢,一旦發現異常,及時回饋並處理。
select a.owner, a.segment_name, b.num_rows, a.bytes/1024/1024/1024||' G'
from dba_segments a, dba_tables b
where a.owner='DFMS' and a.segment_name=b.table_name
and a.segment_type in ('TABLE') and bytes>=8*1024*1024*1024
order by bytes desc ;
select a.owner, a.segment_name,b.table_name, b.num_rows,
a.bytes/1024/1024/1024||' G (Index Size)'
from dba_segments a, dba_indexes b
where a.owner='DFMS' and a.segment_name=b.index_name
and a.segment_type in ('INDEX') and a.bytes>=6*1024*1024*1024
order by a.bytes desc ;
select a.owner, a.segment_name,b.table_name, a.bytes/1024/1024/1024||' G (LOB Size)'
from dba_segments a, dba_lobs b
where a.owner='DFMS' and a.segment_name=b.segment_name
and a.segment_type in ('LOBSEGMENT') and a.bytes>=5*1024*1024*1024
order by a.bytes desc ;
相關的檢視:
select * from dba_tables ;
select * from dba_indexes ;
select * from dba_lobs ;
select * from dba_segments ;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-676718/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- sql 模糊查詢問題SQL
- Oracle資料庫日常問題-歸檔異常增長Oracle資料庫
- hibernate異常之--count查詢異常
- 深入sql多表差異化聯合查詢的問題詳解SQL
- SQL Server 查詢超時問題排查SQLServer
- mybatis-plus連線SQL Server2012分頁查詢異常MyBatisSQLServer
- SQL執行計劃異常引起的效能問題SQL
- SQL執行計劃異常 引起的效能問題SQL
- Laravel 中 sql 查詢 使用 group by 報錯問題。LaravelSQL
- SQL Server中Table字典資料的查詢SQL示例程式碼SQLServer
- 異常問題排查之旅
- 微服務異常問題微服務
- 子陣列異或和問題陣列
- 一些常見功能的查詢sqlSQL
- 10.Java異常問題Java
- 413周賽·第四題 - 3277. 查詢子陣列最大異或值陣列
- sql查詢入門練習題SQL
- 一次分割槽查詢異常的分析
- 常見面試SQL問題面試SQL
- el-table 多表格彈窗巢狀資料顯示異常錯亂問題巢狀
- SQL查詢的:子查詢和多表查詢SQL
- leetcode題解(查詢表問題)LeetCode
- Laravel5.7 查詢問題Laravel
- sphinx查詢過濾問題
- 原生SQL查詢SQL
- SQL--查詢SQL
- SQL 聚合查詢SQL
- 子陣列的最大異或和問題陣列
- Elasticsearch 或並查詢Elasticsearch
- React Native babel編譯異常問題React NativeBabel編譯
- Python異常 ValueError的問題詳解PythonError
- .net異常處理的效能問題
- Mybatis實現條件IN查詢(foreach)和invalid comparison異常MyBatis
- SQL面試題 三(單表、多表查詢)SQL面試題
- 由VIP漂移引發的演算法異常問題調查和解決演算法
- SQL增刪改查SQL
- SQLAlchemy in 查詢空列表問題分析SQL
- SQL查詢總結SQL
- SQL連線查詢SQL