My Oracle Support Banner

ORA-20000 'Insufficient Privileges' While Executing DBMS_STATS.GATHER_SCHEMA_STATS (Doc ID 309834.1)

Last updated on MAY 19, 2022

Applies to:

Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Database Cloud Schema Service - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Backup Service - Version N/A and later
Oracle Database Cloud Exadata Service - Version N/A and later
Information in this document applies to any platform.


NOTE: In the images and/or the document content below, the user information and data used represents fictitious data from the Oracle sample schema(s) or Public Documentation delivered with an Oracle database product. Any similarity to actual persons, living or dead, is purely coincidental and not intended in any manner.

ORA-20000 while executing "dbms_stats.gather_schema_stats" is dumped while trying to generate statistics.

Example of the error:

Connect as user <user_name>

User <user_name> has DBA role granted.

DBA role includes "analyze any" system privilege.

Also granted "analyze any" privilege explicitly to user <user_name>.

SQL> exec dbms_stats.gather_schema_stats('SCOTT',degree=>4,cascade=>TRUE,estimate_percent=>35);
BEGIN dbms_stats.gather_schema_stats('SCOTT',degree=>4,cascade=>TRUE,estimate_percent=>35); END;
ERROR at line 1:
ORA-20000: Insufficient privileges to analyze an object in Schema
ORA-06512: at "SYS.DBMS_STATS", line 10583
ORA-06512: at "SYS.DBMS_STATS", line 10751
ORA-06512: at "SYS.DBMS_STATS", line 10805
ORA-06512: at "SYS.DBMS_STATS", line 10782
ORA-06512: at line 1



To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.