oracle+查表物理块数,如何统计一段时间内 发生在某个表上的 物理读写的块数
script from maclean
http://www.askmaclean.com/archiv ... t-grow-history.html
Script:查找表或索引增長的歷史信息
MARCH 22, 2012 BY MACLEAN LIU 4 COMMENTS
有同學(xué)在Oracle ALL STARS群中提問 如何通過AWR來查找一段時間內(nèi),數(shù)據(jù)庫段對象(堆表、索引)等的空間增長信息。
在Oracle 10g開始awr自動負(fù)載倉庫引入了dba_hist_seg_stat視圖,該視圖記錄了快照時間內(nèi)segment-level段級的歷史統(tǒng)計(jì)信息:DBA_HIST_SEG_STAT displays historical information about segment-level statistics. This view captures the top segments based on a set of criteria and captures information from V$SEGSTAT. The total value is the value of the statistics since instance startup. The delta value is the value of the statistics from the BEGIN_INTERVAL_TIME to the END_INTERVAL_TIME in the DBA_HIST_SNAPSHOT view.
我們可以通過以下SQL腳本來列出相關(guān)段對象在 快照時間內(nèi)的使用空間的歷史變化信息:
column owner format a16
column object_name format a36
column start_day format a11
column block_increase format 9999999999
select? ?obj.owner, obj.object_name,
to_char(sn.BEGIN_INTERVAL_TIME,'RRRR-MON-DD') start_day,
sum(a.db_block_changes_delta) block_increase
from? ???dba_hist_seg_stat a,
dba_hist_snapshot sn,
dba_objects obj
where? ? sn.snap_id = a.snap_id
and? ?? ?obj.object_id = a.obj#
and? ?? ?obj.owner not in ('SYS','SYSTEM')
and? ?? ?end_interval_time between to_timestamp('01-JAN-2000','DD-MON-RRRR')
and to_timestamp('02-FEB-2013','DD-MON-RRRR')
group by obj.owner, obj.object_name,
to_char(sn.BEGIN_INTERVAL_TIME,'RRRR-MON-DD')
order by obj.owner, obj.object_name
/
修改可得:
select? ?obj.owner, obj.object_name,
to_char(sn.BEGIN_INTERVAL_TIME,'RRRR-MON-DD') start_day,
sum(a.PHYSICAL_READS_DELTA) block_read
from? ???dba_hist_seg_stat a,
dba_hist_snapshot sn,
dba_objects obj
where? ? sn.snap_id = a.snap_id
and? ?? ?obj.object_id = a.obj#
and? ?? ?obj.owner not in ('SYS','SYSTEM')
and? ?? ?end_interval_time between to_timestamp('01-JAN-2000','DD-MON-RRRR')
and to_timestamp('02-FEB-2013','DD-MON-RRRR')
group by obj.owner, obj.object_name,
to_char(sn.BEGIN_INTERVAL_TIME,'RRRR-MON-DD')
order by obj.owner, obj.object_name
/
總結(jié)
以上是生活随笔為你收集整理的oracle+查表物理块数,如何统计一段时间内 发生在某个表上的 物理读写的块数的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 教你快速查询并筛选出代收的所有快递单号查
- 下一篇: oracle 磁盘挂载格式化,Linux