知识库

标准化实施手册及常见错误


Oracle11.2.0.4补丁升级方案

<h2>背景(linux升级步骤与windows类似,补丁升级包不同):</h2> <p>本文介绍如何给Oracle数据库打补丁,数据库版本为Oracle11.2.0.4,单实例,操作系统为windows10。 oracle查看版本: <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/0b64b78d6ac369b2d464fc703639b7c8" alt="" /></p> <h2>下载升级包(只适用11.0.2.4的版本)</h2> <p><strong>windows版本:</strong> opatch包下载地址:[p6880880_112000_MSWIN-x86-64.zip](<a href="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/41d529047ff941f07b9bb61e96e87a60">http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/41d529047ff941f07b9bb61e96e87a60</a> &quot;[p6880880_112000_MSWIN-x86-64.zip&quot;) 补丁包下载地址:[p31659823_112040_MSWIN-x86-64.zip](<a href="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/3aa7c61be4f4f5d3abdd8b3492cffde7">http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/3aa7c61be4f4f5d3abdd8b3492cffde7</a> &quot;[p31659823_112040_MSWIN-x86-64.zip&quot;) <strong>linux版本:</strong> opatch包下载地址:[p6880880_112000_Linux-x86-64.zip](<a href="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/98d8b484e31ecc3b9262b5c2f8abc2c6">http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/98d8b484e31ecc3b9262b5c2f8abc2c6</a> &quot;[p6880880_112000_Linux-x86-64.zip&quot;) 补丁包下载地址:[p30670774_112040_Linux-x86-64.zip](<a href="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/0064b2322f60d813b809879a02817b5f">http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/0064b2322f60d813b809879a02817b5f</a> &quot;[p30670774_112040_Linux-x86-64.zip&quot;) &gt; <em>opatch是安装补丁的程序,数据库软件安装完成后,就自带了opatch,但是版本太旧了,所以这里下载最新的opatch,p6880880_112000_Linux-x86-64.zip包就是用来升级opatch用的。</em></p> <h2>升级opatch</h2> <p>opatch的升级只要将新版本的包解压,重命名替换覆盖系统原始的文件即可。</p> <h3>查看原始opatch信息</h3> <p>opatch安装路径一般在oracle安装目录下OPatch(%ORACLE_HOME%) <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/57ceabd80d2b4482627985fc4093b379" alt="" /> 例如本文档oracle安装目录:D:\app\rt440-ppoo\product\11.2.0\dbhome_1 找到数据库安装目录,然后在DOS命令中查看当前数据库版本信息 cmd窗口设置环境变量set ORACLE_HOME=D:\app\rt440-ppoo\product\11.2.0\dbhome_1 <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/8398bfea8a238f3718328619b9a41919" alt="" /> 查看当前数据库版本信息:%ORACLE_HOME%/OPatch/opatch lsinv <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/0df08e99ae71d653c5c585ebd8e5839b" alt="" /> 如上图可知opatch安装版本为11.2.0.3.4,且数据库未安装过任何补丁程序</p> <h3>备份原opatch</h3> <p>将%ORACLE_HOME%/OPatch重命名为%ORACLE_HOME%/OPatchBAK <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/2dde6ad757f09a7074f00c7d3baee78c" alt="" /></p> <h3>解压新下载的opatch包</h3> <p>将下载的opatch包上传到oracle的家目录,上传完后,解压到$ORACLE_HOME下 <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/c44e956a45bc16340eda1c28330fde12" alt="" /> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/ef3a86194b78fd79461dfeaae36cbaad" alt="" /></p> <h3>检查opatch是否升级成功</h3> <p>%ORACLE_HOME%/OPatch/opatch version # 查看版本信息 <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/e45db03aab42f8324c676cb840149ec9" alt="" /> 现在版本为11.2.0.3.21,说明升级成功</p> <h2>数据库升级补丁</h2> <h3>前提条件(重中之重,升级必须执行):</h3> <ul> <li><strong>备份原数据库</strong>(防止升级失败还原)</li> <li><strong>关闭数据库监听、数据库服务</strong>(防止升级过程影响数据及使用)</li> </ul> <h3>关闭数据库监听、数据库服务</h3> <p>打开任务管理器--打开服务---找到所有开头有oracle的服务,停止监听和数据库服务 <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/3ff4299b559ef74ef3b5d172d83502dd" alt="" /> 关闭监听和服务 <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/23f55cdcd4b59f4d69c22634040f545c" alt="" /></p> <h3>解压补丁包</h3> <p>将下载的补丁包上传到oracle家目录,并解压 <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/a7b19f3c6f3468a531fb42b2300a828d" alt="" /> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/4a5e7bd359db358eb063da5f11878b2b" alt="" /></p> <h3>校验冲突</h3> <p>cmd窗口进入补丁解压目录下,执行指令: %ORACLE_HOME%/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./ <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/3e82cf64e7e270a3bef12913337caf7c" alt="" /> 由于这个库之前并没有打补丁,所以这里就没有补丁冲突的问题,如果这里显示有冲突,再去网MOS上查找相关解决方案。</p> <h3>设置PATH环境变量</h3> <p><img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/c1a61b492970f35ff43ead3b3b5b3046" alt="" /></p> <h3>执行打补丁</h3> <p>指令:%ORACLE_HOME%/OPatch/opatch apply <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/5ab45fac4cdc2dbb6ec362f40c60f6d2" alt="" /> 这里要输入3次y和一次回车,打补丁的过程耗是比较久的,耐心等待 <strong>问题1:补丁执行过程报错:java.io.FileNotFoundException: C:\Program Files\Oracle\Inventory\logs\OPatch2022-02-21_02-26-46-PM.log (拒绝访问。)</strong> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/abd8c7104f086b3870e00652882c34e2" alt="" /> <strong>原因:</strong> 你所登录的而用户对C:\Program Files\Oracle\没有创建或修改的权限 <strong>解决方案:</strong> 授权给当前登录的用户 <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/0d50b55ad807277d4927666a4952730e" alt="" /> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/ad9d8fc46ec079775c1bc15c1fd13cdc" alt="" /> 授权完毕,再次执行,耐心等待 <strong>问题2:To regenerate an OCM response file, Please rerun &quot;C:\Users\rt440-ppoo\AppData\Local\Temp\oracle-home-1645425994222279\OPatch\ocm\bin\emocmrsp.bat</strong> <strong>原因:</strong>opatch apply使用静默模式的时候需要指定响应文件,但是根据报错提示,使用缓存目录的emocmrsp.bat生成相应文件时,会发现目录文件不存在 <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/1900133442a66cd5836e9c9f2e22ca68" alt="" /> <strong>解决方案:</strong> 其实,生成相应文件的emocmrsp.bat文件在$ORACLE_HOME/OPatch/ocm下,生成相应文件后,在打补丁时指定响应文件可以顺利应用补丁程序: <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/6599155ed33d009d5c211e4cd9d8f6e5" alt="" /> 双击执行emocmrsp.bat,会生成ocm.rsp <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/a0fda5deca24559e2cb3f9c6be481d64" alt="" /> 重新执行打补丁指令,指定ocm.rsp响应文件 %ORACLE_HOME%/OPatch/opatch apply -silent -ocmrf D:\app\rt440-ppoo\product\11.2.0\dbhome_1\OPatch\ocm\bin\ocm.rsp <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/c7b055b35f00d064f2a6a043396196f4" alt="" /> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/4f15384180fac15a891ba13966cbb31b" alt="" /> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/5a2d9a966c23d5959bc4ab41c2338e09" alt="" /> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/59f2d8e73fc223064945c1be68bc469d" alt="" /></p> <h3>检查打补丁情况</h3> <p>%ORACLE_HOME%/OPatch/opatch lsinventory # 检查打补丁情况 <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/ede835e3f7d7b149aea592694942c13c" alt="" /> 这里会列出系统已打的补丁情况 <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/1d0463c73bef505761968aa2ab8d35f8" alt="" /></p> <h3>启动监听、数据库服务</h3> <p><img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/f8c6d9b9be78f24ac8abcafe51c14fdb" alt="" /> <img src="http://60.191.64.5:16100/server/index.php?s=/api/attachment/visitFile/sign/620088a3a9c9347d731d4dfa8298b13c" alt="" /></p> <h3>测试数据库、系统是否正常</h3> <h1>&lt;center&gt;至此数据库打补丁已经全部完成&lt;/center&gt;</h1>

页面列表

ITEM_HTML