DBMS_DICTIONARY_CHECK

DBMS_DICTIONARY_CHECK is a read-only and lightweight PL/SQL package procedure that helps you identify Oracle Database dictionary inconsistencies.

Overview of Oracle Database Dictionary Check

DBMS_DICTIONARY_CHECK is a read-only and lightweight PL/SQL package procedure that helps you identify Oracle Database dictionary inconsistencies that are manifested in unexpected entries in the Oracle Database dictionary tables or invalid references between dictionary tables. Oracle Database dictionary inconsistencies can cause process failures and, in some cases, instance crash. Such inconsistencies may be exposed to internal ORA-00600 errors. DBMS_DICTIONARY_CHECK assists you in identifying such inconsistencies and in some cases provides guided remediation to resolve the problem and avoid such database failures.

Unexpected entries in the dictionary tables or invalid references between dictionary tables, for example, include the following:

Using DBMS_DICTIONARY_CHECK

To run all the checks or only the critical checks defined by DBMS_DICTIONARY_CHECK, connect to the SYS schema, and then run the following commands as SYS user:

Full check

SQL> set serveroutput on size unlimited
SQL> execute dbms_dictionary_check.full
SQL> set serveroutput on size unlimited
SQL> EXECUTE dbms_dictionary_check.full(repair=>TRUE)

While running a full check, optionally, you can use the repair option to resolve inconsistencies. Valid values: TRUE|FALSE. Default: FALSE.

Critical check

SQL> set serveroutput on size unlimited
SQL> execute dbms_dictionary_check.critical

Optionally, turn on the spool to redirect the output to a server-side flat file. By default, when you query the SYS schema, the DBMS_DICTIONARY_CHECK package creates a trace file named, DICTCHECK.trc.

For example: /<path>/diag/rdbms/<db_name>/<oracle_sid>/trace/<oracle_sid>_<ora>_<pid>_DICTCHECK.trc.

The execution reports the result as:

Note: In all cases, any output reporting “problems” must be triaged by Oracle Support to confirm if any action is required.

Example 81-1 Full check run

SQL> set serveroutput on size unlimited
SQL> execute dbms_dictionary_check.full
dbms_dictionary_check on 07-MAR-2023 03:17:48
----------------------------------------------
Catalog Version 21.0.0.0.0 (2300000000)
db_name: ORCL
Is CDB?: NO
Trace File: /oracle/log/diag/rdbms/orcl/orcl/trace/orcl_ora_2574906_DICTCHECK.trc

                                   Catalog       Fixed
Procedure Name                     Version    Vs Release    Timestamp      Result
------------------------------ ... ---------- -- ---------- -------------- ------
.- OIDOnObjCol                 ... 2300000000 <=  *All Rel* 03/07 03:17:48 PASS
.- LobNotInObj                 ... 2300000000 <=  *All Rel* 03/07 03:17:48 PASS
.- SourceNotInObj              ... 2300000000 <=  *All Rel* 03/07 03:17:48 PASS
.- OversizedFiles              ... 2300000000 <=  *All Rel* 03/07 03:17:48 PASS
.- PoorDefaultStorage          ... 2300000000 <=  *All Rel* 03/07 03:17:48 PASS
.- PoorStorage                 ... 2300000000 <=  *All Rel* 03/07 03:17:48 PASS
.- TabPartCountMismatch        ... 2300000000 <=  *All Rel* 03/07 03:17:49 PASS
.- TabComPartObj               ... 2300000000 <=  *All Rel* 03/07 03:17:49 PASS
.- Mview                       ... 2300000000 <=  *All Rel* 03/07 03:17:49 PASS
.- ValidDir                    ... 2300000000 <=  *All Rel* 03/07 03:17:49 PASS
.- DuplicateDataobj            ... 2300000000 <=  *All Rel* 03/07 03:17:49 PASS
.- ObjSyn                      ... 2300000000 <=  *All Rel* 03/07 03:17:49 PASS
.- ObjSeq                      ... 2300000000 <=  *All Rel* 03/07 03:17:49 PASS
.- UndoSeg                     ... 2300000000 <=  *All Rel* 03/07 03:17:49 PASS
.- IndexSeg                    ... 2300000000 <=  *All Rel* 03/07 03:17:49 PASS
.- IndexPartitionSeg           ... 2300000000 <=  *All Rel* 03/07 03:17:49 PASS
.- IndexSubPartitionSeg        ... 2300000000 <=  *All Rel* 03/07 03:17:49 PASS
.- TableSeg                    ... 2300000000 <=  *All Rel* 03/07 03:17:49 FAIL

HCKE-0019: Orphaned TAB$ (no SEG$) (Doc ID 1360889.1)
ORPHAN TAB$: OBJ#=83241 DOBJ#=83241 TS=5 RFILE/BLOCK=5/11 TABLE=SYS.ORPHANSEG BOBJ#=

.- TablePartitionSeg           ... 2300000000 <=  *All Rel* 03/07 03:17:49 PASS
.- TableSubPartitionSeg        ... 2300000000 <=  *All Rel* 03/07 03:17:49 PASS
.- PartCol                     ... 2300000000 <=  *All Rel* 03/07 03:17:49 PASS
.- ValidSeg                    ... 2300000000 <=  *All Rel* 03/07 03:17:49 FAIL

HCKE-0023: Orphaned SEG$ Entry (Doc ID 1360934.1)
ORPHAN SEG$: SegType=LOB TS=5 RFILE/BLOCK=5/26

.- IndPartObj                  ... 2300000000 <=  *All Rel* 03/07 03:17:49 PASS
.- DuplicateBlockUse           ... 2300000000 <=  *All Rel* 03/07 03:17:49 PASS
.- FetUet                      ... 2300000000 <=  *All Rel* 03/07 03:17:49 PASS
.- Uet0Check                   ... 2300000000 <=  *All Rel* 03/07 03:17:49 PASS
.- SeglessUET                  ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- ValidInd                    ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- ValidTab                    ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- IcolDepCnt                  ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- ObjIndDobj                  ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- TrgAfterUpgrade             ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- ObjType0                    ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- ValidOwner                  ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- StmtAuditOnCommit           ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- PublicObjects               ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- SegFreelist                 ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- ValidDepends                ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- CheckDual                   ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- ObjectNames                 ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- ChkIotTs                    ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- NoSegmentIndex              ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- NextObject                  ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- DroppedROTS                 ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- FilBlkZero                  ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- DbmsSchemaCopy              ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- IdnseqObj                   ... 2300000000 >  1201000000 03/07 03:17:50 PASS
.- IdnseqSeq                   ... 2300000000 >  1201000000 03/07 03:17:50 PASS
.- ObjError                    ... 2300000000 >  1102000000 03/07 03:17:50 PASS
.- ObjNotLob                   ... 2300000000 <=  *All Rel* 03/07 03:17:50 FAIL

HCKE-0049: OBJ$ LOB entry has no LOB$ or LOBFRAG$ entry (Doc ID 2125104.1)
OBJ$ LOB has no LOB$ entry: Obj=83243 Owner: SYS LOB Name: LOBC1

.- MaxControlfSeq              ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- SegNotInDeferredStg         ... 2300000000 >  1102000000 03/07 03:17:50 PASS
.- SystemNotRfile1             ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- DictOwnNonDefaultSYSTEM     ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- ValidateTrigger             ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- ObjNotTrigger               ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
.- InvalidTSMaxSCN             ... 2300000000 >  1202000000 03/07 03:17:50 CRITICAL

HCKE-0054: TS$ has Tablespace with invalid Maximum SCN (Doc ID 1360208.1)
TS$ has Tablespace with invalid Maximum SCN: TS#=5 Tablespace=HCHECK Online$=1

.- OBJRecycleBin               ... 2300000000 <=  *All Rel* 03/07 03:17:50 PASS
---------------------------------------
07-MAR-2023 03:17:50  Elapsed: 2 secs
---------------------------------------
Found 4 potential problem(s) and 0 warning(s)
Found 1 CRITICAL problem(s) needing attention
Contact Oracle Support with the output and trace file
to check if the above needs attention or not
BEGIN dbms_dictionary_check.full; END;

*
ERROR at line 1:
ORA-20000: dbms_dictionary_check found 1 critical issue(s).  Trace file:
/oracle/log/diag/rdbms/orcl/orcl/trace/orcl_ora_2574906_DICTCHECK.trc

SQL>

Example 81-2 Full check run with repair option

SQL> set serveroutput on size unlimited
SQL> EXECUTE dbms_dictionary_check.full(repair=>TRUE)
dbms_dictionary_check on 04-OCT-2023 01:35:37
----------------------------------------------
Catalog Version 23.0.0.0.0 (2300000000)
db_name: orcl
Is CDB?: NO
Trace File: /oracle/log/diag/rdbms/orcl/orcl/trace/orcl_ora_3831454_DICTCHECK.trc
                                   Catalog       Fixed
Procedure Name                     Version    Vs Release    Timestamp      Result
------------------------------ ... ---------- -- ---------- -------------- ------
.- OIDOnObjCol                 ... 2300000000 <=  *All Rel* 10/04 01:35:37 PASS
.- LobNotInObj                 ... 2300000000 <=  *All Rel* 10/04 01:35:37 PASS
.- SourceNotInObj              ... 2300000000 <=  *All Rel* 10/04 01:35:38 FAIL

HCKE-0003: SOURCE$ for OBJ# not in OBJ$ (Doc ID 1360233.1)
SOURCE$ has 10 rows for 1 OBJ# values not in OBJ$


INCONSISTENCY REPAIRED - Check the trace file for repair details:
SourceNotInObj_Repair: DELETED 10 objects from SOURCE$ not found in OBJ$

.- OversizedFiles              ... 2300000000 <=  *All Rel* 10/04 01:35:38 PASS
.- PoorDefaultStorage          ... 2300000000 <=  *All Rel* 10/04 01:35:38 PASS
.- PoorStorage                 ... 2300000000 <=  *All Rel* 10/04 01:35:38 PASS
.- TabPartCountMismatch        ... 2300000000 <=  *All Rel* 10/04 01:35:38 PASS
.- TabComPartObj               ... 2300000000 <=  *All Rel* 10/04 01:35:38 PASS
.- Mview                       ... 2300000000 <=  *All Rel* 10/04 01:35:38 PASS
.- ValidDir                    ... 2300000000 <=  *All Rel* 10/04 01:35:38 PASS
.- DuplicateDataobj            ... 2300000000 <=  *All Rel* 10/04 01:35:38 PASS
.- ObjSyn                      ... 2300000000 <=  *All Rel* 10/04 01:35:39 PASS
.- ObjSeq                      ... 2300000000 <=  *All Rel* 10/04 01:35:39 PASS
.- ValidateSeg                 ... 2300000000 <=  *All Rel* 10/04 01:35:39 FAIL

HCKE-0023: Orphaned SEG$ Entry (Doc ID 1360934.1)
ORPHAN SEG$: SegType=DATA TS=5 RFILE/BLOCK=5/11 HWMINCR(DOBJ#)=73271

.- TableSeg                    ... 2300000000 <=  *All Rel* 10/04 01:35:39 PASS
.- TablePartitionSeg           ... 2300000000 <=  *All Rel* 10/04 01:35:39 PASS
.- TableSubPartitionSeg        ... 2300000000 <=  *All Rel* 10/04 01:35:39 PASS
ORPHAN SEG$: SegType=DATA TS=5 RFILE/BLOCK=5/11
^ Segment entry repaired - Converted to TEMPORARY
INCONSISTENCY REPAIRED - Check the trace file for repair details:
ValidateSeg repaired 1 Orphan Seg$ entries

.- UndoSeg                     ... 2300000000 <=  *All Rel* 10/04 01:35:39 PASS
...
---------------------------------------
04-OCT-2023 01:35:40  Elapsed: 3 secs
---------------------------------------
Found 3 potential problem(s) and 0 warning(s)
Repaired 11 item(s)
Contact Oracle Support with the output and trace file
to check if the above needs attention or not
BEGIN dbms_dictionary_check.full(repair=>TRUE); END;

*
ERROR at line 1:
ORA-20001: dbms_dictionary_check found 3 problem(s) and repaired 11 item(s).  Trace file:
/oracle/log/diag/rdbms/orcl/orcl/trace/orcl_ora_3831454_DICTCHECK.trc

Example 81-3 Critical check run

SQL> set serveroutput on size unlimited
SQL> execute dbms_dictionary_check.critical
dbms_dictionary_check on 07-MAR-2023 03:12:23
----------------------------------------------
Catalog Version 21.0.0.0.0 (2100000000)
db_name: ORCL
Is CDB?: NO
Trace File: /oracle/log/diag/rdbms/orcl/orcl/trace/orcl_ora_2574058_DICTCHECK.trc

                                   Catalog       Fixed
Procedure Name                     Version    Vs Release    Timestamp      Result
------------------------------ ... ---------- -- ---------- -------------- ------
.- UndoSeg                     ... 2300000000 <=  *All Rel* 03/07 03:12:23 PASS
.- MaxControlfSeq              ... 2300000000 <=  *All Rel* 03/07 03:12:23 PASS
.- InvalidTSMaxSCN             ... 2300000000 >  1202000000 03/07 03:12:23 CRITICAL

HCKE-0054: TS$ has Tablespace with invalid Maximum SCN (Doc ID 1360208.1)
TS$ has Tablespace with invalid Maximum SCN: TS#=5 Tablespace=HCHECK Online$=1

---------------------------------------
07-MAR-2023 03:12:23  Elapsed: 0 secs
---------------------------------------
Found 1 potential problem(s) and 0 warning(s)
Found 1 CRITICAL problem(s) needing attention
Contact Oracle Support with the output and trace file
to check if the above needs attention or not
BEGIN dbms_dictionary_check.critical; END;

*
ERROR at line 1:
ORA-20000: dbms_dictionary_check found 1 critical issue(s).  Trace file:
/oracle/log/diag/rdbms/orcl/orcl/trace/orcl_ora_2574058_DICTCHECK.trc

SQL>

Summary of DBMS_DICTIONARY_CHECK Subprograms

DBMS_DICTIONARY_CHECK package includes the following procedures:

Example 81-4 ValidateSeg with repair option

SQL> EXECUTE dbms_dictionary_check.ValidateSeg(repair=>TRUE)
.- ValidateSeg                 ... 2300000000 <=  *All Rel* 10/04 01:30:21 FAIL

HCKE-0023: Orphaned SEG$ Entry (Doc ID 1360934.1)
ORPHAN SEG$: SegType=DATA TS=5 RFILE/BLOCK=5/11 HWMINCR(DOBJ#)=73270

.- TableSeg                    ... 2300000000 <=  *All Rel* 10/04 01:30:21 PASS
.- TablePartitionSeg           ... 2300000000 <=  *All Rel* 10/04 01:30:21 PASS
.- TableSubPartitionSeg        ... 2300000000 <=  *All Rel* 10/04 01:30:21 PASS
ORPHAN SEG$: SegType=DATA TS=5 RFILE/BLOCK=5/11
^ Segment entry repaired - Converted to TEMPORARY
INCONSISTENCY REPAIRED - Check the trace file for repair details:
ValidateSeg repaired 1 Orphan Seg$ entries

PL/SQL procedure successfully completed.

Example 81-5 SourceNotInObj with repair option

SQL> EXECUTE dbms_dictionary_check.SourceNotInObj(repair=>TRUE)
dbms_dictionary_check on 04-OCT-2023 01:30:20
----------------------------------------------
Catalog Version 23.0.0.0.0 (2300000000)
db_name: orcl
Is CDB?: NO
Trace File: /oracle/log/diag/rdbms/orcl/orcl/trace/orcl_ora_3831239_DICTCHECK.trc

                                   Catalog       Fixed
Procedure Name                     Version    Vs Release    Timestamp      Result
------------------------------ ... ---------- -- ---------- -------------- ------
.- SourceNotInObj              ... 2300000000 <=  *All Rel* 10/04 01:30:20 FAIL

HCKE-0003: SOURCE$ for OBJ# not in OBJ$ (Doc ID 1360233.1)
SOURCE$ has 10 rows for 1 OBJ# values not in OBJ$


INCONSISTENCY REPAIRED - Check the trace file for repair details:
SourceNotInObj_Repair: DELETED 10 objects from SOURCE$ not found in OBJ$

PL/SQL procedure successfully completed.