<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>惜分飞 &#187; ORA-20001</title>
	<atom:link href="https://www.xifenfei.com/tag/ora-20001/feed" rel="self" type="application/rss+xml" />
	<link>https://www.xifenfei.com</link>
	<description>提供7*24专业数据库(Oracle,SQL Server,MySQL,PostgreSQL等)恢复和技术支持@Tel:17813235971</description>
	<lastBuildDate>Sat, 24 Oct 2026 14:05:24 +0000</lastBuildDate>
	<language>zh-CN</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>重建oraInventory解决ORA-20001</title>
		<link>https://www.xifenfei.com/2018/01/orainventory-ora-20001.html</link>
		<comments>https://www.xifenfei.com/2018/01/orainventory-ora-20001.html#comments</comments>
		<pubDate>Tue, 23 Jan 2018 16:47:55 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[ORA-xxxxx]]></category>
		<category><![CDATA[ORACLE 12C]]></category>
		<category><![CDATA[DBMS_QOPATCH]]></category>
		<category><![CDATA[KUP-04004]]></category>
		<category><![CDATA[KUP-04017]]></category>
		<category><![CDATA[ORA-20001]]></category>
		<category><![CDATA[重建oraInventory]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=7292</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2018/01/orainventory-ora-20001.html">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div id="xifenfeicopyright">
<p>联系：<a href="https://www.xifenfei.com/about_xifenfei" target="_blank">手机/微信(+86 17813235971)   QQ(107644445)</a><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&#038;uin=107644445&#038;site=qq&#038;menu=yes"><img src="https://www.xifenfei.com/wp-content/themes/img/site_qq.jpg" alt="QQ咨询惜分飞" title="QQ咨询惜分飞"/></a></p>
<p>标题：<a href="https://www.xifenfei.com/2018/01/orainventory-ora-20001.html" target="_blank">重建oraInventory解决ORA-20001</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p><strong>数据库启动报ORA-20001: Latest xml inventory is not loaded into table错误</strong></p>
<pre class="brush: bash; title: ; notranslate">
Completed: ALTER DATABASE OPEN
2018-01-23T23:46:27.924841+08:00
CJQ0 started with pid=54, OS id=6653 
2018-01-23T23:46:31.705550+08:00
Unable to obtain current patch information due to error: 20001,
  ORA-20001: Latest xml inventory is not loaded into table
ORA-06512: at &quot;SYS.DBMS_QOPATCH&quot;, line 777
ORA-06512: at &quot;SYS.DBMS_QOPATCH&quot;, line 864
ORA-06512: at &quot;SYS.DBMS_QOPATCH&quot;, line 2222
ORA-06512: at &quot;SYS.DBMS_QOPATCH&quot;, line 740
ORA-06512: at &quot;SYS.DBMS_QOPATCH&quot;, line 2247

===========================================================
Dumping current patch information
===========================================================
Unable to obtain current patch information due to error: 20001
===========================================================
</pre>
<p><strong>查询相关sql报错</strong></p>
<pre class="brush: sql; title: ; notranslate">
SYS@xffdb&gt;select * from OPATCH_XML_INV ;
ERROR:
ORA-29913: error in executing ODCIEXTTABLEFETCH callout
ORA-29400: data cartridge error
KUP-04004: error while reading file /u03/app/oracle/product/12.2.0.1/dbhome/QOpatch/qopiprep.bat



no rows selected

Elapsed: 00:00:00.58


SYS@xffdb&gt;select xmltransform(dbms_qopatch.get_opatch_lsinventory(), dbms_qopatch.GET_OPATCH_XSLT()) from dual ;
ERROR:
ORA-20001: Latest xml inventory is not loaded into table
ORA-06512: at &quot;SYS.DBMS_QOPATCH&quot;, line 777
ORA-06512: at &quot;SYS.DBMS_QOPATCH&quot;, line 864
ORA-06512: at &quot;SYS.DBMS_QOPATCH&quot;, line 2222
ORA-06512: at &quot;SYS.DBMS_QOPATCH&quot;, line 740
ORA-06512: at &quot;SYS.DBMS_QOPATCH&quot;, line 2247



no rows selected

Elapsed: 00:00:00.63

</pre>
<p><strong>datapatch -prereq报错</strong></p>
<pre class="brush: bash; title: ; notranslate">
[oracle@xifenfei ~]$ $ORACLE_HOME/OPatch/datapatch -prereq
SQL Patching tool version 12.2.0.1.0 Production on Tue Jan 23 18:11:32 2018
Copyright (c) 2012, 2017, Oracle.  All rights reserved.

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)

Queryable inventory could not determine the current opatch status.
Execute 'select dbms_sqlpatch.verify_queryable_inventory from dual'
and/or check the invocation log
/u03/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_4909_2018_01_23_18_11_32/sqlpatch_invocation.log
for the complete error.

Prereq check failed, exiting without installing any patches.

Please refer to MOS Note 1609718.1 and/or the invocation log
/u03/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_4909_2018_01_23_18_11_32/sqlpatch_invocation.log
for information on how to resolve the above errors.

SQL Patching tool complete on Tue Jan 23 18:11:45 2018
</pre>
<p><strong>分析qopiprep.bat文件</strong></p>
<pre class="brush: bash; title: ; notranslate">
cd $ORACLE_HOME
PATH=/bin:/usr/bin
export PATH

# sed tried to convert from one encoding to other in presence of LC_ALL
# or LANG settings. Since opatch returning UTF-8 based encoding we do not
# need such a conversion. So safely skip it
LANG=en_US.UTF-8
export LANG

LC_ALL=''
export LC_ALL

# Option: &quot;-retry 0&quot; avoids retries in case of locked inventory.

# Option: &quot;-invPtrLoc&quot; is required for non-central-inventory
# locations. $OPATCH_PREP_LSINV_OPTS which may set by users
# in the environment to configure special OPatch options 
# (&quot;-jdk&quot; is another good candidate that may require configuration!).

# Option: &quot;-all&quot; gives information on all Oracle Homes
# installed in the central inventory.  With that information, the
# patches of non-RDBMS homes could be fetched. 

DBSID=$ORACLE_SID
ORABASE=`$ORACLE_HOME/bin/orabasehome`

rm -rf $ORABASE/rdbms/log/xml_file_$DBSID.xml
$ORACLE_HOME/OPatch/opatch lsinventory -xml  $ORABASE/rdbms/log/xml_file_$DBSID.xml -retry 0 -invPtrLoc $ORACLE_HOME/oraInst.loc &gt;&gt; $ORABASE/rdbms/log/stout_$DBSID.txt
cat $ORABASE/rdbms/log/xml_file_$DBSID.xml | sed 's/^ *//' | tr '\n' ' '
echo &quot;UIJSVTBOEIZBEFFQBL&quot;
rm $ORABASE/rdbms/log/xml_file_$DBSID.xml
rm $ORABASE/rdbms/log/stout_$DBSID.txt
</pre>
<p>这里主要是$ORACLE_HOME/OPatch/opatch lsinventory可能异常，测试该功能<br />
<strong>qopatch_log日志</strong></p>
<pre class="brush: bash; title: ; notranslate">
[oracle@xifenfei ~]$ tail -f /u03/app/oracle/product/12.2.0.1/dbhome/QOpatch/qopatch_log.log
 LOG file opened at 01/23/18 18:48:55

KUP-05007:   Warning: Intra source concurrency disabled because the preprocessor option is being used.

Field Definitions for table OPATCH_XML_INV
  Record format DELIMITED BY NEWLINE
  Data in file has same endianness as the platform
  Reject rows with all null fields

  Fields in Data Source: 

    XML_INVENTORY                   CHAR (100000000)
      Terminated by &quot;UIJSVTBOEIZBEFFQBL&quot;
      Trim whitespace same as SQL Loader
KUP-04004: error while reading file /u03/app/oracle/product/12.2.0.1/dbhome/QOpatch/qopiprep.bat
KUP-04017: OS message: Error 0
KUP-04017: OS message: LsInventorySession failed: RawInventory gets null OracleHomeInfo
cat: /u03/app/oracle/product/12.2.0.1/dbhome/rdbms/log/xml_file_xffdb.xml: No such file or direc
KUP-04118: operation &quot;pipe read&quot;, location &quot;skudmir:2&quot;
</pre>
<p><strong>opatch lsinventory验证</strong></p>
<pre class="brush: bash; title: ; notranslate">
[oracle@xifenfei ~]$ /u03/app/oracle/product/12.2.0.1/dbhome/OPatch/opatch lsinventory
Oracle Interim Patch Installer version 12.2.0.1.6
Copyright (c) 2018, Oracle Corporation.  All rights reserved.


Oracle Home       : /u03/app/oracle/product/12.2.0.1/dbhome
Central Inventory : /u01/app/oraInventory
   from           : /u03/app/oracle/product/12.2.0.1/dbhome/oraInst.loc
OPatch version    : 12.2.0.1.6
OUI version       : 12.2.0.1.4
Log file location : /u03/app/oracle/product/12.2.0.1/dbhome/cfgtoollogs/opatch/opatch2018-01-23_23-50-29PM_1.log

List of Homes on this system:

  Home name= OraDB12Home1, Location= &quot;/u01/app/oracle/product/12.2.0/dbhome_1&quot;
LsInventorySession failed: RawInventory gets null OracleHomeInfo

OPatch failed with error code 73
</pre>
<p>现在到这一步，可以确定判断opatch lsinventory运行异常，导致DBMS_QOPATCH无法正常工作，而引起opatch异常的原因是由于RawInventory gets null OracleHomeInfo<br />
<strong>分析inventory.xml 文件</strong></p>
<pre class="brush: bash; title: ; notranslate">
[oracle@xifenfei ContentsXML]$ cat inventory.xml 

&lt;?xml version=&quot;1.0&quot; standalone=&quot;yes&quot; ?&gt;
&lt;!-- Copyright (c) 1999, 2016, Oracle and/or its affiliates.
All rights reserved. --&gt;
&lt;!-- Do not modify the contents of this file by hand. --&gt;
&lt;INVENTORY&gt;
&lt;VERSION_INFO&gt;
   &lt;SAVED_WITH&gt;12.2.0.1.0&lt;/SAVED_WITH&gt;
   &lt;MINIMUM_VER&gt;2.1.0.6.0&lt;/MINIMUM_VER&gt;
&lt;/VERSION_INFO&gt;
&lt;HOME_LIST&gt;
&lt;HOME NAME=&quot;OraDB12Home1&quot; LOC=&quot;/u01/app/oracle/product/12.2.0/dbhome_1&quot; TYPE=&quot;O&quot; IDX=&quot;1&quot;/&gt;
&lt;/HOME_LIST&gt;
&lt;COMPOSITEHOME_LIST&gt;
&lt;/COMPOSITEHOME_LIST&gt;
&lt;/INVENTORY&gt;
</pre>
<p>因为该机器上安装过三个版本的oracle，12.2 beta，11.2.0.4,12.2.0.1，现在oracle home只有第一个beta的，因此这个部分肯定异常，导致后面的12.2正式版无法获取到oraclehome<br />
<strong>重建oraInventory</strong></p>
<pre class="brush: bash; title: ; notranslate">
[oracle@xifenfei app]$ cd $ORACLE_HOME/oui/bin
[oracle@xifenfei bin]$ ./runInstaller -silent -ignoreSysPrereqs -attachHome ORACLE_HOME=&quot;/u01/app/oracle/product/12.2.0/dbhome_1&quot; ORACLE_HOME_NAME=&quot;OraDB12betaHome1&quot;
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 3935 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
'AttachHome' was successful.
[oracle@xifenfei bin]$ ./runInstaller -silent -ignoreSysPrereqs -attachHome ORACLE_HOME=&quot;/u02/app/oracle/product/11.2.0.4/dbhome&quot; ORACLE_HOME_NAME=&quot;OraDb11g_home1&quot;
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 3935 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
'AttachHome' was successful.
[oracle@xifenfei bin]$ ./runInstaller -silent -ignoreSysPrereqs -attachHome ORACLE_HOME=&quot;/u03/app/oracle/product/12.2.0.1/dbhome&quot; ORACLE_HOME_NAME=&quot;OraDb122g_home1&quot;
Starting Oracle Universal Installer...

Checking swap space: must be greater than 500 MB.   Actual 3935 MB    Passed
The inventory pointer is located at /etc/oraInst.loc
'AttachHome' was successful.

--验证inventory.xml 文件
[oracle@xifenfei ContentsXML]$ cat inventory.xml 

&lt;?xml version=&quot;1.0&quot; standalone=&quot;yes&quot; ?&gt;
&lt;!-- Copyright (c) 1999, 2018, Oracle and/or its affiliates.
All rights reserved. --&gt;
&lt;!-- Do not modify the contents of this file by hand. --&gt;
&lt;INVENTORY&gt;
&lt;VERSION_INFO&gt;
   &lt;SAVED_WITH&gt;12.2.0.1.4&lt;/SAVED_WITH&gt;
   &lt;MINIMUM_VER&gt;2.1.0.6.0&lt;/MINIMUM_VER&gt;
&lt;/VERSION_INFO&gt;
&lt;HOME_LIST&gt;
&lt;HOME NAME=&quot;OraDB12betaHome1&quot; LOC=&quot;/u01/app/oracle/product/12.2.0/dbhome_1&quot; TYPE=&quot;O&quot; IDX=&quot;1&quot;/&gt;
&lt;HOME NAME=&quot;OraDb11g_home1&quot; LOC=&quot;/u02/app/oracle/product/11.2.0.4/dbhome&quot; TYPE=&quot;O&quot; IDX=&quot;2&quot;/&gt;
&lt;HOME NAME=&quot;OraDb122g_home1&quot; LOC=&quot;/u03/app/oracle/product/12.2.0.1/dbhome&quot; TYPE=&quot;O&quot; IDX=&quot;3&quot;/&gt;
&lt;/HOME_LIST&gt;
&lt;COMPOSITEHOME_LIST&gt;
&lt;/COMPOSITEHOME_LIST&gt;
&lt;/INVENTORY&gt;

</pre>
<p><strong>验证opatch lsinventory</strong></p>
<pre class="brush: bash; title: ; notranslate">
[oracle@xifenfei bin]$ opatch lsinv
Oracle Interim Patch Installer version 12.2.0.1.6
Copyright (c) 2018, Oracle Corporation.  All rights reserved.


Oracle Home       : /u03/app/oracle/product/12.2.0.1/dbhome
Central Inventory : /u01/app/oraInventory
   from           : /u03/app/oracle/product/12.2.0.1/dbhome/oraInst.loc
OPatch version    : 12.2.0.1.6
OUI version       : 12.2.0.1.4
Log file location : /u03/app/oracle/product/12.2.0.1/dbhome/cfgtoollogs/opatch/opatch2018-01-24_00-19-55AM_1.log

Lsinventory Output file location : /u03/app/oracle/product/12.2.0.1/dbhome/cfgtoollogs/opatch/lsinv/lsinventory2018-01-24_00-19-55AM.txt

--------------------------------------------------------------------------------
Local Machine Information::
Hostname: xifenfei
ARU platform id: 226
ARU platform description:: Linux x86-64

Installed Top-level Products (1): 

Oracle Database 12c                                                  12.2.0.1.0
There are 1 products installed in this Oracle Home.


There are no Interim patches installed in this Oracle Home.


--------------------------------------------------------------------------------

OPatch succeeded.
</pre>
<p><strong>验证dbms_qopatch工作正常</strong></p>
<pre class="brush: bash; title: ; notranslate">
[oracle@xifenfei ContentsXML]$ $ORACLE_HOME/OPatch/datapatch -prereq 
SQL Patching tool version 12.2.0.1.0 Production on Wed Jan 24 00:21:48 2018
Copyright (c) 2012, 2017, Oracle.  All rights reserved.

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)
Determining current state...done
Adding patches to installation queue and performing prereq checks...done
Installation queue:
  For the following PDBs: CDB$ROOT PDB$SEED
    Nothing to roll back
    Nothing to apply

SQL Patching tool complete on Wed Jan 24 00:21:55 2018
SYS@xffdb&gt;select dbms_sqlpatch.verify_queryable_inventory from dual;

VERIFY_QUERYABLE_INVENTORY
--------------------------------------------------------------------------------------------------
OK

Elapsed: 00:00:01.03
SYS@xffdb&gt;select xmltransform(dbms_qopatch.get_opatch_lsinventory(), dbms_qopatch.GET_OPATCH_XSLT()) from dual ;

XMLTRANSFORM(DBMS_QOPATCH.GET_OPATCH_LSINVENTORY(),DBMS_QOPATCH.GET_OPATCH_XSLT())
----------------------------------------------------------------------------------------------------------

Oracle Querayable Patch Interface 1.0
-----------------------------------------


Elapsed: 00:00:01.09
SYS@xffdb&gt;
</pre>
<p>通过修复错误的oraInventory解决ORA-20001问题</p>
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2018/01/ora-20001.html" rel="bookmark" class="crp_title">ORA-20001: Latest xml inventory is not loaded into table</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/10/oracle-%e5%b0%8f%e5%8d%87%e7%ba%a7-opatch-apply%e4%bd%bf%e7%94%a8.html" rel="bookmark" class="crp_title">Oracle 小升级 opatch apply使用</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2024/11/kylin-linux-19c.html" rel="bookmark" class="crp_title">Kylin Linux 安装19c</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2019/12/fuser-patch-failure.html" rel="bookmark" class="crp_title">fuser命令缺失导致19c打补丁失败</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/11/10-2-0-x%e5%8d%87%e7%ba%a7%e5%88%b010-2-0-5-5.html" rel="bookmark" class="crp_title">10.2.0.x升级到10.2.0.5.5</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2021/04/extjobo-operation-not-permitted.html" rel="bookmark" class="crp_title">11.2.0.4 打patch遭遇extjobO: Operation not permitted处理</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2015/05/%e9%80%9a%e8%bf%87with%e5%ae%9e%e7%8e%b0%e5%af%b9%e8%a1%a8%e9%9d%9e%e6%b3%95dml%e6%93%8d%e4%bd%9c-%e8%a7%a3%e5%86%b3%e6%96%b9%e6%a1%88.html" rel="bookmark" class="crp_title">通过with实现对表非法dml操作&#8212;解决方案_with_subquery=materialize或者psu(2014.07以后)</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2021/04/19c-oui-patch-xml-permission-denied.html" rel="bookmark" class="crp_title">19c 打RU patch遇到oui-patch.xml (Permission denied)问题</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2017/08/ora-12012-sys-oraat_os_opt_sy.html" rel="bookmark" class="crp_title">ORA-12012: error on auto execute of job &#8220;SYS&#8221;.&#8221;ORA$AT_OS_OPT_SY_383&#8243;</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2023/04/win-checkactivefilesandexecutables.html" rel="bookmark" class="crp_title">win平台 UtilSession 失败: Prerequisite check &#8220;CheckActiveFilesAndExecutables&#8221; failed. 处理</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2024/12/goldengate-19-install-patch.html" rel="bookmark" class="crp_title">GoldenGate 19安装和打patch</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/04/db2%e6%95%b0%e6%8d%ae%e5%ba%93%e6%bf%80%e6%b4%bb.html" rel="bookmark" class="crp_title">DB2数据库激活</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2018/01/orainventory-ora-20001.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ORA-20001: Latest xml inventory is not loaded into table</title>
		<link>https://www.xifenfei.com/2018/01/ora-20001.html</link>
		<comments>https://www.xifenfei.com/2018/01/ora-20001.html#comments</comments>
		<pubDate>Mon, 22 Jan 2018 13:22:35 +0000</pubDate>
		<dc:creator><![CDATA[惜分飞]]></dc:creator>
				<category><![CDATA[ORACLE 12C]]></category>
		<category><![CDATA[DBMS_QOPATCH]]></category>
		<category><![CDATA[ORA-20001]]></category>

		<guid isPermaLink="false">https://www.xifenfei.com/?p=7284</guid>
		<description><![CDATA[联系：手机/微信(+86 17813235971) QQ(107644445)  &#8230; <a href="https://www.xifenfei.com/2018/01/ora-20001.html">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<div id="xifenfeicopyright">
<p>联系：<a href="https://www.xifenfei.com/about_xifenfei" target="_blank">手机/微信(+86 17813235971)   QQ(107644445)</a><a target="_blank" href="http://wpa.qq.com/msgrd?v=3&#038;uin=107644445&#038;site=qq&#038;menu=yes"><img src="https://www.xifenfei.com/wp-content/themes/img/site_qq.jpg" alt="QQ咨询惜分飞" title="QQ咨询惜分飞"/></a></p>
<p>标题：<a href="https://www.xifenfei.com/2018/01/ora-20001.html" target="_blank">ORA-20001: Latest xml inventory is not loaded into table</a></p>
<p>作者：<a href="https://www.xifenfei.com" target="_blank">惜分飞</a>©版权所有[未经本人同意,不得以任何形式转载,否则有进一步追究法律责任的权利.]</p>
</div>
<p><strong>12.2数据库启动报ORA-20001错</strong></p>
<pre class="brush: bash; title: ; notranslate">
2018-01-22T04:51:19.574350-05:00
Unable to obtain current patch information due to error: 20001, 
  ORA-20001: Latest xml inventory is not loaded into table
ORA-06512: at &quot;SYS.DBMS_QOPATCH&quot;, line 777
ORA-06512: at &quot;SYS.DBMS_QOPATCH&quot;, line 864
ORA-06512: at &quot;SYS.DBMS_QOPATCH&quot;, line 2222
ORA-06512: at &quot;SYS.DBMS_QOPATCH&quot;, line 740
ORA-06512: at &quot;SYS.DBMS_QOPATCH&quot;, line 2247

===========================================================
Dumping current patch information
===========================================================
Unable to obtain current patch information due to error: 20001
===========================================================
</pre>
<p><strong>patch日志</strong></p>
<pre class="brush: bash; title: ; notranslate">
KUP-05007:   Warning: Intra source concurrency disabled because the preprocessor option is being used.

Field Definitions for table OPATCH_XML_INV
  Record format DELIMITED BY NEWLINE
  Data in file has same endianness as the platform
  Reject rows with all null fields

  Fields in Data Source:

    XML_INVENTORY                   CHAR (100000000)
      Terminated by &quot;UIJSVTBOEIZBEFFQBL&quot;
      Trim whitespace same as SQL Loader

</pre>
<p>DBMS_QOPATCH包是提供PLSQL/SQL接口方式访问数据库补丁安装情况，oracle在启动的时候会去调用这个包查询patch情况，由于ORA-20001 Latest XML inventory is not loaded into table.导致失败，从而出现上述启动错误。<br />
<strong>主要相关的sql</strong></p>
<pre class="brush: sql; title: ; notranslate">
CREATE OR REPLACE DIRECTORY &quot;OPATCH_LOG_DIR&quot; AS '/u01/app/oracle/product/11.2.0/dbhome_1/QOpatch';
CREATE OR REPLACE DIRECTORY &quot;OPATCH_SCRIPT_DIR&quot; AS '/u01/app/oracle/product/11.2.0/dbhome_1/QOpatch';

CREATE TABLE &quot;SYS&quot;.&quot;OPATCH_XML_INV&quot;
   (    &quot;XML_INVENTORY&quot; CLOB
   )
   ORGANIZATION EXTERNAL
    ( TYPE ORACLE_LOADER
      DEFAULT DIRECTORY &quot;OPATCH_SCRIPT_DIR&quot;
      ACCESS PARAMETERS
      ( RECORDS DELIMITED BY NEWLINE CHARACTERSET UTF8
      DISABLE_DIRECTORY_LINK_CHECK
      READSIZE 8388608
      preprocessor opatch_script_dir:'qopiprep.bat'
      BADFILE opatch_script_dir:'qopatch_bad.bad'
      LOGFILE opatch_log_dir:'qopatch_log.log'
      FIELDS TERMINATED BY 'UIJSVTBOEIZBEFFQBL'
      MISSING FIELD VALUES ARE NULL
      REJECT ROWS WITH ALL NULL FIELDS
      (
        xml_inventory    CHAR(100000000)
      )
        )
      LOCATION
       ( &quot;OPATCH_SCRIPT_DIR&quot;:'qopiprep.bat'
       )
    )
   REJECT LIMIT UNLIMITED;
</pre>
<p>
<strong>解决方案</strong></p>
<pre class="brush: bash; title: ; notranslate">
---方案1
SQL&gt; alter system set &quot;_disable_directory_link_check&quot;=true scope=spfile;

System altered.

SQL&gt; shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL&gt; startup
ORACLE instance started.

Total System Global Area 2432696320 bytes
Fixed Size                  8795664 bytes
Variable Size             654313968 bytes
Database Buffers         1761607680 bytes
Redo Buffers                7979008 bytes
Database mounted.
Database opened.
SQL&gt; SELECT a.ksppinm &quot;Parameter&quot;,
  2  b.ksppstvl &quot;Session Value&quot;,
  3  c.ksppstvl &quot;Instance Value&quot;
  4  FROM x$ksppi a,
  5  x$ksppcv b,
  6  x$ksppsv c
  7  WHERE a.indx = b.indx
  8  AND a.indx = c.indx
  9  AND a.ksppinm LIKE '/_disable_direc%' escape '/' ;

Parameter
--------------------------------------------------------------------------------
Session Value
--------------------------------------------------------------------------------
Instance Value
--------------------------------------------------------------------------------
_disable_directory_link_check
TRUE
TRUE


SQL&gt; exit

$ORACLE_HOME/sqlpatch/datapatch

---方案2
SQL&gt; create or replace directory OPATCH_LOG_DIR as '&lt;complete path to QOpatch&gt;';
Directory created.

SQL&gt; create or replace directory OPATCH_SCRIPT_DIR as '&lt;complete path to QOpatch&gt;';
Directory created.

---方案3
cd $ORACLE_HOME/sqlpatch

./datapatch -verbose

---方案4
chmod 775 -r $ORACLE_HOME/rdbms/log
 

$ORACLE_HOME/OPatch/datapatch -prereq 
</pre>
<p><strong>参考MOS</strong><br />
Queryable Patch Inventory &#8211; Issues/Solutions for ORA-20001: Latest xml inventory is not loaded into table (Doc ID 1602089.1)<br />
12.2:DB Alert.log shows ORA-20001: Latest xml inventory,ORA-06512: at &#8220;SYS.DBMS_QOPATCH&#8221;,&#8221;KUP-04004: error while reading file&#8221; (Doc ID 2323937.1)</p>
<div id="crp_related"><ul><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2018/01/orainventory-ora-20001.html" rel="bookmark" class="crp_title">重建oraInventory解决ORA-20001</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2010/11/oracle-%e5%a4%96%e9%83%a8%e8%a1%a8.html" rel="bookmark" class="crp_title">ORACLE 外部表</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2017/08/ora-12012-sys-oraat_os_opt_sy.html" rel="bookmark" class="crp_title">ORA-12012: error on auto execute of job &#8220;SYS&#8221;.&#8221;ORA$AT_OS_OPT_SY_383&#8243;</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/03/v%e8%a7%86%e5%9b%be%e7%94%b1%e6%9d%a5.html" rel="bookmark" class="crp_title">v$和gv$来源</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/01/%e8%b7%b3%e8%bf%87obj%e5%9d%8f%e5%9d%97%e6%96%b9%e6%b3%95.html" rel="bookmark" class="crp_title">跳过obj$坏块方法</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/05/%e4%bd%bf%e7%94%a8dbms_metadata-get_ddl%e5%87%ba%e7%8e%b0ora-31605%e9%94%99%e8%af%af.html" rel="bookmark" class="crp_title">使用dbms_metadata.get_ddl出现ORA-31605错误</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2013/08/oracle-12c-dbms_utility-expand_sql_text-%e6%9f%a5%e7%9c%8bsql%e8%a7%86%e5%9b%be%e5%9f%ba%e8%a1%a8.html" rel="bookmark" class="crp_title">ORACLE 12C dbms_utility.expand_sql_text 查看SQL视图基表</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2010/09/shell%e7%bc%96%e7%a8%8b%e2%80%94%e2%80%94%e5%9f%ba%e6%9c%ac%e8%af%ad%e6%b3%95.html" rel="bookmark" class="crp_title">shell编程——基本语法</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2012/10/dual-%e7%bc%ba%e5%b0%91%e5%90%8c%e4%b9%89%e8%af%8d%e8%a7%a3%e5%86%b3.html" rel="bookmark" class="crp_title">dual 缺少同义词故障解决</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2010/08/fckeditor%e4%bd%bf%e7%94%a8%e8%af%b4%e6%98%8e.html" rel="bookmark" class="crp_title">fckeditor使用说明</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2025/08/joxcsys-release-mismatch.html" rel="bookmark" class="crp_title">joxcsys: release mismatch, 19.0.0.0.0 1.8 in database (classes.bin)</a></li><li style="list-style-type:decimal;font-size:11px;" ><a href="https://www.xifenfei.com/2011/02/show-hidden-parameter.html" rel="bookmark" class="crp_title">show hidden parameter</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>https://www.xifenfei.com/2018/01/ora-20001.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
