Ny harm to current sessions when flushing buffer cache and shared pool

oracle

I want to know if I run the following commands in Oracle, if it will affect any currently running queries. I plan to have someone run them in a dev environment and I haven't done this before. Not sure how long, on average, they will take either. Server is running Oracle 12c.

alter system flush buffer_cache;
alter system flush shared_pool;

Best Answer

flush shared_pool doesn't affect currently running queries, no. I think it would cause errors if it did. From the docs:

This statement does not clear global application context information, nor does it clear shared SQL and PL/SQL areas for items that are currently being executed.

I can't find any details about whether flush buffer_cache affects currently running queries. If it does, I'd guess it would just cause cache misses, and the queries would finish a bit slower than usual.