SELECT
t.owner,
t.table_name,
s.tablespace_name,
ROUND(s.bytes / 1024 / 1024, 2) AS size_mb,
t.num_rows,
t.last_analyzed,
o.last_ddl_time AS last_modified
FROM dba_tables t
JOIN dba_segments s
ON t.owner = s.owner
AND t.table_name = s.segment_name
AND s.segment_type = 'TABLE'
JOIN dba_objects o
ON t.owner = o.owner
AND t.table_name = o.object_name
AND o.object_type = 'TABLE'
WHERE t.owner = 'YOUR_SCHEMA'
AND REGEXP_LIKE(t.table_name,
'(\d+$|' || -- ends with number
'(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)|' || -- short months
'(JANUARY|FEBRUARY|MARCH|APRIL|JUNE|JULY|AUGUST|SEPTEMBER|OCTOBER|NOVEMBER|DECEMBER)|' ||
'(20[0-9]{2}[_]?(0[1-9]|1[0-2])$|' || -- ends in YYYYMM or YYYY_MM
'(0[1-9]|1[0-2])(20[0-9]{2})$)', 'i')
ORDER BY size_mb DESC;





0 comments:
Post a Comment