打DB PSU补丁集过程--Windows Oracle
11.2.0.4
微信公众号:云库管 www.yunDBA.com
思路总结:
1. Opatch工具升级到某高版本以上(具体见补丁集readme.html中有要求);
2. 停止数据库服务, 执行opatch apply命令,目的是用新补丁程序替换原有程序文件(对应下面第1至9步);
3. 打开数据库startup模式,执行补丁集SQL脚本,更改数据词典内容(对应下面第10步);
目录
2.升级Opatch 到11.2.0.3.12版本(重命名-复制Opatch)
5.关闭分布式事务服务 net stop msdtc(未发现有)
7.解压DB PSU补丁集后,将解压结果放到Opatch目录下
12.查看已打补丁数据字典查验dba_registry_history
opatch
e:\Oracle\product\11.2.0\dbhome_1\OPatch>opatch version
OPatch Version: 11.2.0.3.4
OPatch succeeded.
具体操作:
把目录名 $ORACLE_HOME\OPatch 修改成 OPatch_old,
复制p6880880_112000_MSWIN-x86-64-11.2.0.3.19.zip到 $ORACLE_HOME目录下,执行解压到当前目录操作,会自动生成新的OPatch目录,这样就完成OPatch目录下内容替换。
e:\Oracle\product\11.2.0\dbhome_1\OPatch>opatch version
OPatch Version: 11.2.0.3.12
OPatch succeeded.
e:\Oracle\product\11.2.0\dbhome_1\OPatch>lsnrctl stop
LSNRCTL for 64-bit Windows: Version 11.2.0.4.0 - Production on 23-3月 -2016 21:50:16
Copyright (c) 1991, 2013, Oracle. All rights reserved.
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
命令执行成功
DJANGO是数据库的实例名称
e:\Oracle\product\11.2.0\dbhome_1\OPatch>net stop oracleservicedjango
OracleServiceDJANGO 服务正在停止....
OracleServiceDJANGO 服务已成功停止。
注意:
Oracleservicedjango 这是数据库实例的服务名称, 等同于下图中画红线的服务名称,根据现场实际情况调整。也可以在windows服务里停掉所有oracle相关服务(oracle开头的服务名)
下图举例数据库实例名是ORCL
问题现象: 如果在后面打补丁期间出现下面错误:Prerequisite check “CheckActiveFilesAndExecutables”
failed. 说明oracle程序文件被占用,无法更新。
解决办法: 把oracle服务的启动类型都设置成"手动"方式,重启一下windows操作系统,然后再执行打补丁工作。
e:\Oracle\product\11.2.0\dbhome_1\OPatch> net stop msdtc
MSDTC 服务正在停止....
MSDTC 服务已成功停止。
设置ORACLE_HOME
e:\Oracle\product\11.2.0\dbhome_1\OPatch>set ORACLE_HOME=E:\Oracle\product\11.2.0\dbhome_1
e:\Oracle\product\11.2.0\dbhome_1\OPatch>ECHO %ORACLE_HOME%
E:\Oracle\product\11.2.0\dbhome_1
设置PATH
e:\Oracle\product\11.2.0\dbhome_1\OPatch>ECHO %PATH%
E:\Oracle\product\11.2.0\dbhome_1\bin;D:\Oracle\product\11.2.0\client\bin;D:\Oracle\product\11.2.0\client_1;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Program Fil
es (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Fi
les\Intel\WirelessCommon\;C:\Program Files\Lenovo\Fingerprint Manager Pro\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Comp
onents\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;D:\Program Files\IDM Computer Solutions\UltraEdit;C:\
Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;D:\Program Files\VanDyke Software\Clients\
e:\Oracle\product\11.2.0\dbhome_1\OPatch>set PATH=%ORACLE_HOME%\perl\bin;%PATH%
e:\Oracle\product\11.2.0\dbhome_1\OPatch>echo %PATH%
E:\Oracle\product\11.2.0\dbhome_1\perl\bin;E:\Oracle\product\11.2.0\dbhome_1\bin;D:\Oracle\product\11.2.0\client\bin;D:\Oracle\product\11.2.0\client_1;C:\Program Files (x86)\Intel\iCLS Client\;C:\Prog
ram Files\Intel\iCLS Client\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files
\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Lenovo\Fingerprint Manager Pro\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files
(x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;D:\Program
Files\IDM Computer Solutions\UltraEdit;C:\Program Files (x86)\IDM Computer Solutions\UltraCompare;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;D:\Program Files
\VanDyke Software\Clients\
不同时期的db psu编号会不同,编号越大,说明其越新。
Db psu补丁集zip文件如图下所示:11.2.0.4.200714 WINDOWS DB BUNDLE PATCH(Patch)31223458 ----这个db psu版本是适用于oracle11.2.0.4的 2020.7.14发布的DB PSU 补丁集
下面以历史补丁集WINDOWS DB BUNDLE PATCH 11.2.0.4.160229(22624682)为例子,
e:\Oracle\product\11.2.0\dbhome_1\OPatch>cd 22624682
e:\Oracle\product\11.2.0\dbhome_1\OPatch\22624682>e:\Oracle\product\11.2.0\dbhome_1\OPatch\opatch apply
Oracle 中间补丁程序安装程序版本 11.2.0.3.12
版权所有 (c) 2016, Oracle Corporation。保留所有权利。
Oracle Home : E:\Oracle\product\11.2.0\dbhome_1
Central Inventory : C:\Program Files\Oracle\Inventory
from : n/a
OPatch version : 11.2.0.3.12
OUI version : 11.2.0.4.0
Log file location : E:\Oracle\product\11.2.0\dbhome_1\cfgtoollogs\opatch\22624682_Mar_23_2016_22_05_42\apply2016-03-23_22-05-42下午_1.log
Verifying environment and performing prerequisite checks...
OPatch continues with these patches: 22624682
是否继续? [y|n]
y
User Responded with: Y
All checks passed.
请关闭本地系统上在此 ORACLE_HOME 之外运行的 Oracle 实例。
(Oracle 主目录 = 'E:\Oracle\product\11.2.0\dbhome_1')
本地系统是否已准备打补丁? [y|n]
y
User Responded with: Y
Backing up files...
Applying interim patch '22624682' to OH 'E:\Oracle\product\11.2.0\dbhome_1'
ApplySession: Oracle 主目录中不存在可选组件 [ oracle.rdbms.tg4msql, 11.2.0.4.0 ] , [ oracle.rdbms.tg4sybs, 11.2.0.4.0 ] , [ oracle.rdbms.tg4tera, 11.2.0.4.0 ] , [ oracle.rdbms.tg4ifmx, 11.2.0.4.0 ] ,
[ oracle.rdbms.tg4db2, 11.2.0.4.0 ] , [ oracle.rdbms.ic, 11.2.0.4.0 ] , [ oracle.has.cfs, 11.2.0.4.0 ] , [ oracle.has.crs, 11.2.0.4.0 ] , [ oracle.has.cvu, 11.2.0.4.0 ] , [ oracle.usm, 11.2.0.4.0 ] ,
或找到更高版本。
电子邮件地址/用户名:敲回车ENTER
即不留邮箱地址
正在为组件 oracle.rdbms.deconfig, 11.2.0.4.0 打补丁...
。。。。。中间提示有省略
Patch 22624682 successfully applied.
Log file location: E:\Oracle\product\11.2.0\dbhome_1\cfgtoollogs\opatch\22624682_Mar_23_2016_22_05_42\apply2016-03-23_22-05-42下午_1.log
OPatch succeeded.
问题现象:如果在后面打补丁期间出现下面错误:Prerequisite check “CheckActiveFilesAndExecutables” failed. 说明oracle程序文件被占用,无法更新。
解决办法: 在任务管理器当中关闭oracle相关进程, 或把oracle服务的启动类型都设置成"手动"方式,重启一下windows操作系统,然后再执行打补丁工作。
e:\Oracle\product\11.2.0\dbhome_1\OPatch\22624682>cd %ORACLE_HOME%\rdbms\admin
E:\Oracle\product\11.2.0\dbhome_1\RDBMS\ADMIN>lsnrctl start
LSNRCTL for 64-bit Windows: Version 11.2.0.4.0 - Production on 23-3月 -2016 22:10:37
Copyright (c) 1991, 2013, Oracle. All rights reserved.
启动tnslsnr: 请稍候...
TNSLSNR for 64-bit Windows: Version 11.2.0.4.0 - Production
系统参数文件为E:\Oracle\product\11.2.0\dbhome_1\network\admin\listener.ora
写入E:\Oracle\diag\tnslsnr\IBM-Thinkpad-PC\listener\alert\log.xml的日志信息
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=IBM-Thinkpad-PC)(PORT=1521)))
正在连接到 (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
LISTENER 的 STATUS
------------------------
别名 LISTENER
版本 TNSLSNR for 64-bit Windows: Version 11.2.0.4.0 - Production
启动日期 23-3月 -2016 22:10:43
正常运行时间 0 天 0 小时 0 分 5 秒
跟踪级别 off
安全性 ON: Local OS Authentication
SNMP OFF
监听程序参数文件 E:\Oracle\product\11.2.0\dbhome_1\network\admin\listener.ora
监听程序日志文件 E:\Oracle\diag\tnslsnr\IBM-Thinkpad-PC\listener\alert\log.xml
监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=IBM-Thinkpad-PC)(PORT=1521)))
服务摘要..
服务 "CLRExtProc" 包含 1 个实例。
实例 "CLRExtProc", 状态 UNKNOWN, 包含此服务的 1 个处理程序...
命令执行成功
先启动数据库服务(通过命令行方式或图形方式)
E:\Oracle\product\11.2.0\dbhome_1\RDBMS\ADMIN>net start oracleservicedjango
OracleServiceDJANGO 服务正在启动 ............
OracleServiceDJANGO 服务已经启动成功。
然后执行sql更新
cd %ORACLE_HOME%\rdbms\admin
E:\Oracle\product\11.2.0\dbhome_1\RDBMS\ADMIN>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on 星期三 3月 23 22:13:29 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
SQL> @catbundle.sql PSU apply
解释一下: catbundle.sql是一个文件, 其位置在%ORACLE_HOME%\rdbms\admin目录下, 所以前面的cd %ORACLE_HOME%\rdbms\admin步骤不能少
。。。。。。。
SQL> SPOOL off
SQL> SET echo off
Check the following log file for errors:
E:\Oracle\cfgtoollogs\catbundle\catbundle_PSU_DJANGO_APPLY_2016Mar23_22_13_46.log
SQL> @utlrp.sql
编译失效对象
---查无失效对象
SQL> QUIT
E:\Oracle\product\11.2.0\dbhome_1\OPatch>opatch lspatches -oh E:\Oracle\product\11.2.0\dbhome_1
22624682;WINDOWS DB BUNDLE PATCH 11.2.0.4.160229:(22624682)
E:\Oracle\product\11.2.0\dbhome_1\OPatch>opatch lsinventory
Oracle 中间补丁程序安装程序版本 11.2.0.3.12
版权所有 (c) 2016, Oracle Corporation。保留所有权利。
Oracle Home : E:\Oracle\product\11.2.0\dbhome_1
Central Inventory : C:\Program Files\Oracle\Inventory
from : n/a
OPatch version : 11.2.0.3.12
OUI version : 11.2.0.4.0
Log file location : E:\Oracle\product\11.2.0\dbhome_1\cfgtoollogs\opatch\opatch2016-03-23_22-24-22下午_1.log
Lsinventory Output file location : E:\Oracle\product\11.2.0\dbhome_1\cfgtoollogs\opatch\lsinv\lsinventory2016-03-23_22-24-22下午.txt
--------------------------------------------------------------------------------
。。。
中间补丁程序 (1) :
Patch 22624682 : applied on Wed Mar 23 22:06:42 CST 2016
Unique Patch ID: 19974329
Patch description: "WINDOWS DB BUNDLE PATCH 11.2.0.4.160229:(22624682)"
Created on 10 Mar 2016, 22:29:18 hrs
Bugs fixed:
16809786, 17716305, 17348614, 16382883, 18125929, 18246045, 17835048
。。。
17390431, 20513382, 13837378, 17323222, 17297939
--------------------------------------------------------------------------------
OPatch succeeded.
E:\Oracle\product\11.2.0\dbhome_1\OPatch>
Sqlplus “/ as sysdba”
set line 200
col ACTION_TIME format a40
col COMMENTS format a30
col version format a25
select action_time, version,id,COMMENTS
from dba_registry_history;