上一篇文章中提到,从oracle 12.1.0.2之后,oracle就推荐打Database Proactive Bundle Patches(简称DPBP,参考Oracle Database – Overview of Database Patch Delivery Methods (Doc ID 1962125.1))
打补丁的过程,可以参考补丁的readme.html文档,这里简单记录一下打DPBP 170418补丁的过程。
整体来说:
DPBP 170418,补丁号为25433352,里面包含4个大的补丁包。
25397136 这其实是db的补丁集。但是不仅仅要打在db home,grid home也是需要的。
25481150 这其实是个grid的补丁集,OCW的意思是Oracle Cluster Ware,所以你从这个名字中也可以猜到是for grid用的。但是不仅仅要打在grid home,db home也是需要的。
25363750 这个是for ACFS的补丁集
21436941 这个是DBWLM,即DataBase WorkLoad Management组件。
步骤为:
1. 升级opatch到最新版本。注,在opatch 12.2.0.1.5之前,执行opatchauto时需要加-ocmrf [ocm response file]参数。如果使用这个版本之后,就不需要再加响应文件的参数了。另外,170418这个DPBP要求使用opatch版本至少为12.2.0.1.7。
2. [GRID_HOME]/OPatch/opatchauto apply [UNZIPPED_PATCH_LOCATION]/25433352。注意,这个命令需要在各个节点上依次(非并行)执行。执行的时候,会bring down crs和database,会给grid home和oracle home打上补丁。依次打的方式,也减少了停机时间。
3. datapatch -verbose。注,上面说了依次打减少了停机时间,但是停机时间还是需要的,就是在这里的运行datapatch的时间。这个步骤是升级数据字典,针对整个database的数据字典,因此只需在一个节点上跑就可以了。主要注意的是,如果是cdb模式,需要alter pluggable database all open,打开所有的pdb之后,再运行datapatch。
4. 打完之后建议用orachk检查一下。
日志如下:
运行前的信息
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
======Mon Jun 12 00:11:09 CST 2017======== -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.ASMNET1LSNR_ASM.lsnr ONLINE ONLINE 12102-rac1 STABLE ONLINE ONLINE 12102-rac2 STABLE ONLINE ONLINE 12102-rac3 STABLE ora.DG_DATA.dg ONLINE ONLINE 12102-rac1 STABLE ONLINE ONLINE 12102-rac2 STABLE ONLINE ONLINE 12102-rac3 STABLE ora.LISTENER.lsnr ONLINE ONLINE 12102-rac1 STABLE ONLINE ONLINE 12102-rac2 STABLE ONLINE ONLINE 12102-rac3 STABLE ora.net1.network ONLINE ONLINE 12102-rac1 STABLE ONLINE ONLINE 12102-rac2 STABLE ONLINE ONLINE 12102-rac3 STABLE ora.ons ONLINE ONLINE 12102-rac1 STABLE ONLINE ONLINE 12102-rac2 STABLE ONLINE ONLINE 12102-rac3 STABLE -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.12102-rac1.vip 1 ONLINE ONLINE 12102-rac1 STABLE ora.12102-rac2.vip 1 ONLINE ONLINE 12102-rac2 STABLE ora.12102-rac3.vip 1 ONLINE ONLINE 12102-rac3 STABLE ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE 12102-rac2 STABLE ora.LISTENER_SCAN2.lsnr 1 ONLINE ONLINE 12102-rac3 STABLE ora.LISTENER_SCAN3.lsnr 1 ONLINE ONLINE 12102-rac1 STABLE ora.MGMTLSNR 1 ONLINE ONLINE 12102-rac1 169.254.161.44 192.1 68.57.34,STABLE ora.asm 1 ONLINE ONLINE 12102-rac1 Started,STABLE 2 ONLINE ONLINE 12102-rac2 Started,STABLE 3 ONLINE ONLINE 12102-rac3 Started,STABLE ora.cdbrac.db 1 ONLINE ONLINE 12102-rac3 Open,STABLE 2 ONLINE ONLINE 12102-rac1 Open,STABLE 3 ONLINE ONLINE 12102-rac2 Open,STABLE ora.cvu 1 ONLINE ONLINE 12102-rac2 STABLE ora.gns 1 ONLINE ONLINE 12102-rac1 STABLE ora.gns.vip 1 ONLINE ONLINE 12102-rac1 STABLE ora.mgmtdb 1 ONLINE ONLINE 12102-rac1 Open,STABLE ora.oc4j 1 ONLINE ONLINE 12102-rac2 STABLE ora.scan1.vip 1 ONLINE ONLINE 12102-rac2 STABLE ora.scan2.vip 1 ONLINE ONLINE 12102-rac3 STABLE ora.scan3.vip 1 ONLINE ONLINE 12102-rac1 STABLE -------------------------------------------------------------------------------- SQL> select * from dba_registry_sqlpatch; no rows selected SQL> |
节点1的opatch版本检查,节点2,节点3的类似检查。
1 2 3 4 5 |
[root@12102-rac1 ~]# /u01/app/12.1.0.2/grid/OPatch/opatch version OPatch Version: 12.2.0.1.9 OPatch succeeded. [root@12102-rac1 ~]# |
节点1的opatchauto,节点2,节点3的类似操作。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
[root@12102-rac1 ~]# /u01/app/12.1.0.2/grid/OPatch/opatch version OPatch Version: 12.2.0.1.9 OPatch succeeded. [root@12102-rac1 ~]# /u01/app/12.1.0.2/grid/OPatch/opatchauto apply /u01/ora_inst/25433352 OPatchauto session is initiated at Sun Jun 11 21:43:31 2017 System initialization log file is /u01/app/12.1.0.2/grid/cfgtoollogs/opatchautodb/systemconfig2017-06-11_09-43-37PM.log. Session log file is /u01/app/12.1.0.2/grid/cfgtoollogs/opatchauto/opatchauto2017-06-11_09-44-37PM.log The id for this session is R7M1 Executing OPatch prereq operations to verify patch applicability on home /u01/app/12.1.0.2/grid Executing OPatch prereq operations to verify patch applicability on home /u01/app/oracle/product/12.1.0.2/db_1 Patch applicability verified successfully on home /u01/app/12.1.0.2/grid Patch applicability verified successfully on home /u01/app/oracle/product/12.1.0.2/db_1 Verifying SQL patch applicability on home /u01/app/oracle/product/12.1.0.2/db_1 SQL patch applicability verified successfully on home /u01/app/oracle/product/12.1.0.2/db_1 Preparing to bring down database service on home /u01/app/oracle/product/12.1.0.2/db_1 Successfully prepared home /u01/app/oracle/product/12.1.0.2/db_1 to bring down database service Bringing down CRS service on home /u01/app/12.1.0.2/grid Prepatch operation log file location: /u01/app/12.1.0.2/grid/cfgtoollogs/crsconfig/crspatch_12102-rac1_2017-06-11_09-49-08PM.log CRS service brought down successfully on home /u01/app/12.1.0.2/grid Performing prepatch operation on home /u01/app/oracle/product/12.1.0.2/db_1 Perpatch operation completed successfully on home /u01/app/oracle/product/12.1.0.2/db_1 Start applying binary patch on home /u01/app/oracle/product/12.1.0.2/db_1 Binary patch applied successfully on home /u01/app/oracle/product/12.1.0.2/db_1 Performing postpatch operation on home /u01/app/oracle/product/12.1.0.2/db_1 Postpatch operation completed successfully on home /u01/app/oracle/product/12.1.0.2/db_1 Start applying binary patch on home /u01/app/12.1.0.2/grid Binary patch applied successfully on home /u01/app/12.1.0.2/grid Starting CRS service on home /u01/app/12.1.0.2/grid Postpatch operation log file location: /u01/app/12.1.0.2/grid/cfgtoollogs/crsconfig/crspatch_12102-rac1_2017-06-11_10-04-00PM.log CRS service started successfully on home /u01/app/12.1.0.2/grid Preparing home /u01/app/oracle/product/12.1.0.2/db_1 after database service restarted No step execution required......... Prepared home /u01/app/oracle/product/12.1.0.2/db_1 successfully after database service restarted Trying to apply SQL patch on home /u01/app/oracle/product/12.1.0.2/db_1 SQL patch applied successfully on home /u01/app/oracle/product/12.1.0.2/db_1 OPatchAuto successful. --------------------------------Summary-------------------------------- Patching is completed successfully. Please find the summary as follows: Host:12102-rac1 RAC Home:/u01/app/oracle/product/12.1.0.2/db_1 Summary: ==Following patches were SKIPPED: Patch: /u01/ora_inst/25433352/21436941 Reason: This patch is not applicable to this specified target type - "rac_database" Patch: /u01/ora_inst/25433352/25363750 Reason: This patch is not applicable to this specified target type - "rac_database" ==Following patches were SUCCESSFULLY applied: Patch: /u01/ora_inst/25433352/25397136 Log: /u01/app/oracle/product/12.1.0.2/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2017-06-11_21-52-02PM_1.log Patch: /u01/ora_inst/25433352/25481150 Log: /u01/app/oracle/product/12.1.0.2/db_1/cfgtoollogs/opatchauto/core/opatch/opatch2017-06-11_21-52-02PM_1.log Host:12102-rac1 CRS Home:/u01/app/12.1.0.2/grid Summary: ==Following patches were SUCCESSFULLY applied: Patch: /u01/ora_inst/25433352/21436941 Log: /u01/app/12.1.0.2/grid/cfgtoollogs/opatchauto/core/opatch/opatch2017-06-11_21-57-02PM_1.log Patch: /u01/ora_inst/25433352/25363750 Log: /u01/app/12.1.0.2/grid/cfgtoollogs/opatchauto/core/opatch/opatch2017-06-11_21-57-02PM_1.log Patch: /u01/ora_inst/25433352/25397136 Log: /u01/app/12.1.0.2/grid/cfgtoollogs/opatchauto/core/opatch/opatch2017-06-11_21-57-02PM_1.log Patch: /u01/ora_inst/25433352/25481150 Log: /u01/app/12.1.0.2/grid/cfgtoollogs/opatchauto/core/opatch/opatch2017-06-11_21-57-02PM_1.log OPatchauto session completed at Sun Jun 11 22:13:40 2017 Time taken to complete the session 30 minutes, 9 seconds [root@12102-rac1 ~]# [root@12102-rac1 ~]# |
节点1的datapatch,节点2,节点3无需操作。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
[oracle@12102-rac1 OPatch]$ sqlplus "/ as sysdba" SQL*Plus: Release 12.1.0.2.0 Production on Mon Jun 12 00:19:54 2017 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options SQL> alter pluggable database all open; Pluggable database altered. SQL> exit Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options [oracle@12102-rac1 OPatch]$ cd $ORACLE_HOME/OPatc [oracle@12102-rac1 OPatch]$ ./datapatch -verbose SQL Patching tool version 12.1.0.2.0 Production on Mon Jun 12 00:20:42 2017 Copyright (c) 2012, 2017, Oracle. All rights reserved. Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_26172_2017_06_12_00_20_42/sqlpatch_invocation.log 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) Bootstrapping registry and package to current versions...done Determining current state... done Current state of SQL patches: Bundle series DBBP: ID 170418 in the binary registry and not installed in any PDB Adding patches to installation queue and performing prereq checks... Installation queue: For the following PDBs: CDB$ROOT PDB$SEED PDBRAC1 PDBRAC2 Nothing to roll back The following patches will be applied: 25397136 (DATABASE BUNDLE PATCH 12.1.0.2.170418) Installing patches... Patch installation complete. Total patches installed: 4 Validating logfiles... Patch 25397136 apply (pdb CDB$ROOT): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/25397136/21145057/25397136_apply_CDBRAC_CDBROOT_2017Jun12_00_23_03.log (no errors) Patch 25397136 apply (pdb PDB$SEED): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/25397136/21145057/25397136_apply_CDBRAC_PDBSEED_2017Jun12_00_42_12.log (no errors) Patch 25397136 apply (pdb PDBRAC1): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/25397136/21145057/25397136_apply_CDBRAC_PDBRAC1_2017Jun12_00_42_12.log (no errors) Patch 25397136 apply (pdb PDBRAC2): SUCCESS logfile: /u01/app/oracle/cfgtoollogs/sqlpatch/25397136/21145057/25397136_apply_CDBRAC_PDBRAC2_2017Jun12_00_42_10.log (no errors) SQL Patching tool complete on Mon Jun 12 00:59:05 2017 SQL> select PATCH_ID,PATCH_UID,VERSION,ACTION,STATUS,DESCRIPTION,BUNDLE_SERIES,BUNDLE_ID from dba_registry_sqlpatch 2 SQL> / PATCH_ID PATCH_UID VERSION ACTION STATUS DESCRIPTION BUNDLE_SERIES BUNDLE_ID ---------- ---------- -------------------- --------------- --------------- ---------------------------------------------------------------------------------------------------- ------------------------------ ---------- 25397136 21145057 12.1.0.2 APPLY SUCCESS DATABASE BUNDLE PATCH 12.1.0.2.170418 DBBP 170418 SQL> [oracle@12102-rac1 OPatch]$ |
最后在用orachk检查一下。
题外话,你可能会觉得奇怪,我db打了25397136和25481150两个补丁,为什么我只看到了PATCH_ID为25397136的注册信息,没看到25481150的信息?
这是因为,25481150没有产生需要执行的sqlpatch脚本,首先,你可以在$ORACLE_HOME/sqlpatch下是没有看到与25481150相关的需要执行的脚本的。
1 2 3 4 5 6 |
[oracle@12102-rac1 sqlpatch]$ pwd /u01/app/oracle/product/12.1.0.2/db_1/sqlpatch [oracle@12102-rac1 sqlpatch]$ ls 20243804 20594149 20950328 21359749 21694919 22806133 24340679 25397136 sqlpatch sqlpatch_bootstrap_driver.sql sqlpatch.pl 20415006 20788771 21125181 21527488 21949015 23144544 24732088 lib sqlpatch.bat sqlpatch_bootstrap.sql sqlpatch.pm [oracle@12102-rac1 sqlpatch]$ |
而为什么没有在$ORACLE_HOME/sqlpatch下生产脚本,这是由于25481150这个补丁不需要生产执行的脚本。我们可以通过查验action.xml确认。
1 2 3 4 5 6 7 8 9 10 11 |
[oracle@12102-rac1 config]$ pwd /u01/ora_inst/25433352/25481150/etc/config [oracle@12102-rac1 config]$ [oracle@12102-rac1 config]$ ls -l total 168 -rw-r--r--. 1 oracle oinstall 102444 Mar 28 21:00 actions.xml -rw-rw-r--. 1 oracle oinstall 63645 Mar 28 21:01 inventory.xml [oracle@12102-rac1 config]$ [oracle@12102-rac1 config]$ [oracle@12102-rac1 config]$ cat actions.xml |grep -i sqlpatch [oracle@12102-rac1 config]$ |
我们看到是不包含放到sqlpatch目录下的操作。(一般会是onewaycopy具体的脚本)
注:补丁的所有操作,都会写在这个action.xml文件里面。如备份文件,拷贝文件,删除文件,编译文件等等。注意需要最新的opatch,才能执行最新的action.xml。
一条评论
学习了