This query lists the top 10 accessed objects in the last 30 minutes, including their access counts and percentage of total accesses:

SELECT
    NVL(o.object_name, 'Unknown') AS object_name,
    NVL(o.object_type, 'Unknown') AS object_type,
    COUNT(*) AS total_accesses,
    TO_CHAR(100 * TRUNC(RATIO_TO_REPORT(COUNT(*)) OVER (), 6), 'FM990.9999') || '%' AS "%"
FROM
    v$active_session_history a
    LEFT JOIN dba_objects o ON a.current_obj# = o.object_id
WHERE
    a.sample_time > SYSDATE - 30 / 60 / 24
GROUP BY
    o.object_name,
    o.object_type
ORDER BY
    total_accesses DESC
FETCH FIRST 10 ROWS ONLY;

Sample output:

OBJECT_NAME                 OBJECT_TYPE     TOTAL_ACCESSES %
Unknown                     Unknown                    286 87.1951%
MAP_OBJECT                  TABLE                       28 8.5365%
SYS_LOB0000009065C00008$$   LOB                         14 4.2682%

I’m Yuan

Welcome to the blog of a performance maven in Oracle & MySQL. Feel free to contact me to share and discuss database knowledge.

My 20 Oracle Certifications

A screenshot from certview.oracle.com

My Book

MySQL 8.0 Operations and Optimization

Let’s connect