<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Decode360's Blog

    業(yè)精于勤而荒于嬉 QQ:150355677 MSN:decode360@hotmail.com

      BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 ::  :: 管理 ::
      302 隨筆 :: 26 文章 :: 82 評論 :: 0 Trackbacks
    一、重要的腳本
    ?
    ??? 1、通過導出保存及共享數(shù)據(jù)
    ?
    ??? 有時需要將原始數(shù)據(jù)導出后,請教專業(yè)人士進行分析,可以使用spuexp.par,內(nèi)容如下:
    ?
    ??? file=spuexp.dmp log=spuexp.log compress=y grants=y indexes=y rows=y constraints=y owner=PERFSTAT consistent=y
    ?
    ??? 使用一下腳本進行導出:
    ?
    ??? SQL> host exp userid=perfstat/perfstat parfile=E:\oracle\product\10.2.0\db_1\RDBMS\ADMIN\spuexp.par
    ??? ... ...
    ??? 成功終止導出, 沒有出現(xiàn)警告。
    ?
    ??? 在當前目錄下生成spuexp.dmp文件。
    ?
    ??? 2、刪除數(shù)據(jù)腳本
    ?
    ??? 用于刪除數(shù)據(jù)的spdrop.sql腳本主要調(diào)用了spdtab.sql和spdusr.sql兩個腳本
    ??? spdtab.sql用于刪除表和同義詞
    ??? spdusr.sql用于刪除用戶
    ?
    ?
    二、調(diào)整Statspack收集選項
    ?
    ??? Statspack有兩種類型的收集選項:級別(level)、門限(threshold)
    ?
    ??? 1、級別(level)
    ?
    ??? 一共分為三個級別,分別是0、5、10,默認是5。
    ?
    ??? ① level 0:一般性統(tǒng)計。包括等待事件、系統(tǒng)事件、系統(tǒng)統(tǒng)計、回滾段統(tǒng)計、行緩存、SGA、會話鎖、緩沖池統(tǒng)計等
    ??? ② level 5:增加SQL語句。SQL語句收集結果放在stats$sql_summary中
    ??? ③ level 10:增加子鎖存統(tǒng)計。將附加子鎖存入stats$lathc_children中(本級別建議在oracle support指導下進行)
    ?
    ??? 修改方式:
    ?
    ??? ① SQL> execute statspack.snap(i_snap_level=>0,modify_parameter=>'true'); --以后都修改
    ??? ② SQL> execute statspack.snap(i_snap_level=>10); --只修改本次
    ?
    ??? 2、快照門限
    ?
    ??? 門限只用于stats$sql_summary表中獲取的SQL語句。由于每個快照都會收集很多數(shù)據(jù),每一行都代表獲取快照時數(shù)據(jù)庫中的一個SQL語句,因此stats$sql_summary很快就會成為Statspack中最大的表,所以需要加門限進行限制。
    ?
    ??? executions_th:SQL語句執(zhí)行的數(shù)量(默認值100)
    ??? disk_reads_th:SQL語句執(zhí)行的磁盤讀入數(shù)(默認值1000)
    ??? parse_calls_th:SQL語句執(zhí)行的解析調(diào)用數(shù)量(默認值1000)
    ??? buffer_gets_th:SQL語句執(zhí)行的緩沖區(qū)獲取的數(shù)量(默認值10000)
    ?
    ??? 任何一個門限值超過以上參數(shù)就會產(chǎn)生一條記錄。
    ?
    ??? 使用一下腳本修改門限的默認值:
    ?
    ??? SQL> execute statspack.modify_statspack_parameter(i_buffer_gets_th=>100000,i_disk_reads_th=>100000);
    ?
    ???
    ?
    三、整理分析結果
    ?
    ?
    ??? Statspack進行快照采集之后,會在stats$sysstat表中,針對每個snap生成N行數(shù)據(jù),每一行表示當前某一項參數(shù)的值,具體的參數(shù)代碼及名稱可以使用以下腳本查詢:
    ?
    ??? SQL> select distinct statistic#,name from stats$sysstat order by 1;
    ?
    ??? statistic# name
    ??? ---------- ------------------------------------
    ?????????????0?logons cumulative
    ???????????? 1?logons current
    ????????? ?? 2?opened cursors cumulative
    ???????????? 3?opened cursors current
    ??????????? ?4?user?commits
    ??? ... ...
    ?
    ??? 1、物理讀寫IO操作:
    ?
    select sn.snap_id,
    ?????? to_char(snap_time, 'hh24:mi:ss') sp_time,
    ?????? (newreads.value - oldreads.value) reads,
    ?????? (newwrites.value - oldwrites.value) writes
    ? from stats$sysstat? oldreads,
    ?????? stats$sysstat? newreads,
    ?????? stats$sysstat? oldwrites,
    ?????? stats$sysstat? newwrites,
    ?????? stats$snapshot sn
    ?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# = 37
    ?? and newreads.statistic# = 37
    ?? and oldwrites.statistic# = 40
    ?? and newwrites.statistic# = 40
    ?? and (newreads.value - oldreads.value) > 0
    ?? and (newwrites.value - oldwrites.value) > 0;
    ?
    ??? 該SQL表述了在各個時間段中的IO物理讀和IO物理寫的數(shù)量,可用于分析各個時間段的峰值以及平均IO量,以減少競爭。
    ?
    ??? 2、Buffer命中率:
    ?
    select sn.snap_id,
    ?????? to_char(snap_time, 'hh24:mi:ss') sp_time,
    ?????? round(100 *
    ???????????? ((a.value - d.value) + (b.value - e.value) - (c.value - f.value))
    ?????????? / ((a.value - d.value) + (b.value - e.value))) "Buffer Hit Ratio"
    ? from stats$sysstat? a,
    ?????? stats$sysstat? b,
    ?????? stats$sysstat? c,
    ?????? stats$sysstat? d,
    ?????? stats$sysstat? e,
    ?????? stats$sysstat? f,
    ?????? stats$snapshot sn
    ?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 - 1
    ?? and e.snap_id = sn.snap_id - 1
    ?? and f.snap_id = sn.snap_id - 1
    ?? and a.statistic# = 47
    ?? and d.statistic# = 47
    ?? and b.statistic# = 50
    ?? and e.statistic# = 50
    ?? and c.statistic# = 54
    ?? and f.statistic# = 54;
    ?
    ??? 注:Buffer Hit Ratio = (db block gets + consistent gets - physical reads) / (db block gets + consistent gets)
    ?
    ?
    ?
    ?




    -The End-

    posted on 2009-01-19 21:50 decode360-3 閱讀(215) 評論(0)  編輯  收藏 所屬分類: Oracle
    主站蜘蛛池模板: 成人免费一区二区无码视频| 成人av片无码免费天天看| 麻豆视频免费观看| 亚洲精品视频免费在线观看| 日韩免费电影网址| 精品亚洲成a人片在线观看少妇| 日韩中文字幕免费视频| 色播亚洲视频在线观看| 最近免费中文字幕高清大全| 亚洲精品一区二区三区四区乱码 | 午夜一级免费视频| 最新国产成人亚洲精品影院| 无限动漫网在线观看免费| 亚洲国产精品免费观看| 国产真人无遮挡作爱免费视频| 免费的黄网站男人的天堂| 亚洲国产午夜福利在线播放| 永久在线观看免费视频 | 免费观看的av毛片的网站| 白白色免费在线视频| 国产亚洲精aa成人网站| 日韩免费的视频在线观看香蕉| 91亚洲精品麻豆| 国产小视频在线观看免费| 97超高清在线观看免费视频| 亚洲精品国产成人| 国产一区在线观看免费| a级毛片毛片免费观看久潮| 亚洲国产成人精品激情| 免费成人黄色大片| 精品在线免费观看| 亚洲人成77777在线播放网站不卡| 免费夜色污私人影院在线观看| 可以免费观看的国产视频| 亚洲日本人成中文字幕| 亚洲视频在线精品| 每天更新的免费av片在线观看| 日韩毛片在线免费观看| 亚洲韩国在线一卡二卡| 免费在线不卡视频| 国产在线观看片a免费观看|