Sunday, 20 January 2013

last_analyzed Oracle tables


select table_name, last_analyzed, num_rows
from user_tables
where last_analyzed < sysdate - 1
order by 3;


select trunc(last_analyzed) "LAST_ANALYZED",
count(*), decode(db_unique_name,null,name,db_unique_name) DBNAME, to_char(sysdate,'DD-MON-YYYY HH24:MI:SS') "RUNTIME"
from dba_tables, v$database
where owner='<username>' and last_analyzed >= sysdate-20
group by trunc(last_analyzed), decode(db_unique_name,null,name,db_unique_name)
order by trunc(last_analyzed);

No comments:

Post a Comment