本次演示为Oracle 12cR2版本单实例数据库的RU升级,从12.2.0.1.0升级到12.2.0.1.180116。
演示环境:
操作系统:Linux-x86-64
数据库版本:12.2.0.1.0
DB的RU升级包(12.2.0.1.180116):p27105253_122010_Linux-x86-64.zip
解压缩后的目录:/u01/oracle_setup/27105253
1、 查看数据库版本
Oracle安装的opatch目录: [root@single-instance ~]# su - oracle Last login: Tue Mar 27 20:58:42 CST 2018 [oracle@single-instance ~]$ cd $ORACLE_HOME/OPatch 查询opatch版本: [oracle@single-instance OPatch]$ ./opatch version OPatch Version: 12.2.0.1.6 OPatch succeeded. [oracle@single-instance OPatch]$ ./opatch lsinventory Oracle Interim Patch Installer version12.2.0.1.6 Copyright (c) 2018, OracleCorporation. All rights reserved. Oracle Home : /u01/app/oracle/product/12.2.0.1/db_1 Central Inventory : /u01/app/oraInventory from :/u01/app/oracle/product/12.2.0.1/db_1/oraInst.loc OPatch version : 12.2.0.1.6 OUI version : 12.2.0.1.4 Log file location :/u01/app/oracle/product/12.2.0.1/db_1/cfgtoollogs/opatch/opatch2018-04-15_16-04-04PM_1.log Lsinventory Output file location :/u01/app/oracle/product/12.2.0.1/db_1/cfgtoollogs/opatch/lsinv/lsinventory2018-04-15_16-04-04PM.txt -------------------------------------------------------------------------------- Local Machine Information:: Hostname: single-instance ARU platform id: 226 ARU platform description:: Linux x86-64 Installed Top-level Products (1): Oracle Database 12c 12.2.0.1.0 There are 1 products installed in thisOracle Home. There are no Interim patches installed inthis Oracle Home. -------------------------------------------------------------------------------- OPatch succeeded.
2、关闭数据库
SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. 关闭监听: [oracle@single-instance OPatch]$ lsnrctl stop
3、解压缩升级包
进入OPatch升级包的目录,解压缩 [oracle@single-instance oracle_setup]$unzip p27105253_122010_Linux-x86-64.zip [oracle@single-instance oracle_setup]$ ll total 112928 drwxr-xr-x 4 oracle oinstall 67 Jan 9 23:49 27105253 -rw-r--r-- 1 oracle oinstall 115536245 Apr15 15:17 p27105253_122010_Linux-x86-64.zip -rw-rw-r-- 1 oracle oinstall 96859 Jan 17 06:07 PatchSearch.xml [oracle@single-instance oracle_setup]$ cd 27105253/
4、升级补丁
1)、补丁包检查 [oracle@single-instance 27105253]$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./ bash: opatch: command not found...OracleInterim Patch Installer version 12.2.0.1.6 Copyright (c) 2018, OracleCorporation. All rights reserved. PREREQ session Oracle Home : /u01/app/oracle/product/12.2.0.1/db_1 Central Inventory : /u01/app/oraInventory from :/u01/app/oracle/product/12.2.0.1/db_1/oraInst.loc OPatch version : 12.2.0.1.6 OUI version : 12.2.0.1.4 Log file location :/u01/app/oracle/product/12.2.0.1/db_1/cfgtoollogs/opatch/opatch2018-04-15_16-13-32PM_1.log Invoking prereq"checkconflictagainstohwithdetail" Prereq"checkConflictAgainstOHWithDetail" passed. OPatch succeeded. 2)、补丁升级 (此次升级有一处报错,详见附1,这里演示无误的正常情况) [oracle@single-instance 27105253]$ $ORACLE_HOME/OPatch/opatch apply Oracle Interim Patch Installer version12.2.0.1.12 Copyright (c) 2018, OracleCorporation. All rights reserved. Oracle Home : /u01/app/oracle/product/12.2.0.1/db_1 Central Inventory : /u01/app/oraInventory from : /u01/app/oracle/product/12.2.0.1/db_1/oraInst.loc OPatch version : 12.2.0.1.12 OUI version : 12.2.0.1.4 Log file location :/u01/app/oracle/product/12.2.0.1/db_1/cfgtoollogs/opatch/opatch2018-04-15_16-48-57PM_1.log Verifying environment and performing prerequisitechecks... OPatch continues with these patches: 27105253 Do you want to proceed? [y|n] y User Responded with: Y All checks passed. Please shutdown Oracle instances runningout of this ORACLE_HOME on the local system. (Oracle Home ='/u01/app/oracle/product/12.2.0.1/db_1') Is the local system ready for patching?[y|n] y User Responded with: Y Backing up files... Applying interim patch '27105253' to OH'/u01/app/oracle/product/12.2.0.1/db_1' ApplySession: Optional component(s) [oracle.has.crs, 12.2.0.1.0 ] , [ oracle.ons.daemon, 12.2.0.1.0 ] , [oracle.network.cman, 12.2.0.1.0 ] notpresent in the Oracle Home or a higher version is found. Patching component oracle.network.rsf,12.2.0.1.0... Patching component oracle.rdbms.deconfig,12.2.0.1.0... Patching component oracle.tfa,12.2.0.1.0... Patching component oracle.rdbms,12.2.0.1.0... Patching component oracle.rdbms.util,12.2.0.1.0... Patching component oracle.rdbms.dbscripts,12.2.0.1.0... Patching component oracle.xdk.parser.java,12.2.0.1.0... Patching component oracle.has.deconfig,12.2.0.1.0... Patching component oracle.xdk.rsf,12.2.0.1.0... Patching component oracle.ctx.rsf,12.2.0.1.0... Patching component oracle.rdbms.rman,12.2.0.1.0... Patching component oracle.rdbms.dv,12.2.0.1.0... Patching component oracle.rdbms.oci,12.2.0.1.0... Patching component oracle.rdbms.crs,12.2.0.1.0... Patching component oracle.precomp.common,12.2.0.1.0... Patching component oracle.oracore.rsf,12.2.0.1.0... Patching component oracle.ctx,12.2.0.1.0... Patching component oracle.xdk,12.2.0.1.0... Patching component oracle.nlsrtl.rsf,12.2.0.1.0... Patching component oracle.rdbms.rsf,12.2.0.1.0... Patching component oracle.ons,12.2.0.1.0... Patching component oracle.rdbms.lbac,12.2.0.1.0... Patching component oracle.precomp.lang,12.2.0.1.0... Patching component oracle.rdbms.rsf.ic,12.2.0.1.0... Patching component oracle.sdo,12.2.0.1.0... Patch 27105253 successfully applied. Log file location:/u01/app/oracle/product/12.2.0.1/db_1/cfgtoollogs/opatch/opatch2018-04-15_16-48-57PM_1.log OPatch succeeded.
5、查看Opatch升级版本
[oracle@single-instance OPatch]$ ./opatch lsinventory Oracle Interim Patch Installer version12.2.0.1.12 Copyright (c) 2018, Oracle Corporation. All rights reserved. Oracle Home : /u01/app/oracle/product/12.2.0.1/db_1 Central Inventory : /u01/app/oraInventory from :/u01/app/oracle/product/12.2.0.1/db_1/oraInst.loc OPatch version : 12.2.0.1.12 OUI version : 12.2.0.1.4 Log file location :/u01/app/oracle/product/12.2.0.1/db_1/cfgtoollogs/opatch/opatch2018-04-15_16-51-06PM_1.log Lsinventory Output file location :/u01/app/oracle/product/12.2.0.1/db_1/cfgtoollogs/opatch/lsinv/lsinventory2018-04-15_16-51-06PM.txt -------------------------------------------------------------------------------- Local Machine Information:: Hostname: single-instance ARU platform id: 226 ARU platform description:: Linux x86-64 Installed Top-level Products (1): Oracle Database 12c 12.2.0.1.0 There are 1 products installed in thisOracle Home. Interim patches (1) : Patch 27105253 : applied on Sun Apr15 16:49:37 CST 2018 Unique Patch ID: 21862470 Patch description: "Database Release Update :12.2.0.1.180116 (27105253)" Created on 9 Jan 2018, 07:49:55 hrs PST8PDT Bugs fixed: 23026585, 24336249, 24929210, 24942749, 25036474, 25110233, 25410877 25417050, 25427662, 25459958, 25547901, 25569149, 25600342, 25600421 25606091, 25655390, 25662088, 24385983, 24923215, 25099758, 25429959 25662101, 25728085, 25823754, 22594071, 23665623, 23749454, 24326846 24334708, 24560906, 24573817, 24578797, 24609996, 24624166, 24668398 24674955, 24744686, 24811725, 24827228, 24831514, 24908321, 24976007 25184555, 25210499, 25211628, 25223839, 25262869, 25316758, 25337332 25455795, 25457409, 25539063, 25546608, 25612095, 25643931, 25410017 22729345, 24485174, 24509056, 24714096, 25329664, 25410180, 25607726 25957038, 25973152, 26024732, 24376878, 24589590, 24676172, 23548817 24796092, 24907917, 25044977, 25736747, 25766822, 25856821, 25051628 24534401, 24835919, 25050160, 25395696, 25430120, 25616359, 25715167 25967985, 26546754, 26546664, 26544823, 26575788, 26271001, 26198926 26025681, 26078437, 25789579, 25034396, 24655717, 25124363, 23527363 25530814, 21981529, 25062592, 25057811, 23179662, 25530080, 25528838 25417056, 25100579, 25739065, 25700654, 25655966, 25631933, 25616645 25616417, 25594901, 25825910, 25789041, 22568728, 21159907, 20736227 19327292, 14690846, 25099497, 24938784, 25257085, 25237577, 25230945 25425760, 25337640, 25263960, 22654475, 21186167, 23491861, 23300142 23234232, 23151677, 22981722, 23733981, 24556967, 24485161, 24457597 24737064, 24578718, 24792678, 20324049, 17533661, 17027695, 22645009 22628825, 23521523, 23499160, 24289874, 24421668, 24332831, 24425998 24555417, 24737403, 25121089, 25192729, 25164293, 25150925, 25579761 25570929, 25980605, 25954022, 25797124, 26308650, 26261327, 26088836 25874050, 25178179, 25176408, 22072543, 23735292, 21985256, 22950945 23746128, 25175723, 25451531, 25575628, 25838361, 25932524, 26479173 26526726, 26609942, 24717183, 26362821, 25397936, 25554787, 26523432 26599395, 26331743, 26476244, 26388538, 25498930, 26421667, 26446098 26108080, 25648731, 25087436, 24812047, 25382812, 25695903, 25797092 22179537, 26111842, 19285025, 25558986, 25551676, 24642495, 25633101 25852885, 25897615, 26486365, 26333141, 26537307, 26444887, 26396790 26358670, 26244115, 25489607, 25947799, 26095405, 26492866, 25248384 26430737, 26187943, 26426526, 22898198, 23581777, 25694206, 26088426 26045732, 24693290, 26153977, 25654936, 25870579, 20003668, 24912588 25638456, 25320555, 25240590, 23599216, 25182817, 24735430, 25872127 25192044, 20620169, 26324769, 24960044, 24677696, 25995938, 23125560 23061453, 25166187, 25722608, 25662524, 25598473, 25774077, 19614243 24664211, 25145215, 25123585, 24968162, 25241625, 25472112, 25463844 25410802, 25383204, 22446455, 23481673, 23055900, 26249718, 25967544 22087683, 23730961, 24376875, 24368004, 25162645, 25029022, 25099339 25093872, 25433696, 25392535, 25357142, 25328518, 25553616, 25970731 25953857, 26169345, 26169341, 26091640, 26032573, 22503297, 24341675 24850622, 25186079, 25602488, 25861398, 25980770, 26096382, 26765212 23035249, 24797119, 25405813, 24443539, 25098160, 25384462, 24593740 25241448, 26751171, 26751106, 26545688, 26367012, 25871639, 25597525 25546580, 25063971, 24654629, 23105538, 24401351, 25764020, 25259611 25244807, 25265499, 26650226, 26330994, 26658759, 26351334, 22347493 25140197, 26659182, 25990907, 25660847, 25411036, 24845157, 25888073 20591151, 25954054, 25822410, 25788879, 25335790, 25199585, 24717859 22564336, 24461826, 24337882, 24010030, 22826067, 26680105, 26626879 26641610, 26189861, 25826740, 25335249, 25335360, 25100063, 21216226 26327624, 25977302, 26597140, 26493289, 26435073, 25895224, 25634317 24617969, 19211433, 25911724, 22599050, 24843188, 24486059, 24922704 18594510, 19649997, 24680959, 25107662, 25964954, 23645516, 26237431 25754606, 23572982, 25045228, 25462714, 25722720, 24848746, 24760407 25203656, 25444961, 21520266, 23600861, 24600330, 24415926, 24423416 17947871, 23066146, 24326444, 24346821, 24623975, 24699619, 24801152 24786669, 24710696, 25065563, 25179774, 25129925, 25417958, 26237773 27087426, 27009164, 26969321, 26366517, 26898563, 26784509, 26522439 23271203, 22364044, 25307368, 26758193, 26542135, 15931756, 26548363 25710420, 26434999, 25207410, 26223039, 25524955, 25579458, 25489367 25313411, 24554533, 20756305, 25478885, 25858672, 26036748, 24966788 24766309, 21178363, 23715460, 23197730, 23602213, 25072986, 25729507 25890056, 25807997, 25206864, 23065002, 24345420, 24303148, 22864303 24435982, 24848923, 24978100, 24953434, 25210268, 25209912, 25981498 25919622, 25871177, 26569225, 26744595, 26908788, 25313154, 27135993 26635897, 26939314, 26983259, 26820076, 25785441, 27142373, 26729494 20532077, 23249829, 27073314, 26629381, 27079140, 26911000, 26944190 25305405, 23741944, 25348956, 25768681, 26794786, 25646373, 24570598 26399626, 25674386, 25225795, 25224242, 25536819, 25296876, 26375250 25963024, 26615690, 26442308, 25476149, 26170715, 25685152, 24307571 19526548, 24468470, 24744383, 25171084, 24713381, 24827654, 24343905 21433452, 24373756, 24923790, 24911709, 26019148, 24940060, 24595699 25691904, 25687460, 25672640, 25874678, 25785331, 22379010, 18521691 8480838, 25159176, 25227381, 25561296, 25440818, 23588722, 24470606 24692973, 24674197, 20118035, 24563422, 24759556, 25201454, 27165231 -------------------------------------------------------------------------------- OPatch succeeded.
6、更新dba_registry_sqlpatch视图信息
1)、登录数据库: [oracle@single-instance OPatch]$ sqlplus /as sysdba SQL*Plus: Release 12.2.0.1.0 Production onSun Apr 15 16:53:29 2018 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to an idle instance. 2)、打开数据库: SQL> startup ORACLE instance started. Total System Global Area 1660944384 bytes Fixed Size 8793448 bytes Variable Size 1040188056 bytes Database Buffers 603979776 bytes Redo Buffers 7983104 bytes Database mounted. Database opened. SQL> alter pluggable database all open; Pluggable database altered. 3)、更新dba_registry_sqlpatch [oracle@single-instance OPatch]$ cd $ORACLE_HOME/OPatch [oracle@single-instance OPatch]$ ./datapatch –verbose SQL Patching tool version 12.2.0.1.0Production on Sun Apr 15 16:54:35 2018 Copyright (c) 2012, 2017, Oracle. All rights reserved. Log file for this invocation:/u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_12619_2018_04_15_16_54_35/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 tocurrent versions...done Determining current state...done Current state of SQL patches: Bundle series DBRU: ID180116 in the binary registry and not installed in any PDB Adding patches to installation queue andperforming prereq checks... Installation queue: Forthe following PDBs: CDB$ROOT PDB$SEED ORCLPDB Nothing to roll back The following patches will be applied: 27105253 (DATABASE RELEASE UPDATE 12.2.0.1.180116) Installing patches... Patch installation complete. Total patches installed: 3 Validating logfiles... Patch 27105253 apply (pdb CDB$ROOT):SUCCESS logfile:/u01/app/oracle/cfgtoollogs/sqlpatch/27105253/21862470/27105253_apply_ORCL_CDBROOT_2018Apr15_16_54_49.log(no errors) Patch 27105253 apply (pdb PDB$SEED):SUCCESS logfile:/u01/app/oracle/cfgtoollogs/sqlpatch/27105253/21862470/27105253_apply_ORCL_PDBSEED_2018Apr15_16_56_05.log(no errors) Patch 27105253 apply (pdb ORCLPDB): SUCCESS logfile:/u01/app/oracle/cfgtoollogs/sqlpatch/27105253/21862470/27105253_apply_ORCL_ORCLPDB_2018Apr15_16_56_05.log(no errors) SQL Patching tool complete on Sun Apr 1516:57:37 2018 查看dba_registry_sqlpatch视图 SQL> select VERSION,STATUS,ACTION_TIME,DESCRIPTION from dba_registry_sqlpatch; VERSION STATUS ACTION_TIME DESCRIPTION ---------- --------------------------------------------------------------------------------------- 12.2.0.1 SUCCESS 15-APR-18 04.57.33.058800PM DATABASE RELEASE UPDATE12.2.0.1.180116
附1:升级出现的问题(OPatch版本过低)
1)、需要12.2.0.1.7版本的OPatch (Patch27105253 requires OPatch version 12.2.0.1.7),具体问题如下: [oracle@single-instance 27105253]$ $ORACLE_HOME/OPatch/opatch apply Oracle Interim Patch Installer version12.2.0.1.6 Copyright (c) 2018, OracleCorporation. All rights reserved. Oracle Home : /u01/app/oracle/product/12.2.0.1/db_1 Central Inventory : /u01/app/oraInventory from :/u01/app/oracle/product/12.2.0.1/db_1/oraInst.loc OPatch version : 12.2.0.1.6 OUI version : 12.2.0.1.4 Log file location :/u01/app/oracle/product/12.2.0.1/db_1/cfgtoollogs/opatch/opatch2018-04-15_16-22-51PM_1.log Verifying environment and performingprerequisite checks... Prerequisite check"CheckMinimumOPatchVersion" failed. The details are: The OPatch being used has version12.2.0.1.6 while the following patch(es) require higher versions: Patch 27105253 requires OPatch version12.2.0.1.7. Please download latest OPatch from MyOracle Support. UtilSession failed: Prerequisite check"CheckMinimumOPatchVersion" failed. Log file location:/u01/app/oracle/product/12.2.0.1/db_1/cfgtoollogs/opatch/opatch2018-04-15_16-22-51PM_1.log OPatch failed with error code 73 2)、更新OPatch 备份现在的OPatch [oracle@single-instance db_1]$ mv OPatch OPatch_bak20180415 更新OPatch [oracle@single-instance db_1]$ pwd /u01/app/oracle/product/12.2.0.1/db_1 [oracle@single-instance db_1]$ ls p6880880* p6880880_122010_Linux-x86-64.zip [oracle@single-instance db_1]$ unzipp6880880_122010_Linux-x86-64.zip
3)、升级OPatch
官网网站:编号6880880,选择相应的平台,下载需要的OPatch版本
到OPatch目录下:
[oracle@oggsource db_1] $ pwd
/u01/app/oracle/product/11.2.0/db_1
备份之前的OPatch目录:
[oracle@oggsource db_1] $ mv OPatch/ /tmp/OPatch_20150922
解压缩下载的最新的OPatch版本:
[oracle@oggsource db_1]$ unzip p6880880_112000_Linux-x86-64.zip
会生成新的OPatch目录,查看一下:
[oracle@oggsource db_1] $ ls OPatch/
crs jlib opatchauto-dir opatchdiag.bat operr oplan version.txt
docs ocm opatch.bat opatch.pl operr.bat README.txt
emdpatch.pl opatch opatchdiag opatchprereqs operr_readme.txt scripts
查看opatch版本,已升级到最新的11.2.0.3.12版本
[oracle@oggsource db_1] $ cd OPatch/
[oracle@oggsource OPatch] $ ./opatchversion
OPatch Version: 11.2.0.3.12
OPatch succeeded.
[oracle@oggsource OPatch]$ ./opatch prereq CheckConflictAgainstOHWithDetail -ph./
Oracle Interim Patch Installer version11.2.0.3.12
Copyright (c) 2015, OracleCorporation. All rights reserved.
PREREQ session
Oracle Home : /u01/app/oracle/product/11.2.0/db_1
Central Inventory : /u01/app/oraInventory
from :/u01/app/oracle/product/11.2.0/db_1/oraInst.loc
OPatch version : 11.2.0.3.12
OUI version : 11.2.0.4.0
Log file location :/u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2015-09-22_22-09-01PM_1.log
Invoking prereq"checkconflictagainstohwithdetail"
Prereq"checkConflictAgainstOHWithDetail" passed.
OPatch succeeded.