Tuesday, December 7, 2010

Flushing Shared Pool

1-What does it do
Flushing the Shared Pool means clear all SQL statements that are in the
Shared Pool Area.

Oracle keeps track of each SQL statement that users execute.
It is stored parsed in memory so that if a SQL statement already has been
executed then Oracle does not need to re-parse it. The exception is if the Shared Pool Area is not large enough, then the least recently used SQL statements (except for pinned packages) will be removed from memory.
By flushing the Shared Pool, all SQL statements are removed from memory.
Flushing shared pool only gets rid of what it can, that which is in use will remain. any pinned objects will remain. any sql with shared cursors will remain.

2-How to Flush Shared Pool
By using this command ALTER SYSTEM FLUSH SHARED_POOL; you can flush the Shared Pool.
SQL> ALTER SYSTEM FLUSH SHARED_POOL;

And note that flushing the shared pool will NEVER empty out the v$sql view there will always be some stuff in there.

3-When should it be used
We use this command when the Shared Pool reaches a high limit like 90% of the shared pool size.

No comments: