准备

替换OPatch
[oracle@localhost ~]$ ls
33128584  p33128584_112040_Linux-x86-64.zip  p6880880_112000_Linux-x86-64.zip
33192642  p33192642_112040_Linux-x86-64.zip  PatchSearch.xml
OPatch    p33248354_112040_Linux-x86-64.zip  response
[oracle@localhost 11.2.0]$ cd /data/oracle/product/11.2.0/
[oracle@localhost 11.2.0]$ mv OPatch OPatch.bak
[oracle@localhost 11.2.0]$ cp -r /home/oracle/OPatch/ ./

第一个补丁

关闭数据库
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Jan 19 22:15:28 2022
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> quit

检测补丁安装是否有冲突,如果有冲突,就把以前安装过的补丁回滚

例如:和666666冲突了
回滚命令:/data/oracle/product/11.2.0/OPatch/opatch rollback -id 666666

[oracle@localhost ~]$ cd 33128584/
[oracle@localhost 33128584]$ /data/oracle/product/11.2.0/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle 临时补丁程序安装程序版本 11.2.0.3.31
版权所有 (c) 2022, Oracle Corporation。保留所有权利。

PREREQ session

Oracle 主目录       :/data/oracle/product/11.2.0
主产品清单:/data/oracle/inventory
   来自           :/data/oracle/product/11.2.0/oraInst.loc
OPatch 版本    :11.2.0.3.31
OUI 版本       :11.2.0.4.0
日志文件位置:/data/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2022-01-19_22-01-23下午_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.
开始打补丁
(如果此步骤报错,可能是找不到fuser命令,具体可以看日志,)
[oracle@localhost 33128584]$ /data/oracle/product/11.2.0/OPatch/opatch apply
Oracle 临时补丁程序安装程序版本 11.2.0.3.31
版权所有 (c) 2022, Oracle Corporation。保留所有权利。


Oracle 主目录       :/data/oracle/product/11.2.0
主产品清单:/data/oracle/inventory
   来自           :/data/oracle/product/11.2.0/oraInst.loc
OPatch 版本    :11.2.0.3.31
OUI 版本       :11.2.0.4.0
日志文件位置:/data/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2022-01-19_21-39-1

Verifying environment and performing prerequisite checks...

--------------------------------------------------------------------------------
Start OOP by Prereq process.
Launch OOP...

Oracle 临时补丁程序安装程序版本 11.2.0.3.31
版权所有 (c) 2022, Oracle Corporation。保留所有权利。


Oracle 主目录       :/data/oracle/product/11.2.0
主产品清单:/data/oracle/inventory
   来自           :/data/oracle/product/11.2.0/oraInst.loc
OPatch 版本    :11.2.0.3.31
OUI 版本       :11.2.0.4.0
日志文件位置:/data/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2022-01-19_21-39-2

Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   17478514  18031668  18522509  19121551  19769445  26392168  26925576  27338049  27734982  28204707  28729262  29141056  29497421  2

是否继续? [y|n]
y
User Responded with: Y
All checks passed.

请关闭本地系统上在此 ORACLE_HOME 之外运行的 Oracle 实例。
(Oracle 主目录 = '/data/oracle/product/11.2.0')


本地系统是否已准备打补丁? [y|n]
y
User Responded with: Y
Backing up files...
Applying sub-patch '17478514' to OH '/data/oracle/product/11.2.0'
正在为组件 oracle.rdbms, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms.rsf, 11.2.0.4.0 打补丁...
正在为组件 oracle.sdo, 11.2.0.4.0 打补丁...
正在为组件 oracle.sysman.agent, 10.2.0.4.5 打补丁...
正在为组件 oracle.xdk, 11.2.0.4.0 打补丁...
正在为组件 oracle.rdbms.dbscripts, 11.2.0.4.0 打补丁...
正在为组件 oracle.sdo.locator, 11.2.0.4.0 打补丁...
......
......
......
+ dir2=/data/oracle/product/11.2.0/sysman/lib/
+ '[' '' '!=' '' ']'
+ make -f /data/oracle/product/11.2.0/sysman/lib/ins_emagent.mk new_ld_shlib _FULL_LIproduct/11.2.0/sysman/lib/ '_LIBNAME_LIBS=$(libnmcfsgaLIBS)' '_LIBNAME_EXTRALIBS=$(li
/bin/ld: warning: -z lazyload ignored.
/bin/ld: warning: -z nolazyload ignored.
/bin/ld: warning: -z lazyload ignored.
/bin/ld: warning: -z nolazyload ignored.
/bin/ld: warning: -z lazyload ignored.
/bin/ld: warning: -z nolazyload ignored.
/bin/ld: warning: -z lazyload ignored.
/bin/ld: warning: -z nolazyload ignored.
/bin/ld: warning: -z lazyload ignored.
/bin/ld: warning: -z nolazyload ignored.
/bin/ld: warning: -z lazyload ignored.
/bin/ld: warning: -z nolazyload ignored.
/bin/ld: warning: -z lazyload ignored.
/bin/ld: warning: -z nolazyload ignored.
/bin/ld: warning: -z lazyload ignored.
/bin/ld: warning: -z nolazyload ignored.
/bin/ld: warning: -z lazyload ignored.
/bin/ld: warning: -z nolazyload ignored.


Composite patch 33128584 successfully applied.
OPatch 会话已完成, 但出现警告。
Log file location: /data/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2022-01-19_21

OPatch completed with warnings.
第一个补丁打完,更新数据库
cd $ORACLE_HOME/rdbms/admin    //一定要进入到这个目录执行,因为下面那个sql在此目录中
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply     //此步骤比较长,我就不放具体代码了
SQL> QUIT

第二个补丁

关闭数据库
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed Jan 19 22:15:28 2022
Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> quit
开始打补丁
[oracle@localhost 33192642]$ /data/oracle/product/11.2.0/OPatch/opatch apply
Oracle 临时补丁程序安装程序版本 11.2.0.3.31
版权所有 (c) 2022, Oracle Corporation。保留所有权利。


Oracle 主目录       :/data/oracle/product/11.2.0
主产品清单:/data/oracle/inventory
   来自           :/data/oracle/product/11.2.0/oraInst.loc
OPatch 版本    :11.2.0.3.31
OUI 版本       :11.2.0.4.0
日志文件位置:/data/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2022-01-19_22-38-45下午_1.log

Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   33192642  

是否继续? [y|n]
y
User Responded with: Y
All checks passed.

请关闭本地系统上在此 ORACLE_HOME 之外运行的 Oracle 实例。
(Oracle 主目录 = '/data/oracle/product/11.2.0')


本地系统是否已准备打补丁? [y|n]
y
User Responded with: Y
Backing up files...
正在将临时补丁程序 '33192642' 应用于 OH '/data/oracle/product/11.2.0'
ApplySession: Oracle 主目录中不存在可选组件 [ oracle.sqlj, 11.2.0.4.0 ] , [ oracle.sqlj.companion, 11.2.0.4.0 ] , 或找到更高版本。

正在为组件 oracle.javavm.server, 11.2.0.4.0 打补丁...

正在为组件 oracle.precomp.common, 11.2.0.4.0 打补丁...

正在为组件 oracle.rdbms, 11.2.0.4.0 打补丁...

正在为组件 oracle.rdbms.dbscripts, 11.2.0.4.0 打补丁...

正在为组件 oracle.javavm.client, 11.2.0.4.0 打补丁...

正在为组件 oracle.dbjava.jdbc, 11.2.0.4.0 打补丁...

正在为组件 oracle.dbjava.ic, 11.2.0.4.0 打补丁...
Patch 33192642 successfully applied.
Log file location: /data/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2022-01-19_22-38-45下午_1.log

OPatch succeeded.

第二个补丁打完,更新数据库
[oracle@localhost 33192642]$ cd $ORACLE_HOME/sqlpatch/33192642
[oracle@localhost 33192642]$ pwd
/data/oracle/product/11.2.0/sqlpatch/33192642
[oracle@localhost 33192642]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.4.0 Production on Wed Jan 19 22:46:48 2022

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup upgrade
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size		    2260088 bytes
Variable Size		  335545224 bytes
Database Buffers	  725614592 bytes
Redo Buffers		    5517312 bytes
Database mounted.
Database opened.
SQL> @postinstall.sql             //此步骤较长,就不贴出来了,中间有一个地方会卡很久,不要动耐心等待
SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1068937216 bytes
Fixed Size		    2260088 bytes
Variable Size		  461374344 bytes
Database Buffers	  599785472 bytes
Redo Buffers		    5517312 bytes
Database mounted.
Database opened.

启动监听

[oracle@localhost ~]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-JAN-2022 23:10:21

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

TNS-01106: Listener using listener name LISTENER has already been started
[oracle@localhost ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-JAN-2022 23:10:24

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                19-JAN-2022 23:10:11
Uptime                    0 days 0 hr. 0 min. 12 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /data/oracle/product/11.2.0/network/admin/listener.ora
Listener Log File         /data/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
The listener supports no services
The command completed successfully

测试连接

在这里插入图片描述

补丁包下载

链接:https://download.csdn.net/download/weixin_44245976/85526107

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐