1WITH hours AS (
2 SELECT trunc(sysdate) + ((LEVEL - 1) / 24) AS HOURS
3 FROM DUAL
4 CONNECT BY LEVEL < = 24
5)
6SELECT h.HOURS AS DATE_HOUR,
7 round(sum(BLOCKS * BLOCK_SIZE) / 1e9, 2) SIZE_GB
8FROM hours h
9 LEFT OUTER JOIN V$ARCHIVED_LOG al ON h.HOURS = trunc(al.FIRST_TIME, 'HH24')
10GROUP BY h.HOURS
11ORDER BY h.HOURS;