20160111-log switch 統計SQL
日誌切換統計SQL,參考論壇網友,
select trunc(first_time) "Date",to_char(first_time,'Dy') "day",count(1) "Total",
sum(decode(to_char(first_time,'HH24'),'00',1,0)) H0,
sum(decode(to_char(first_time,'HH24'),'01',1,0)) H1,
sum(decode(to_char(first_time,'HH24'),'02',1,0)) H2,
sum(decode(to_char(first_time,'HH24'),'03',1,0)) H3,
sum(decode(to_char(first_time,'HH24'),'04',1,0)) H4,
sum(decode(to_char(first_time,'HH24'),'05',1,0)) H5,
sum(decode(to_char(first_time,'HH24'),'06',1,0)) H6,
sum(decode(to_char(first_time,'HH24'),'07',1,0)) H7,
sum(decode(to_char(first_time,'HH24'),'08',1,0)) H8,
sum(decode(to_char(first_time,'HH24'),'09',1,0)) H9,
sum(decode(to_char(first_time,'HH24'),'10',1,0)) H10,
sum(decode(to_char(first_time,'HH24'),'11',1,0)) H11,
sum(decode(to_char(first_time,'HH24'),'12',1,0)) H12,
sum(decode(to_char(first_time,'HH24'),'13',1,0)) H13,
sum(decode(to_char(first_time,'HH24'),'14',1,0)) H14,
sum(decode(to_char(first_time,'HH24'),'15',1,0)) H15,
sum(decode(to_char(first_time,'HH24'),'16',1,0)) H16,
sum(decode(to_char(first_time,'HH24'),'17',1,0)) H17,
sum(decode(to_char(first_time,'HH24'),'18',1,0)) H18,
sum(decode(to_char(first_time,'HH24'),'19',1,0)) H19,
sum(decode(to_char(first_time,'HH24'),'20',1,0)) H20,
sum(decode(to_char(first_time,'HH24'),'21',1,0)) H21,
sum(decode(to_char(first_time,'HH24'),'22',1,0)) H22,
sum(decode(to_char(first_time,'HH24'),'23',1,0)) H23,round(count(1)/24,2) "Avg"
from gv$log_history
where first_time>sysdate-10 group by trunc(first_time),to_char(first_time,'Dy')
order by 1 desc;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-1974800/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 統計報表 -- sql統計語句SQL
- 專案sql統計SQL
- 【sql調優】系統資訊統計SQL
- 統計介面sql語句SQL
- SQL Server 更新統計資訊SQLServer
- 【統計資訊】全面檢視錶所有統計資訊SQLSQL
- SQL 中的統計應用SQL
- Oracle時間模型統計SQLOracle模型SQL
- sql統計-關於學生成績SQL
- 統計分頁一些sqlSQL
- 【SCRIPT】Oracle統計資訊相關SQLOracleSQL
- SQL行轉列統計問題SQL
- SQL Server 2000 建立統計SQLServer
- SQL Server統計資料庫中表大小SQLServer資料庫
- SQL優化之統計資訊和索引SQL優化索引
- 統計沒有繫結變數SQL變數SQL
- 收集統計資訊的SQL指令碼(sosi.sql)--崔華大師SQL指令碼
- session switchSession
- 微課sql最佳化(3)、統計資訊收集(2)-如何收集統計資訊SQL
- 微課sql最佳化(8)、統計資訊收集(6)-統計資訊查詢SQL
- SQL Server 監控統計阻塞指令碼資訊SQLServer指令碼
- 生產sql調優之統計資訊分析SQL
- sql語句面試題(城市人口統計)SQL面試題
- Oracle按時間分組統計的sqlOracleSQL
- SQL Server 按照條件統計雨量資料SQLServer
- SQL Server 統計報表(不斷收藏中)SQLServer
- 管好統計資訊,開啟SQL優化之門SQL優化
- SQL Server 2005:查詢統計資訊SQLServer
- 檢視錶的統計資訊SQL指令碼SQL指令碼
- SQLServer統計監控SQL執行計劃突變的方法SQLServer
- 一個2600萬資料的SQL統計,SQL調優(原創)SQL
- SVG <switch>元素SVG
- Java switch caseJava
- js switch 使用JS
- log file switch
- Go之旅-SwitchGo
- switch default 作用
- java之switchJava