MOS 文档说明:Identify Data Dictionary Inconsistency [ID 456468.1]
数据字典损坏通常有如下情况:
1. Data Dictionary Inconsistency, missingrows in tables:
- Tab$/Ind$ with no entries in OBJ$
- Undo$/Tab$/Ind$ withno entries in SEG$
- Seg$ with no entriesin TAB$/IND$/OBJ$
2. Missing data dictionary objects
3. Corrupted data dictionary objects (table, index, or table-indexinconsistency)
4. Invalid entries in data dictionary tables.
数据字典损坏对系统的影响是可能某些用户和对象无法进行删除,当遇到这种情况时,就可以检查一下数据字典的一致性。
In order todetect data dictionary inconsistency we need to run hcheck.full procedure,seeNote136697.1.
--为了检查数据字典的不一致性,Oracle 提供了hcheck.fuu 过程。其具体的使用方法如下:
a. Connect asSYS schema in sqlplus
b. Create package hOut as described inNote101468.1
c. Create package hcheck in SYS schema asdescribed inNote136697.1attachment.
d. set serveroutput on
e. execute hcheck.full
The script willreport various dictionary related issues that may or may not be aproblem.Any problems reported should be reviewed by an experiencedsupport analyst as somereported "problems" may be normal andexpected.
--该脚本会报告数据字典相关的各种问题。
Example of HCHECK.FULL output:
--个HCHECK.FULL输出示例
Problem:OrphanedIND$(noSEG$)-SeeNote65987.1(Bug:624613/3655873)
ORPHANIND$:OBJ=200449DOBJ=200449TS=0RFILE/BLOCK=00BO#=200446SegType=
^-MaybeOK.Needsmanualcheck
ORPHANIND$:OBJ=39442DOBJ=39442TS=14RFILE/BLOCK=249BO#=39438SegType=
Problem:OrphanedTAB$(noSEG$)
ORPHANTAB$:OBJ=1817074DOBJ=0TS=0RFILE/BLOCK=00BOBJ#=SegType=
^-MaybeOK.Needsmanualcheck
ORPHANTAB$:OBJ=2149126DOBJ=2149126TS=19RFILE/BLOCK=3144291BOBJ#=SegType=
Problem:OrphanedSEG$Entry
ORPHANSEG$:SegType=INDEXTS=20RFILE/BLOCK=3328435
Based on thehcheck.full output you will have to identify the objects that show a ddinconsistency, and verify the reported inconsistency.
--根据这个输出结果,我们可以验证这个不一致性:
Selectname,type# from obj$ where obj#=
Selectobject_name,owner,object_type from dba_objects whereobject_id=
Some of theproblems, mainly the one marked as 'May be OK. Needs manual check ' couldbe a false alarm.
Check the typeof the object.
Lob Index ontemporary table or IOT do not have a segment, than the problem message is afalse alarm.
MOS 文档:
Script to Install the "hOut"Helper Package ("hout.sql") [ID 101468.1]
"hcheck.sql" script to check forknown problems in Oracle8i, Oracle9i, Oracle10g and Oracle 11g [ID 136697.1]
这里的2个脚本较长,可以直接从csdn 下载:
http://download.csdn.net/detail/tianlesoftware/4046773
3.1 用SYS 用户创建Hout包
脚本参考[ID101468.1]
3.2 在SYS用户下创建hcheck包
脚本参考:[ID 136697.1]
3.3 执行hcheck.full
SQL>@E:\Software\OracleSoftware\Hcheck_Full_Scripts\hout.sql
Package created.
No errors.
Package body created.
--这里注意,MOS上对hcheck脚本提供了2个版本:hcheck2.sql 和 hcheck3.sql。
--执行hcheck2.sql
SQL> @E:\Software\OracleSoftware\Hcheck_Full_Scripts\hcheck2.sql
Package created.
No errors.
Package body created.
No errors.
SQL>
SQL> exec hcheck.full
HCheck Version 8i-11/2.00 --version 2 对应的是8i
Problem:SEG$ bad LISTS/GROUPS (==1) - See Tar:2470806.1
May be Ok for LOBSEGMENT/SECUREFILE inrelease 11gR1+
Bad SEG$ lists/groups : TS#=1 RFILE#=2BLK#=22177 TYPE#=8 Lists=2 Groups=1
Bad SEG$ lists/groups : TS#=1 RFILE#=2BLK#=22233 TYPE#=8 Lists=2 Groups=1
Bad SEG$ lists/groups : TS#=1 RFILE#=2BLK#=22937 TYPE#=8 Lists=2 Groups=1
Bad SEG$ lists/groups : TS#=1 RFILE#=2BLK#=22977 TYPE#=8 Lists=2 Groups=1
Bad SEG$ lists/groups : TS#=1 RFILE#=2BLK#=23017 TYPE#=8 Lists=2 Groups=1
Bad SEG$ lists/groups : TS#=1 RFILE#=2BLK#=24505 TYPE#=8 Lists=2 Groups=1
Warning:OBJECT name clashes with SCHEMA name - Bug:2894111 etc..
Schema=DAVE Object=DAVE.DAVE (TABLE)
Schema=DVD Object=DVD.DVD (TABLE)
Found 6 potential problems and 2 warnings
Contact Oracle Support with the output
to check if the above needs attention ornot
PL/SQL procedure successfully completed.
--执行hcheck3.sql
SQL> @E:\Software\OracleSoftware\Hcheck_Full_Scripts\hcheck3.sql
Package created.
Package body created.
SQL> spool D:\hcheck.txt
SQL> exec hcheck.full
H.Check Version 9i+/hc3.35 --version 3对应的是9i
---------------------------------------
Catalog Version 11.2.0.1.0 (1102000100)
---------------------------------------
Catalog Fixed
Procedure Name Version Vs Release Run
------------------------------ ...---------- -- ---------- ---
.- SynLastDDLTim ... 1102000100 > 1001000200 : n/a
.- LobNotInObj ... 1102000100 > 1000000200 : n/a
.- MissingOIDOnObjCol ... 1102000100 <= *All Rel* : Ok
.- SourceNotInObj ... 1102000100 > 1002000100 : n/a
.- IndIndparMismatch ... 1102000100 <= 1102000100 : Ok
.- InvCorrAudit ... 1102000100 <= 1102000100: Ok
.- OversizedFiles ... 1102000100 <= *All Rel* : Ok
.- TinyFiles ... 1102000100 > 900010000 : n/a
.- PoorDefaultStorage ... 1102000100 <= *All Rel* : Ok
.- PoorStorage ... 1102000100 <= *All Rel* : Ok
.- MissTabSubPart ... 1102000100 > 900010000 : n/a
.- PartSubPartMismatch ... 1102000100 <= 1102000100 : Ok
.- TabPartCountMismatch ... 1102000100 <= *All Rel* : Ok
.- OrphanedTabComPart ... 1102000100 > 900010000 : n/a
.- ZeroTabSubPart ... 1102000100 > 902000100 : n/a
.- MissingSum$ ... 1102000100 <= *All Rel* : Ok
.- MissingDir$ ... 1102000100 <= *All Rel* : Ok
.- DuplicateDataobj ... 1102000100 <= *All Rel* : Ok
.- ObjSynMissing ... 1102000100 <= *All Rel* : Ok
.- ObjSeqMissing ... 1102000100 <= *All Rel* : Ok
.- OrphanedUndo ... 1102000100 <= *All Rel* : Ok
.- OrphanedIndex ... 1102000100 <= *All Rel* : Ok
.- OrphanedIndexPartition ... 1102000100 <= *All Rel* : Ok
.- OrphanedIndexSubPartition ... 1102000100 <= *All Rel* : Ok
.- OrphanedTable ... 1102000100 <= *All Rel* : Ok
.- OrphanedTablePartition ... 1102000100 <= *All Rel* : Ok
.- OrphanedTableSubPartition ... 1102000100 <= *All Rel* : Ok
.- MissingPartCol ... 1102000100 <= *All Rel* : Ok
.- OrphanedSeg$ ... 1102000100 <= *All Rel* : Ok
.- OrphanedIndPartObj# ... 1102000100 > 1101000600 : n/a
.- DuplicateBlockUse ... 1102000100 <= *All Rel* : Ok
.- HighObjectIds ... 1102000100 > 801060000 : n/a
.- PQsequence ... 1102000100 > 800060000 : n/a
.- TruncatedCluster ... 1102000100 > 801070000 : n/a
.- FetUet ... 1102000100 <= *All Rel* : Ok
.- Uet0Check ... 1102000100 <= *All Rel* : Ok
.- ExtentlessSeg ... 1102000100 <= *All Rel* : Ok
.- SeglessUET ... 1102000100 <= *All Rel* : Ok
.- BadInd$ ... 1102000100 <= *All Rel* : Ok
.- BadTab$ ... 1102000100 <= *All Rel* : Ok
.- BadIcolDepCnt ... 1102000100 > 1101000700 : n/a
.- WarnIcolDep ... 1102000100 > 1101000700 : n/a
.- OnlineRebuild$ ... 1102000100 <= *All Rel* : Ok
.- DropForceType ... 1102000100 > 1001000200 : n/a
.- TrgAfterUpgrade ... 1102000100 <= *All Rel* : Ok
.- FailedInitJVMRun ... 1102000100 <= *All Rel* : Ok
.- TypeReusedAfterDrop ... 1102000100 > 900010000 : n/a
.- Idgen1$TTS ... 1102000100 > 900010000 : n/a
.- DroppedFuncIdx ... 1102000100 > 902000100 : n/a
.- BadOwner ... 1102000100 > 900010000 : n/a
.- UpgCheckc0801070 ... 1102000100 <= *All Rel* : Ok
.- BadPublicObjects ... 1102000100 <= *All Rel* : Ok
.- BadSegFreelist ... 1102000100 <= *All Rel* : Ok
.- BadCol# ... 1102000100 > 1001000200 : n/a
.- BadDepends ... 1102000100 <= *All Rel* : Ok
.- CheckDual ... 1102000100 <= *All Rel* : Ok
.- ObjectNames ... 1102000100 <= *All Rel* : Ok
HCKW-0018: OBJECT name clashes with SCHEMAname
Schema=DAVE Object=DAVE.DAVE (TABLE)
Schema=DVD Object=DVD.DVD (TABLE)
.- BadCboHiLo ... 1102000100 <= *All Rel* : Ok
.- ChkIotTs ... 1102000100 <= *All Rel* : Ok
.- NoSegmentIndex ... 1102000100 <= *All Rel* : Ok
.- BadNextObject ... 1102000100 <= *All Rel* : Ok
.- OrphanIndopt ... 1102000100 > 902000800 : n/a
.- UpgFlgBitTmp ... 1102000100 > 1001000100 : n/a
.- RenCharView ... 1102000100 > 1001000100 : n/a
.- Upg9iTab$ ... 1102000100 > 902000400 : n/a
.- Upg9iTsInd ... 1102000100 > 902000500 : n/a
.- Upg10gInd$ ... 1102000100 > 1002000000 : n/a
.- DroppedROTS ... 1102000100 <= *All Rel* : Ok
.- ChrLenSmtcs ... 1102000100 > 1101000600 : n/a
.- FilBlkZero ... 1102000100 <= *All Rel* : Ok
Found 0 potential problem(s) and 2warning(s)
Contact Oracle Support with the output
to check if the above needs attention ornot
PL/SQL procedure successfully completed.
SQL> spool off
通过以上的执行结果,hcheck 的2个脚本显示的不一样。查看这2个脚本的说明部分:
REM hcheck8i.sql Version 2.00 Tue Mar1 11:13:40 CET 2011
REM
REM Purpose:
REM Toprovide a single package which looks for common data dictionary
REM problems.
REM Notethat this version has not been checked with locally managed
REM tablespacesand may give spurious output if these are in use.
REM Thisscript is for use mainly under the guidance of Oracle Support.
--这里注意的是对locallymanaged tablespace 不检测。
关于表空间类型这块,可以参考:
Oracle 自动段空间管理(ASSM:autosegment space management)
http://blog.csdn.net/tianlesoftware/article/details/4958989
REM Notes:
REM Mustbe installed in SYS schema
REM Thispackage is intended for use in Oracle 8.1 through 11.1
REMThis package will NOT work in 8.0 or earlier.
REMIn all cases any output reporting "problems" should be
REMpassed by an experienced Oracle Support analyst to confirm
REMif any action is required.
REM
REM CAUTION
REMThe sample program in this article is provided for educational
REMpurposes only and is NOT supported by Oracle Support Services.
REMIt has been tested internally, however, and works as documented.
REMWe do not guarantee that it will work for you, so be sure to test
REMit in your environment before relying on it.
--------------------------------------------------------------------------
-- hcheck.sql Version 3.35 Thu Dec 22 09:44:47 CET 2011
--
-- Purpose:
--To provide a single package which looks for common data dictionary
--problems.
--Note that this version has not been checked with locally managed
--tablespaces and may give spurious output if these are in use.
--This script is for use mainly under the guidance of Oracle Support.
-- Notes:
--Must be installed in SYS schema
--This package is intended for use in Oracle releases 9i onwards
--This package will NOT work in 8i or earlier.
--In all cases any output reporting "problems" should be
--parsed by an experienced Oracle Support analyst to confirm
--if any action is required.
--
-- CAUTION
--The sample program in this article is provided for educational
--purposes only and is NOT supported by Oracle Support Services.
--It has been tested internally, however, and works as documented.
--We do not guarantee that it will work for you, so be sure to test
--it in your environment before relying on it.
从这上面来看,2个脚本说明也一样,从版本上来看,还是推荐使用hcheck3.sql 这个脚本。
-------------------------------------------------------------------------------------------------------
版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!
Email: [email protected]
Skype: tianlesoftware
Blog: http://www.tianlesoftware.com
Weibo: http://weibo.com/tianlesoftware
Twitter: http://twitter.com/tianlesoftware
Facebook: http://www.facebook.com/tianlesoftware
-------加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请----
DBA1 群:62697716(满); DBA2 群:62697977(满)DBA3 群:62697850(满)
DBA 超级群:63306533(满); DBA4 群:83829929 DBA5群: 142216823
DBA6 群:158654907 DBA7 群:172855474 DBA总群:104207940