Oracle Buffer Cache Flushing

Performance testing in Oracle can be difficult when trying to compare results from two different environments.  One way to get a more accruate apple to apple comparison is to flush the data buffer cache. 

Note that this is for testing purposes only and should not be considered a recommendation in a live production system.

Oracle 9i and up:

alter session set events ‘immediate trace name flush_cache’;

Oracle 10g and up:

alter system flush buffer_cache;

You can also flush the shared pool of the SGA by using the command:

alter system flush shared_pool;