Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear all cached items in Oracle

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?

Thanks!

like image 517
Kevin Babcock Avatar asked Jan 27 '10 14:01

Kevin Babcock


People also ask

How do I flush the buffer cache in Oracle?

Use the following statement to flush the buffer cache. SQL> ALTER SYSTEM FLUSH BUFFER_CACHE; System altered.


1 Answers

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

like image 88
Doug Porter Avatar answered Sep 18 '22 07:09

Doug Porter