ORA-20000: Insufficient privileges to analyze an object in Dictionary Schema

Today, I was trying to apply the database 12.1.0.2 BP 221018 (October 2022). As usual, for all bundle patches, I have to call datapatch utility twice due to some strange errors during the first execution.

However, this time the patch apply process was giving me this strange ORA-20000 error: ORA-20000: Insufficient privileges to analyze an object in Dictionary Schema

SQL Patching tool version 12.1.0.2.0 Production on Wed Oct 26 19:32:33 2022
Copyright (c) 2012, 2017, Oracle.  All rights reserved.

Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_7269_2022_10_26_19_32_33/sqlpatch_invocation.log

Connecting to database...OK
Note:  Datapatch will only apply or rollback SQL fixes for PDBs
       that are in an open state, no patches will be applied to closed PDBs.
       Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
       (Doc ID 1585822.1)
Bootstrapping registry and package to current versions...done
Determining current state...done

Current state of SQL patches:
Bundle series DBBP:
  ID 221018 in the binary registry and ID 221018 in PDB CDB$ROOT, ID 221018 with errors in PDB PDB$SEED, ID 221018 with errors in PDB PDB01

Adding patches to installation queue and performing prereq checks...
Installation queue:
  For the following PDBs: CDB$ROOT
    Nothing to roll back
    Nothing to apply
  For the following PDBs: PDB$SEED PDB01
    Nothing to roll back
    The following patches will be applied:
      34386250 (DATABASE BUNDLE PATCH 12.1.0.2.221018)

Installing patches...
Patch installation complete.  Total patches installed: 2

Validating logfiles...
Patch 34386250 apply (pdb PDB$SEED): WITH ERRORS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/34386250/24939610/34386250_apply_ORCL_PDBSEED_2022Oct26_19_33_03.log (errors)
    Error at line 8178: ORA-20000: Insufficient privileges to analyze an object in Dictionary Schema
Patch 34386250 apply (pdb PDB01): WITH ERRORS
  logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/34386250/24939610/34386250_apply_ORCL_PDB01_2022Oct26_19_33_03.log (errors)
    Error at line 8178: ORA-20000: Insufficient privileges to analyze an object in Dictionary Schema

Please refer to MOS Note 1609718.1 and/or the invocation log
/u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_7269_2022_10_26_19_32_33/sqlpatch_invocation.log
for information on how to resolve the above errors.

SQL Patching tool complete on Wed Oct 26 19:35:42 2022

Note the error was only happening on the PDBs, not on the CDB.

Checking the datapatch PDB log file contents, I could find this entry:

SQL>
SQL> BEGIN
  2    dbms_registry.loaded('OLS', dbms_registry.release_version,
  3              'Oracle Label Security Release ' ||
  4              dbms_registry.release_version    ||
  5              ' - ' || dbms_registry.release_status);
  6    SYS.validate_ols;
  7  END;
  8  /
BEGIN
*
ERROR at line 1:
ORA-20000: Insufficient privileges to analyze an object in Dictionary Schema
ORA-06512: at "SYS.DBMS_STATS", line 40552
ORA-06512: at "SYS.DBMS_REGISTRY_SYS", line 1412
ORA-06512: at "SYS.DBMS_REGISTRY", line 708
ORA-06512: at line 2

It was something related to dbms_registry.loaded.

After doing some MOS research, I found a similar know issue in this note: Oracle Database Proactive Patch 12.1.0.2.190716 Known Issues (Doc ID 2534844.1), which is for an older release.

In certain situations the Post-install actions (datapatch -verbose) may fail for DBBP 12.1.0.2.190716:

    ...
    Error at line 33699: ORA-20000: Insufficient privileges to analyze an object in Dictionary Schema

When this occurs, it is simply a consequence of the order that certain actions are performed within the "datapatch" process. The workaround is simply to run 'datapatch –verbose' a second time.

A fix for this will be included into a future quarterly DBBP.

So after executing the datapatch for the 3rd time, finally I got no errors.

Conclusion: call datapatch 3x to apply 12.1.0.2 BP 221018.

Have you enjoyed? Please leave a comment or give a 👍!

Leave a Reply

Your email address will not be published.