如何在不使用 OEM 的情况下检查上次在 Oracle 上运行统计信息的时间

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2374951/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 02:27:03  来源:igfitidea点击:

How can I check the last time stats was run on Oracle without using OEM

oracleoracle10gsqlplusstatistics

提问by Jacob

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.

我想检查上次在我的 Oracle 10g 服务器上运行 stats 的时间。我通常会通过 OEM 执行此操作,但由于无关的原因 OEM 已关闭。有什么方法可以仅使用 sqlplus 进行检查吗?如果输出的格式合理,那将更加有用。

回答by Adam Musch

All of the following data dictionary tables have a LAST_ANALYZED column (replace * with USER/ALL/DBA as appropriate:

以下所有数据字典表都有一个 LAST_ANALYZED 列(根据需要将 * 替换为 USER/ALL/DBA:

*_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_MODIFICATIONSshows rows inserted/updated/deleted (or the timestamp on which a table/partition/subpartition was truncated) since it had optimizer statistics gathered.

相反,ALL_TAB_MODIFICATIONS显示插入/更新/删除的行(或表/分区/子分区被截断的时间戳),因为它收集了优化器统计信息。

回答by David Mann

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.

您可能需要根据您的 SQLPLUS/NLS 设置调整日期格式。