主頁 > 知識庫 > Oracle查詢最近幾天每小時歸檔日志產(chǎn)生數(shù)量的腳本寫法

Oracle查詢最近幾天每小時歸檔日志產(chǎn)生數(shù)量的腳本寫法

熱門標(biāo)簽:海南400電話哪里辦理 南寧人工智能電銷機器人費用 貴陽電話外呼系統(tǒng)哪家好 400電話是不是免費申請 濟南地圖標(biāo)注公司 呼倫貝爾智能手機地圖標(biāo)注 圖像地圖標(biāo)注 安陽外呼系統(tǒng)免費 分布式呼叫中心

下面給大家分享Oracle查詢最近幾天每小時歸檔日志產(chǎn)生數(shù)量的腳本寫法,腳本如下所示:

SELECT SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH:MI:SS'),1,5) Day,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'00',1,0)) H00,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'01',1,0)) H01,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'02',1,0)) H02,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'03',1,0)) H03,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'04',1,0)) H04,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'05',1,0)) H05,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'06',1,0)) H06,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'07',1,0)) H07,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'08',1,0)) H08,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'09',1,0)) H09,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'10',1,0)) H10,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'11',1,0)) H11,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'12',1,0)) H12,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'13',1,0)) H13,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'14',1,0)) H14,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'15',1,0)) H15,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'16',1,0)) H16,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'17',1,0)) H17,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'18',1,0)) H18,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'19',1,0)) H19,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'20',1,0)) H20,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'21',1,0)) H21,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'22',1,0)) H22,
    SUM(DECODE(SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH24:MI:SS'),10,2),'23',1,0)) H23,
    COUNT(*) TOTAL
FROM v$log_history a
WHERE first_time>=to_char(sysdate-10)
GROUP BY SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH:MI:SS'),1,5)
ORDER BY SUBSTR(TO_CHAR(first_time, 'MM/DD/RR HH:MI:SS'),1,5) DESC;

修改天數(shù),可以修改WHERE first_time>=to_char(sysdate-11) 

執(zhí)行結(jié)果

總結(jié)

以上所述是小編給大家介紹的Oracle查詢最近幾天每小時歸檔日志產(chǎn)生數(shù)量的腳本寫法,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

您可能感興趣的文章:
  • oracle 查詢當(dāng)天數(shù)據(jù)的sql條件寫法
  • oracle使用to_date查詢一周的第一天日期
  • oracle實現(xiàn)按天,周,月,季度,年查詢排序方法
  • Oracle 獲取上周一到周末日期的查詢sql語句
  • Oracle中查詢本月星期5的所有日期列表的語句
  • Oracle查詢優(yōu)化日期運算實例詳解
  • oracle查詢截至到當(dāng)前日期月份所在年份的所有月份
  • Oracle實現(xiàn)查詢2個日期所跨過的月份列表/日期列表的方法分析
  • oracle實現(xiàn)動態(tài)查詢前一天早八點到當(dāng)天早八點的數(shù)據(jù)功能示例

標(biāo)簽:滁州 焦作 郴州 涼山 南充 遼源 合肥 許昌

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Oracle查詢最近幾天每小時歸檔日志產(chǎn)生數(shù)量的腳本寫法》,本文關(guān)鍵詞  Oracle,查詢,最,近幾天,每小時,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Oracle查詢最近幾天每小時歸檔日志產(chǎn)生數(shù)量的腳本寫法》相關(guān)的同類信息!
  • 本頁收集關(guān)于Oracle查詢最近幾天每小時歸檔日志產(chǎn)生數(shù)量的腳本寫法的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章