如何清除Oracle中的所有缓存项目

问题描述:

我正在调整Oracle数据库上的SQL查询.我想确保在运行每个查询之前清除所有缓存的项目,以防止误导性能结果.我通过运行以下命令清除共享池(摆脱缓存的SQL/解释计划)和缓冲区缓存(摆脱缓存的数据):

I'm tuning SQL queries on an Oracle database. I want to ensure that all cached items are cleared before running each query in order to prevent misleading performance results. I clear out the shared pool (to get rid of cached SQL/explain plans) and buffer cache (to get rid of cached data) by running the following commands:

alter system flush buffer_cache;
alter system flush shared_pool;

我还有更多要做的事情吗?

Is there more I should be doing, or is this sufficient?

谢谢!

刷新共享池应该可以做到,但是Tom Kyte列举了以下几个原因,在某些情况下您可能无法获得预期的结果:

Flushing the shared pool should do it, but Tom Kyte lists a couple reasons below why you may not get the result you are expecting in some cases:

http://asktom .oracle.com/pls/asktom/f?p = 100:11:0 ::::: P11_QUESTION_ID:6349391411093