I want to check the last time stats was run on my Oracle 10g server. I would normally do this via OEM, but for unrelated reasons OEM is down. Is there some way I can check this using just sqlplus? It would be extra helpful if the output was reasonably formatted.
+2
A:
SELECT LAST_START_DATE
FROM DBA_SCHEDULER_JOBS
WHERE job_name='GATHER_STATS_JOB';
You may have to tweak the date format depending on your SQLPLUS/NLS Settings.
David Mann
2010-03-03 21:48:07
+3
A:
All of the following data dictionary tables have a LAST_ANALYZED column (replace * with USER/ALL/DBA as appropriate:
*_TABLES
*_TAB_PARTITIONS
*_TAB_SUBPARTITIONS
*_INDEXES
*_IND_PARTITIONS
*_IND_SUBPARTITIONS
(There's lots more in the histograms fields, but I'm not going that deep.)
Conversely, ALL_TAB_MODIFICATIONS
shows rows inserted/updated/deleted (or the timestamp on which a table/partition/subpartition was truncated) since it had optimizer statistics gathered.
Adam Musch
2010-03-03 21:52:04
In my setup stats was only running for one user so this worked very well. SQL I used (logged in as that user) was:SELECT TO_CHAR(last_analyzed, 'yyyy/mm/dd hh:mi:ss am') as last_analyzed FROM user_tables where table_name = <table_in_my_schema>
Jacob
2010-03-03 23:22:11