在 Oracle 23c 中,DBMS_HCHECK 包允许我们检查数据库中已知的数据字典问题。
几年前,Oracle 发布了 hcheck.sql 脚本(文档 ID 136697.1)来检查数据库中已知的数据字典问题。DBMS_HCHECK 包意味着我们不再需要下载 hcheck.sql 脚本来执行此操作。
DBMS_HCHECK.FULL
FULL 过程执行所有检查并在屏幕上显示输出,并将其写入跟踪文件。我们可以针对根容器或可插拔数据库运行它。
代码语言:javascript复制--conn sys/SysPassword1@//localhost:1521/free as sysdba
conn sys/SysPassword1@//localhost:1521/freepdb1 as sysdba
SQL> set serveroutput on size unlimited
SQL> exec dbms_hcheck.full
dbms_hcheck on 26-JUL-2023 19:16:19
----------------------------------------------
Catalog Version 23.0.0.0.0 (2300000000)
db_name: FREE
Is CDB?: YES CON_ID: 3 Container: FREEPDB1
Trace File: /opt/oracle/diag/rdbms/free/FREE/trace/FREE_ora_11866_HCHECK.trc
Catalog Fixed
Procedure Name Version Vs Release Timestamp
Result
------------------------------ ... ---------- -- ---------- --------------
------
.- OIDOnObjCol ... 2300000000 <= *All Rel* 07/26 19:16:19 PASS
.- LobNotInObj ... 2300000000 <= *All Rel* 07/26 19:16:19 PASS
.- SourceNotInObj ... 2300000000 <= *All Rel* 07/26 19:16:19 PASS
.- OversizedFiles ... 2300000000 <= *All Rel* 07/26 19:16:19 PASS
.- PoorDefaultStorage ... 2300000000 <= *All Rel* 07/26 19:16:19 PASS
.- PoorStorage ... 2300000000 <= *All Rel* 07/26 19:16:19 PASS
.- TabPartCountMismatch ... 2300000000 <= *All Rel* 07/26 19:16:19 PASS
.- TabComPartObj ... 2300000000 <= *All Rel* 07/26 19:16:19 PASS
.- Mview ... 2300000000 <= *All Rel* 07/26 19:16:19 PASS
.- ValidDir ... 2300000000 <= *All Rel* 07/26 19:16:19 PASS
.- DuplicateDataobj ... 2300000000 <= *All Rel* 07/26 19:16:19 PASS
.- ObjSyn ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- ObjSeq ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- UndoSeg ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- IndexSeg ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- IndexPartitionSeg ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- IndexSubPartitionSeg ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- TableSeg ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- TablePartitionSeg ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- TableSubPartitionSeg ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- PartCol ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- ValidSeg ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- IndPartObj ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- DuplicateBlockUse ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- FetUet ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- Uet0Check ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- SeglessUET ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- ValidInd ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- ValidTab ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- IcolDepCnt ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- ObjIndDobj ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- TrgAfterUpgrade ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- ObjType0 ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- ValidOwner ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- StmtAuditOnCommit ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- PublicObjects ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- SegFreelist ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- ValidDepends ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- CheckDual ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- ObjectNames ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- ChkIotTs ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- NoSegmentIndex ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- NextObject ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- DroppedROTS ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- FilBlkZero ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- DbmsSchemaCopy ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- IdnseqObj ... 2300000000 > 1201000000 07/26 19:16:20 PASS
.- IdnseqSeq ... 2300000000 > 1201000000 07/26 19:16:20 PASS
.- ObjError ... 2300000000 > 1102000000 07/26 19:16:20 PASS
.- ObjNotLob ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- MaxControlfSeq ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- SegNotInDeferredStg ... 2300000000 > 1102000000 07/26 19:16:20 PASS
.- SystemNotRfile1 ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- DictOwnNonDefaultSYSTEM ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- ValidateTrigger ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- ObjNotTrigger ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
.- InvalidTSMaxSCN ... 2300000000 > 1202000000 07/26 19:16:20 PASS
.- OBJRecycleBin ... 2300000000 <= *All Rel* 07/26 19:16:20 PASS
---------------------------------------
26-JUL-2023 19:16:20 Elapsed: 1 secs
---------------------------------------
Found 0 potential problem(s) and 0 warning(s)
Trace File: /opt/oracle/diag/rdbms/free/FREE/trace/FREE_ora_11866_HCHECK.trc
PL/SQL procedure successfully completed.
SQL>
DBMS_HCHECK.CRITICAL
CRITICAL 过程仅执行关键检查并在屏幕上显示输出,并将其写入跟踪文件。我们可以针对根容器或可插拔数据库运行它。
代码语言:javascript复制--conn sys/SysPassword1@//localhost:1521/free as sysdba
conn sys/SysPassword1@//localhost:1521/freepdb1 as sysdba
SQL> set serveroutput on size unlimited
SQL> execute dbms_hcheck.critical
dbms_hcheck on 26-JUL-2023 19:19:29
----------------------------------------------
Catalog Version 23.0.0.0.0 (2300000000)
db_name: FREE
Is CDB?: YES CON_ID: 3 Container: FREEPDB1
Trace File: /opt/oracle/diag/rdbms/free/FREE/trace/FREE_ora_11866_HCHECK.trc
Catalog Fixed
Procedure Name Version Vs Release Timestamp
Result
------------------------------ ... ---------- -- ---------- --------------
------
.- UndoSeg ... 2300000000 <= *All Rel* 07/26 19:19:29 PASS
.- MaxControlfSeq ... 2300000000 <= *All Rel* 07/26 19:19:29 PASS
.- InvalidTSMaxSCN ... 2300000000 > 1202000000 07/26 19:19:29 PASS
---------------------------------------
26-JUL-2023 19:19:29 Elapsed: 0 secs
---------------------------------------
Found 0 potential problem(s) and 0 warning(s)
Trace File: /opt/oracle/diag/rdbms/free/FREE/trace/FREE_ora_11866_HCHECK.trc
PL/SQL procedure successfully completed.
SQL>