SQL Performance (MOSC)

MOSC Banner

Lock schema stats - need for clarify

edited Apr 13, 2016 2:42PM in SQL Performance (MOSC) 6 commentsAnswered ✓

Hi,

due problems while nightly collecting statistics in a specified schema I wanted to lock temporarily this schema with

exec dbms_stats.LOCK_SCHEMA_STATS('inspire');

I thought this will exclude that from nightly maintanance jobs. But locking the entire schema had seemingly no affect.

I tested it out in my testenv with Oracle 12c and 11g:

If you lock a schema your are still able to collect entire schema stats with:

SQL> exec dbms_stats.LOCK_SCHEMA_STATS('inspire');
PL/SQL-Prozedur erfolgreich abgeschlossen.
SQL> exec dbms_stats.gather_SCHEMA_STATS('inspire');
PL/SQL-Prozedur erfolgreich abgeschlossen.

Only if you want to collect stats from on table from that locked schema you get the expected error:

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center