重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2097|回复: 0
打印 上一主题 下一主题

[Oracle] 11g 11.2.0.4.201020 补丁应用演练

[复制链接]
跳转到指定楼层
楼主
发表于 2022-4-1 16:17:14 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
数据库:11.2.0.4
系统:rhel 7.9
主库:OEL791
备库:OEL792
1、升级前备份数据库
RMAN>run {
allocatechannel d1 type disk;
allocatechannel d2 type disk;
allocatechannel d3 type disk;
allocatechannel d4 type disk;
backupas compressed backupset database format '/home/oracle/rman/data_%d_%T_%s.bak'plus archivelog format '/home/oracle/rman/arch_%d_%T_%s.bak';
releasechannel d1;
releasechannel d2;
releasechannel d3;
releasechannel d4;
}
2、升级包
说明:主备库均上传
sftp>cd /soft
sftp>lcd F:\BaiduNetdiskDownload\2110最新补丁集-文档2118136.2\11GR2-201020\OPatch
sftp>put p6880880_112000_Linux-x86-64.zip
[root@OEL791/]# chown -R oracle:oinstall /soft
[root@OEL791soft]# su - oracle -c "unzip -q -o /soft/p6880880_112000_Linux-x86-64.zip-d /u01/app/oracle/product/11.2.0/db_1/"
[oracle@OEL791OPatch]$ opatch version
OPatchVersion: 11.2.0.3.31
OPatchsucceeded.
[root@OEL791soft]# su - oracle -c "unzip -q -o /soft/p31537677_112040_Linux-x86-64.zip-d /soft"
3、检查补丁
[oracle@OEL79131537677]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail-ph ./
OracleInterim Patch Installer version 11.2.0.3.4
Copyright(c) 2012, Oracle Corporation.  All rightsreserved.
PREREQsession
OracleHome       :/u01/app/oracle/product/11.2.0/db_1
CentralInventory : /u01/app/oraInventory
   from           :/u01/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatchversion    : 11.2.0.3.4
OUIversion       : 11.2.0.4.0
Log filelocation :/u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2022-03-28_13-42-03PM_1.log
Invokingprereq "checkconflictagainstohwithdetail"
Prereq"checkConflictAgainstOHWithDetail"not executed
Unable tocreate Patch Object.
Exceptionoccured : Version field of the component "delete" in actions filecannot be <null> or empty. Please check patch metadata.
OPatchsucceeded.
[oracle@OEL79231537677]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail-ph ./
OracleInterim Patch Installer version 11.2.0.3.4
Copyright(c) 2012, Oracle Corporation.  All rightsreserved.
PREREQsession
Oracle Home       : /u01/app/oracle/product/11.2.0/db_1
CentralInventory : /u01/app/oraInventory
   from           :/u01/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatchversion    : 11.2.0.3.4
OUIversion       : 11.2.0.4.0
Log filelocation : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2022-03-28_13-43-19PM_1.log
Invokingprereq "checkconflictagainstohwithdetail"
Prereq"checkConflictAgainstOHWithDetail"not executed
Unable tocreate Patch Object.
Exceptionoccured : Version field of the component "delete" in actions filecannot be <null> or empty. Please check patch metadata.
OPatchsucceeded.
4、升级
说明:升级前关闭数据库、监听。
先打备库补丁,再打主库,打完后在主库跑脚本,改变数据库结构,数据自然会传到备库。
主库执行:
SQL>alter system set log_archive_dest_state_2=defer scope=both sid='*';
4.1、备库应用opatch
备库执行:
SQL>select open_mode from v$database;
OPEN_MODE
----------------------------------------
READ ONLYWITH APPLY
SQL>alter database recover managed standby database cancel;
Databasealtered.
SQL>shutdown immediate;
Databaseclosed.
Databasedismounted.
ORACLEinstance shut down.
SQL>exit
Disconnectedfrom Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bitProduction
With thePartitioning, OLAP, Data Mining and Real Application Testing options
[oracle@OEL792db_1]$ lsnrctl stop
LSNRCTLfor Linux: Version 11.2.0.4.0 - Production on 29-MAR-2022 13:41:14
Copyright(c) 1991, 2013, Oracle.  All rightsreserved.
Connectingto (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.133.151)(PORT=1521)))
Thecommand completed successfully
[oracle@OEL792OPatch]$ ./opatch apply /soft/31537677
[oracle@OEL792OPatch]$ lsnrctl start
LSNRCTLfor Linux: Version 11.2.0.4.0 - Production on 29-MAR-2022 15:10:08
Copyright(c) 1991, 2013, Oracle.  All rightsreserved.
Starting/u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNRfor Linux: Version 11.2.0.4.0 - Production
Systemparameter file is/u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Logmessages written to /u01/app/oracle/diag/tnslsnr/OEL792/listener/alert/log.xml
Listeningon: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.133.151)(PORT=1521)))
Listeningon: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connectingto (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.133.151)(PORT=1521)))
STATUS ofthe LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version11.2.0.4.0 - Production
StartDate                29-MAR-2022 15:10:28
Uptime                    0 days 0 hr. 0 min. 40 sec
TraceLevel               off
Security                  ON: Local OS Authentication
SNMP                      OFF
ListenerParameter File  /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
ListenerLog File        /u01/app/oracle/diag/tnslsnr/OEL792/listener/alert/log.xml
ListeningEndpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.133.151)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
ServicesSummary...
Service"orcl151" has 1 instance(s).
  Instance "orcl151", status UNKNOWN,has 1 handler(s) for this service...
Thecommand completed successfully
[oracle@OEL792OPatch]$ sqlplus / as sysdba
SQL*Plus:Release 11.2.0.4.0 Production on Tue Mar 29 15:11:04 2022
Copyright(c) 1982, 2013, Oracle.  All rightsreserved.
Connectedto an idle instance.
SQL>startup mount
ORACLEinstance started.
TotalSystem Global Area 3206836224 bytes
FixedSize                  2257520 bytes
VariableSize            1811942800 bytes
DatabaseBuffers         1375731712 bytes
RedoBuffers               16904192 bytes
Databasemounted.
注意:如果使用了DG broker,需通过其修改state=APPLY-OFF,以避免DGbroker自动启动MRP.
4.2、主库应用Patch
[oracle@OEL791~]$ lsnrctl stop
LSNRCTLfor Linux: Version 11.2.0.4.0 - Production on 29-MAR-2022 15:16:50
Copyright(c) 1991, 2013, Oracle.  All rightsreserved.
Connectingto (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.133.150)(PORT=1521)))
Thecommand completed successfully
[oracle@OEL791~]$ sqlplus / as sysdba
SQL*Plus:Release 11.2.0.4.0 Production on Tue Mar 29 15:17:14 2022
Copyright(c) 1982, 2013, Oracle.  All rightsreserved.
Connectedto:
OracleDatabase 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With thePartitioning, OLAP, Data Mining and Real Application Testing options
SQL>shutdown immediate
Databaseclosed.
Databasedismounted.
ORACLEinstance shut down.
[oracle@OEL791~]$ opatch version
OPatchVersion: 11.2.0.3.31
OPatchsucceeded.
[oracle@OEL791soft]$ cd $ORACLE_HOME/OPatch
[oracle@OEL791OPatch]$ ./opatch apply /soft/31537677
OracleInterim Patch Installer version 11.2.0.3.31
Copyright(c) 2022, Oracle Corporation.  All rightsreserved.
OracleHome       : /u01/app/oracle/product/11.2.0/db_1
CentralInventory : /u01/app/oraInventory
   from           :/u01/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatchversion    : 11.2.0.3.31
OUIversion       : 11.2.0.4.0
Log filelocation : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2022-03-29_15-19-50PM_1.log
Verifyingenvironment and performing prerequisite checks...
Do youwant to proceed? [y|n]
y
UserResponded with: Y
Allchecks passed.
Pleaseshutdown Oracle instances running out of this ORACLE_HOME on the local system.
(OracleHome = '/u01/app/oracle/product/11.2.0/db_1')
Is thelocal system ready for patching? [y|n]
y
UserResponded with: Y
Backingup files...
/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.
Compositepatch 31537677 successfully applied.
OPatchSession completed with warnings.
Log filelocation: /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2022-03-29_15-19-50PM_1.log
OPatchcompleted with warnings.
4.3、升级/修补RDBMS及字典对象
[oracle@OEL791admin]$ cd $ORACLE_HOME/rdbms/admin
[oracle@OEL791admin]$ sqlplus / as sysdba
SQL*Plus:Release 11.2.0.4.0 Production on Tue Mar 29 15:27:08 2022
Copyright(c) 1982, 2013, Oracle.  All rightsreserved.
Connectedto an idle instance.
SQL>startup restrict;
ORACLEinstance started.
TotalSystem Global Area 3206836224 bytes
FixedSize                  2257520 bytes
VariableSize            1811942800 bytes
DatabaseBuffers         1375731712 bytes
RedoBuffers               16904192 bytes
Databasemounted.
Databaseopened.
SQL>@catbundle psu apply
25          end;
26         commit;
27       end;
28    END LOOP;
29    close query_crs;
30  end;
31  /
PL/SQLprocedure successfully completed.
SQL>
SQL>
SQL>ALTER SESSION SET current_schema = SYS;
Sessionaltered.
SQL>PROMPT Updating registry...
Updatingregistry...
SQL>INSERT INTO registry$history
  2    (action_time,action,
  3    namespace, version, id,
  4    bundle_series, comments)
  5 VALUES
  6   (SYSTIMESTAMP, 'APPLY',
  7    SYS_CONTEXT('REGISTRY$CTX','NAMESPACE'),
  8    '11.2.0.4',
  9    201020,
10    'PSU',
11    'PSU 11.2.0.4.201020');
1 rowcreated.
SQL>COMMIT;
Commitcomplete.
SQL>SPOOL off
SQL>SET echo off
Check thefollowing log file for errors:
/u01/app/oracle/cfgtoollogs/catbundle/catbundle_PSU_ORCL150_APPLY_2022Mar29_15_28_06.log
4.4、主库重建 DG环境
[oracle@OEL791admin]$ lsnrctl start
LSNRCTLfor Linux: Version 11.2.0.4.0 - Production on 29-MAR-2022 15:38:23
Copyright(c) 1991, 2013, Oracle.  All rightsreserved.
Starting/u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR forLinux: Version 11.2.0.4.0 - Production
Systemparameter file is/u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Logmessages written to /u01/app/oracle/diag/tnslsnr/OEL791/listener/alert/log.xml
Listeningon: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.133.150)(PORT=1521)))
Listeningon: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connectingto (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.133.150)(PORT=1521)))
STATUS ofthe LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version11.2.0.4.0 - Production
StartDate                29-MAR-2022 15:38:23
Uptime                    0 days 0 hr. 0 min. 0 sec
TraceLevel               off
Security                  ON: Local OS Authentication
SNMP                      OFF
ListenerParameter File  /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
ListenerLog File        /u01/app/oracle/diag/tnslsnr/OEL791/listener/alert/log.xml
ListeningEndpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.133.150)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
ServicesSummary...
Service"orcl150" has 1 instance(s).
  Instance "orcl150", status UNKNOWN,has 1 handler(s) for this service...
Thecommand completed successfully
强制主节点向监听注册服务
SQL>alter system register;
Systemaltered.
在单个实例(非 RAC)中禁用受限会话以允许终端连接
SQL>alter system disable restricted session;
Systemaltered.
SQL>exit
Disconnectedfrom Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bitProduction
With thePartitioning, OLAP, Data Mining and Real Application Testing options
重新启用到备库的日志传送
SQL>alter system set log_archive_dest_state_2=enable scope=both sid='*';
Systemaltered.
备库执行
SQL>alter database open;
Databasealtered.
SQL>select open_mode from v$database;
OPEN_MODE
----------------------------------------
READ ONLY
SQL>alter database recover managed standby database using current logfiledisconnect from session;
Databasealtered.
SQL>select open_mode from v$database;
OPEN_MODE
----------------------------------------
READ ONLYWITH APPLY
SQL>select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
--------------
           299
SQL> r
  1* select sequence#,to_char(first_time,'yyyy-mm-ddhh24:mi:ss'),to_char(next_time,'yyyy-mm-dd hh24:mi:ss'),applied fromv$archived_log order by 1
SEQUENCE#TO_CHAR(FIRST_TIME,'YYYY-MM-DDHH24:MI: TO_CHAR(NEXT_TIME,'YYYY-MM-DDHH24:MI:SAPPLIED
------------------------------------------------ --------------------------------------------------------
       289 2022-03-29 10:26:02                    2022-03-29 11:21:12                    YES
       290 2022-03-29 11:21:12                    2022-03-29 11:21:44                    YES
       291 2022-03-29 11:21:44                    2022-03-29 11:22:21                    YES
       292 2022-03-29 11:22:21                    2022-03-29 11:23:29                    YES
       293 2022-03-29 11:23:29                    2022-03-29 13:22:53                    YES
       294 2022-03-29 13:22:53                    2022-03-29 13:23:00                    YES
       295 2022-03-29 13:23:00                    2022-03-29 15:27:23                    YES
       296 2022-03-29 15:27:23                    2022-03-29 15:27:28                    YES
       297 2022-03-29 15:27:28                    2022-03-29 15:28:13                    YES
       298 2022-03-29 15:28:13                    2022-03-29 15:28:34                    YES
       299 2022-03-29 15:28:34                    2022-03-29 15:45:41                    IN-MEMORY
11 rowsselected.
主库执行:
SQL>select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
--------------
           299
5、主备库验证补丁是否成功应用
主库
[oracle@OEL791~]$ opatch lspatches
31537677;DatabasePatch Set Update : 11.2.0.4.201020 (31537677)
OPatchsucceeded.
备库
[oracle@OEL792OPatch]$ opatch lspatches
31537677;DatabasePatch Set Update : 11.2.0.4.201020 (31537677)
OPatchsucceeded.
检查注册表历史升级记录
SQL> r
  1* selectaction_time,action,namespace,version,bundle_series,id from registry$history
ACTION_TIME                    ACTION               NAMESPACE            VERSION              BUNDLE_SERIES                ID
-------------------------------------------------- -------------------- ---------------------------------------- ----------
24-AUG-1312.03.45.119862 PM   APPLY                SERVER               11.2.0.4             PSU                           0
07-OCT-2111.25.40.878982 AM   APPLY                SERVER               11.2.0.4             PSU                           0
29-MAR-2203.28.39.351894 PM   APPLY                SERVER               11.2.0.4             PSU                      201020

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2024-11-16 04:06 , Processed in 0.117567 second(s), 21 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表