這篇文章給大家分享的是有關(guān)Oracle如何查看歷史TOP SQL的內(nèi)容。小編覺得挺實(shí)用的,因此分享給大家做個參考,一起跟隨小編過來看看吧。
專注于為中小企業(yè)提供成都網(wǎng)站制作、成都網(wǎng)站設(shè)計(jì)服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)樂東黎族免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動了成百上千家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。
Oracle 查看歷史TOP SQL
歷史TOP SQL可以通過AWR直接查看,
但是有時AWR信息顯示不全,默認(rèn)只顯示TOP 10,
可以通過dba_hist_sqltext,dba_hist_sqlstat等查看更詳細(xì)的信息;
---查看快照信息
---選擇2018-06-14全天的快照6504-6528;
---conn chenjch/chenjch
select SNAP_ID,
DBID,
to_char(BEGIN_INTERVAL_TIME, 'yyyy-mm-dd hh34:mi:ss'),
to_char(END_INTERVAL_TIME, 'yyyy-mm-dd hh34:mi:ss'),
FLUSH_ELAPSED,
SNAP_LEVEL
from dba_hist_snapshot order by 1;
---1 查看2018-06-14全天SQL ordered by Elapsed Time
---時間單位默認(rèn)microseconds
select a.sql_id,
a.module,
a.elap,
a.exec,
decode(a.exec, 0, to_number(null), (a.elap / a.exec)) elap_one,
b.sql_text
from dba_hist_sqltext b,
(select sql_id,
max(module) module,
sum(elapsed_time_delta) / 1000000 elap,
sum(executions_delta) exec
from dba_hist_sqlstat
where dbid = 1000919065
and instance_number = 1
and 6504 < snap_id
and snap_id <= 6528
group by sql_id) a
where a.sql_id = b.sql_id
order by elap desc;
---2 查看2018-06-14全天SQL ordered by Gets
---時間單位默認(rèn)microseconds
select a.sql_id,
a.module,
a.bget,
decode(a.exec, 0, to_number(null), a.bget / a.exec) get_per_exec,
a.exec,
(a.cput/1000000)/elap*100 CPU,
a.elap,
b.sql_text
from dba_hist_sqltext b,
(select sql_id,
max(module) module,
sum(buffer_gets_delta) bget,
sum(executions_delta) exec,
sum(cpu_time_delta) cput,
sum(elapsed_time_delta) / 1000000 elap
from dba_hist_sqlstat
where dbid = 1000919065
and instance_number = 1
and 6504 < snap_id
and snap_id <= 6528
group by sql_id) a
where a.sql_id = b.sql_id
order by bget desc;
---3 查看2018-06-14全天SQL ordered by Reads
---時間單位默認(rèn)microseconds
select a.sql_id,
a.module,
a.diskread,
a.exec,
decode(a.exec, 0, to_number(null), a.diskread / a.exec) diskread_one,
(a.cput/1000000)/elap*100 CPU,
a.elap,
b.sql_text
from dba_hist_sqltext b,
(select sql_id,
max(module) module,
sum(disk_reads_delta) diskread,
sum(executions_delta) exec,
sum(cpu_time_delta) cput,
sum(elapsed_time_delta) / 1000000 elap
from dba_hist_sqlstat
where dbid = 1000919065
and instance_number = 1
and 6504 < snap_id
and snap_id <= 6528
group by sql_id) a
where a.sql_id = b.sql_id
order by diskread desc;
感謝各位的閱讀!關(guān)于“Oracle如何查看歷史TOP SQL”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,讓大家可以學(xué)到更多知識,如果覺得文章不錯,可以把它分享出去讓更多的人看到吧!
本文名稱:Oracle如何查看歷史TOPSQL
本文網(wǎng)址:http://jinyejixie.com/article2/ghheoc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、自適應(yīng)網(wǎng)站、移動網(wǎng)站建設(shè)、微信公眾號、定制網(wǎng)站、商城網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)