日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
用Oracle中的Statspack診斷數(shù)據(jù)庫性能實(shí)例

通過Statspack我們可以很容易的確定Oracle數(shù)據(jù)庫的瓶頸所在,記錄數(shù)據(jù)庫性能狀態(tài),也可以使遠(yuǎn)程技術(shù)支持人員迅速了解你的數(shù)據(jù)庫運(yùn)行狀況。因此了解和使用Statspack對于DBA來說至關(guān)重要。

創(chuàng)新互聯(lián)-專業(yè)網(wǎng)站定制、快速模板網(wǎng)站建設(shè)、高性價(jià)比長汀網(wǎng)站開發(fā)、企業(yè)建站全套包干低至880元,成熟完善的模板庫,直接使用。一站式長汀網(wǎng)站制作公司更省心,省錢,快速模板網(wǎng)站建設(shè)找我們,業(yè)務(wù)覆蓋長汀地區(qū)。費(fèi)用合理售后完善,10余年實(shí)體公司更值得信賴。

整理分析結(jié)果

可以通過各種工具建立圖表,使我們收集的數(shù)據(jù)更直觀,更有說服力。
以下是我給一個客戶做的分析報(bào)告的實(shí)例。

1.物理讀寫IO操作:

觀察物理IO訪問,可以看出數(shù)據(jù)庫日常訪問的峰值及繁忙程度。

腳本:此腳本按時(shí)間生成統(tǒng)計(jì)數(shù)據(jù)(注:以下示例以8i為基礎(chǔ),SQL腳本中引用的statistic#在不同版本代表的意義可能不同,對于9i等版本,你應(yīng)該修改相應(yīng)參數(shù)值)

SQL代碼

select
substr(to_char(snap_time,'yyyy-mm-ddHH24:MI:SS'),12),
(newreads.value-oldreads.value)reads,
(newwrites.value-oldwrites.value)writes
from
perfstat.stats$sysstatoldreads,
perfstat.stats$sysstatnewreads,
perfstat.stats$sysstatoldwrites,
perfstat.stats$sysstatnewwrites,
perfstat.stats$snapshotsn
where
newreads.snap_id=sn.snap_id
and
newwrites.snap_id=sn.snap_id
and
oldreads.snap_id=sn.snap_id-1
and
oldwrites.snap_id=sn.snap_id-1
and
oldreads.statistic#=40
and
newreads.statistic#=40
and
oldwrites.statistic#=41
and
newwrites.statistic#=41
and
(newreads.value-oldreads.value)>0
and
(newwrites.value-oldwrites.value)>0

select
substr(to_char(snap_time,'yyyy-mm-ddHH24:MI:SS'),12),
(newreads.value-oldreads.value)reads,
(newwrites.value-oldwrites.value)writes
from
perfstat.stats$sysstatoldreads,
perfstat.stats$sysstatnewreads,
perfstat.stats$sysstatoldwrites,
perfstat.stats$sysstatnewwrites,
perfstat.stats$snapshotsn
where
newreads.snap_id=sn.snap_id
and
newwrites.snap_id=sn.snap_id
and
oldreads.snap_id=sn.snap_id-1
and
oldwrites.snap_id=sn.snap_id-1
and
oldreads.statistic#=40
and
newreads.statistic#=40
and
oldwrites.statistic#=41
and
newwrites.statistic#=41
and
(newreads.value-oldreads.value)>0
and
(newwrites.value-oldwrites.value)>0
/

圖表:

分析:

從趨勢圖中我們可以看出,數(shù)據(jù)庫每日讀操作較為平穩(wěn),數(shù)據(jù)量大約在4000左右。在下午2點(diǎn)到5點(diǎn)期
間比較繁忙。峰值達(dá)到150000左右。

數(shù)據(jù)庫寫操作變化也比較平穩(wěn),數(shù)據(jù)改變量在80000左右,凌晨一點(diǎn)半到早晨8點(diǎn)半左右數(shù)據(jù)庫訪問極少。
這是一個以寫為主的數(shù)據(jù)庫,我們需要更多注意的是寫競爭。

2.Buffer命中率

Sql代碼


select
substr(to_char(snap_time,'yyyy-mm-ddHH24:MI'),12),
round(100*(((a.value-e.value)+(b.value-f.value))-(c.value-g.value))/
((a.value-e.value)+(b.value-f.value)))
"BUFFERHITRATIO"
from
perfstat.stats$sysstata,
perfstat.stats$sysstatb,
perfstat.stats$sysstatc,
perfstat.stats$sysstatd,
perfstat.stats$sysstate,
perfstat.stats$sysstatf,
perfstat.stats$sysstatg,
perfstat.stats$snapshotsn
where
a.snap_id=sn.snap_id
and
b.snap_id=sn.snap_id
and
c.snap_id=sn.snap_id
and
d.snap_id=sn.snap_id
and
e.snap_id=sn.snap_id-1
and
f.snap_id=sn.snap_id-1
and
g.snap_id=sn.snap_id-1
and
a.statistic#=39
and
e.statistic#=39
and
b.statistic#=38
and
f.statistic#=38
and
c.statistic#=40
and
g.statistic#=40
and
d.statistic#=41

select
substr(to_char(snap_time,'yyyy-mm-ddHH24:MI'),12),
round(100*(((a.value-e.value)+(b.value-f.value))-(c.value-g.value))/
((a.value-e.value)+(b.value-f.value)))
"BUFFERHITRATIO"
from
perfstat.stats$sysstata,
perfstat.stats$sysstatb,
perfstat.stats$sysstatc,
perfstat.stats$sysstatd,
perfstat.stats$sysstate,
perfstat.stats$sysstatf,
perfstat.stats$sysstatg,
perfstat.stats$snapshotsn
where
a.snap_id=sn.snap_id
and
b.snap_id=sn.snap_id
and
c.snap_id=sn.snap_id
and
d.snap_id=sn.snap_id
and
e.snap_id=sn.snap_id-1
and
f.snap_id=sn.snap_id-1
and
g.snap_id=sn.snap_id-1
and
a.statistic#=39
and
e.statistic#=39
and
b.statistic#=38
and
f.statistic#=38
and
c.statistic#=40
and
g.statistic#=40
and
d.statistic#=41

圖表:

分析:

Buffer(bufferhitratio)命中率是考察Oracle數(shù)據(jù)庫性能的重要指標(biāo),它代表在內(nèi)存中找到需要數(shù)據(jù)的比
率,一般來說,如果該值小于90%,則可能說明數(shù)據(jù)庫存在大量代價(jià)昂貴的IO操作,數(shù)據(jù)庫需要調(diào)整。
我們數(shù)據(jù)庫的buffer命中率幾乎接近100%,最低值在95%左右,這個比率是比較優(yōu)化的。

安裝statspack

SQL>connect/assysdba

SQL>@?/rdbms/admin/spcreate

卸載

SQL>connect/assysdba
SQL>@?/rdbms/admin/spdrop
/*
收集信息前把timed_statistics=true;
altersystemsettimed_statistics=true;
*/

收集信息

SQL>connectperfstat/perfstat
SQL>executestatspack.snap;

自動收集

SQL>connectperfstat/perfstat
SQL>@?/rdbms/admin/spauto

刪掉自動收集的job.

SQL>select*fromuser_jobs;

SQL>execdbms_job.remove(JOB_ID)

/*
executestatspack.snap(i_snap_level=>10,i_modify_parameter=>'true');
Levels=5Additionaldata:SQLStatements
Levels=6Thislevelincludesallstatisticsgatheredinthelowerlevel(s).

Levels=7segmentslevelstatistics
Levels=10Additionalstatistics:Childlatches
i_modify_parameter=>'true'/'false'決定是否保存level的值,下一次執(zhí)行繼續(xù)使用
*/

產(chǎn)生報(bào)告

SQL>conectperfstat/perfstat
SQL>@?/rdbms/admin/spreport

文章標(biāo)題:用Oracle中的Statspack診斷數(shù)據(jù)庫性能實(shí)例
分享鏈接:http://m.5511xx.com/article/codijdc.html