【PATCH】Oracle12c升级补丁初体验


环境介绍: rhel7.3 x64   Oracle12.2.0.1


首先,我们看一下当前数据库环境:

点击(此处)折叠或打开

  1. SQL> select NAME, DECODE(CDB, 'YES', 'Multitenant Option enabled', 'Regular 12c Database: ') "Multitenant Option ?" , OPEN_MODE, CON_ID from V$DATABASE;

  2. NAME Multitenant Option ? OPEN_MODE CON_ID
  3. -------------------- -------------------------- -------------------- ----------
  4. FIRSOUL Multitenant Option enabled READ WRITE 0

  5. SQL> col open_time for a40
  6. SQL> select con_id,dbid,name,open_mode,open_time,creation_time from v$pdbs;

  7.     CON_ID DBID NAME OPEN_MODE OPEN_TIME CREATION_TIME
  8. ---------- ---------- -------------------- ---------- ---------------------------------------- -------------------
  9.          2 1858591033 PDB$SEED READ ONLY 13-AUG-17 03.04.04.538 PM +08:00 2017-03-09 21:22:34
  10.          3 839809039 FIRSOULDBPDB MOUNTED 2017-03-09 21:26:54
  11.          4 4175248251 FIRSOUL01 READ WRITE 13-AUG-17 03.04.12.357 PM +08:00 2017-03-14 10:18:37

我们可以使用一下命令去检查一下数据库是否更新过补丁:


点击(此处)折叠或打开

  1. SQL> col action_time format a30
  2. SQL> col namespace for a15
  3. SQL> col comments for a40
  4. SQL> col version for a15
  5. SQL> col action for a10
  6. SQL> select action_time,action,namespace,version,comments from dba_registry_history;

  7. ACTION_TIME ACTION NAMESPACE VERSION COMMENTS
  8. ------------------------------ ---------- --------------- --------------- ----------------------------------------
  9.                                BOOTSTRAP DATAPATCH 12.2.0.1 RDBMS_12.2.0.1.0_LINUX.X64_170125

  10. SQL> select patch_id,patch_uid,version,flags,action,status,action_time,description,bundle_series from dba_registry_sqlpatch;

  11. no rows selected -- 请注意,12c之后多了这个视图,而且12.2.0.1 之后,补丁跟新后,也会更新到该视图中

再次通过opatch命令检查:


点击(此处)折叠或打开

  1. [oracle@test12 OPatch]$ ./opatch lsinventory
  2. Oracle Interim Patch Installer version 12.2.0.1.6
  3. Copyright (c) 2017, Oracle Corporation. All rights reserved.


  4. Oracle Home : /oracle/app/oracle/product/12.2.0/dbhome_1
  5. Central Inventory : /oracle/app/oraInventory
  6.    from : /oracle/app/oracle/product/12.2.0/dbhome_1/oraInst.loc
  7. OPatch version : 12.2.0.1.6   --版本太低,需要下载安装在
  8. OUI version : 12.2.0.1.4
  9. Log file location : /oracle/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/opatch/opatch2017-08-13_15-22-54PM_1.log

  10. Lsinventory Output file location : /oracle/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2017-08-13_15-22-54PM.txt

  11. --------------------------------------------------------------------------------
  12. Local Machine Information::
  13. Hostname: test12
  14. ARU platform id: 226
  15. ARU platform description:: Linux x86-64

  16. Installed Top-level Products (1):

  17. Oracle Database 12c 12.2.0.1.0
  18. There are 1 products installed in this Oracle Home.


  19. There are no Interim patches installed in this Oracle Home.


  20. --------------------------------------------------------------------------------

  21. OPatch succeeded.
  22. [oracle@test12 OPatch]$ ./opatch version
  23. OPatch Version: 12.2.0.1.6

  24. OPatch succeeded.

检查完毕,开始折腾
下载并上传相关补丁包,此处忽略

更新 OPatch目录 ,也就是更新它的版本

点击(此处)折叠或打开

  1. [oracle@test12 soft]$ unzip p6880880_122010_Linux-x86-64.zip -d $ORACLE_HOME$ORACLE_HOME/OPatch/opatch version^C
  2. [oracle@test12 soft]$ $ORACLE_HOME/OPatch/opatch version
  3. OPatch Version: 12.2.0.1.9

  4. OPatch succeeded.
  5. [oracle@test12 soft]$ $ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME
  6. Oracle Interim Patch Installer version 12.2.0.1.9
  7. Copyright (c) 2017, Oracle Corporation. All rights reserved.


  8. Oracle Home : /oracle/app/oracle/product/12.2.0/dbhome_1
  9. Central Inventory : /oracle/app/oraInventory
  10.    from : /oracle/app/oracle/product/12.2.0/dbhome_1/oraInst.loc
  11. OPatch version : 12.2.0.1.9  -- OPatch版本提高了
  12. OUI version : 12.2.0.1.4
  13. Log file location : /oracle/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/opatch/opatch2017-08-13_15-28-01PM_1.log

  14. Lsinventory Output file location : /oracle/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2017-08-13_15-28-01PM.txt

  15. --------------------------------------------------------------------------------
  16. Local Machine Information::
  17. Hostname: test12
  18. ARU platform id: 226
  19. ARU platform description:: Linux x86-64

  20. Installed Top-level Products (1):

  21. Oracle Database 12c 12.2.0.1.0
  22. There are 1 products installed in this Oracle Home.


  23. Installed Products (128):

  24. Assistant Common Files 12.2.0.1.0
  25. BLASLAPACK Component 12.2.0.1.0
  26. Buildtools Common Files 12.2.0.1.0
  27. Cluster Verification Utility Common Files 12.2.0.1.0
  28. Database Configuration and Upgrade Assistants 12.2.0.1.0
  29. Database Migration Assistant for Unicode 12.2.0.1.0
  30. Database SQL Scripts 12.2.0.1.0
  31. Database Workspace Manager 12.2.0.1.0
  32. DB TOOLS Listener 12.2.0.1.0
  33. Deinstallation Tool 12.2.0.1.0
  34. Enterprise Edition Options 12.2.0.1.0
  35. Expat libraries 2.0.1.0.3
  36. Generic Connectivity Common Files 12.2.0.1.0
  37. Hadoopcore Component 12.2.0.1.0
  38. HAS Common Files 12.2.0.1.0
  39. HAS Files for DB 12.2.0.1.0
  40. Installation Common Files 12.2.0.1.0
  41. Installation Plugin Files 12.2.0.1.0
  42. Installer SDK Component 12.2.0.1.4
  43. JAccelerator (COMPANION) 12.2.0.1.0
  44. Java Development Kit 1.8.0.91.0
  45. LDAP Required Support Files 12.2.0.1.0
  46. OLAP SQL Scripts 12.2.0.1.0
  47. Oracle Advanced Analytics 12.2.0.1.0
  48. Oracle Advanced Security 12.2.0.1.0
  49. Oracle Application Express 12.2.0.1.0
  50. Oracle Bali Share 11.1.1.6.0
  51. Oracle Call Interface (OCI) 12.2.0.1.0
  52. Oracle Clusterware RDBMS Files 12.2.0.1.0
  53. Oracle Configuration Manager 12.1.2.0.0
  54. Oracle Configuration Manager Client 10.3.2.1.0
  55. Oracle Configuration Manager Deconfiguration 10.3.1.0.0
  56. Oracle Context Companion 12.2.0.1.0
  57. Oracle Core Required Support Files 12.2.0.1.0
  58. Oracle Core Required Support Files for Core DB 12.2.0.1.0
  59. Oracle Database 12c 12.2.0.1.0
  60. Oracle Database 12c 12.2.0.1.0
  61. Oracle Database 12c Multimedia Files 12.2.0.1.0
  62. Oracle Database Deconfiguration 12.2.0.1.0
  63. Oracle Database Gateway for ODBC 12.2.0.1.0
  64. Oracle Database Utilities 12.2.0.1.0
  65. Oracle Database Vault option 12.2.0.1.0
  66. Oracle DBCA Deconfiguration 12.2.0.1.0
  67. Oracle Extended Windowing Toolkit 11.1.1.6.0
  68. Oracle Globalization Support 12.2.0.1.0
  69. Oracle Globalization Support 12.2.0.1.0
  70. Oracle Globalization Support For Core 12.2.0.1.0
  71. Oracle Help for Java 11.1.1.7.0
  72. Oracle Help Share Library 11.1.1.7.0
  73. Oracle Ice Browser 11.1.1.7.0
  74. Oracle Internet Directory Client 12.2.0.1.0
  75. Oracle Java Client 12.2.0.1.0
  76. Oracle JDBC Server Support Package 12.2.0.1.0
  77. Oracle JDBC/OCI Instant Client 12.2.0.1.0
  78. Oracle JDBC/THIN Interfaces 12.2.0.1.0
  79. Oracle JFC Extended Windowing Toolkit 11.1.1.6.0
  80. Oracle JVM 12.2.0.1.0
  81. Oracle JVM For Core 12.2.0.1.0
  82. Oracle Label Security 12.2.0.1.0
  83. Oracle LDAP administration 12.2.0.1.0
  84. Oracle Locale Builder 12.2.0.1.0
  85. Oracle Message Gateway Common Files 12.2.0.1.0
  86. Oracle Multimedia 12.2.0.1.0
  87. Oracle Multimedia Client Option 12.2.0.1.0
  88. Oracle Multimedia Java Advanced Imaging 12.2.0.1.0
  89. Oracle Multimedia Locator 12.2.0.1.0
  90. Oracle Multimedia Locator Java Required Support Files 12.2.0.1.0
  91. Oracle Multimedia Locator RDBMS Files 12.2.0.1.0
  92. Oracle Net 12.2.0.1.0
  93. Oracle Net Listener 12.2.0.1.0
  94. Oracle Net Required Support Files 12.2.0.1.0
  95. Oracle Net Services 12.2.0.1.0
  96. Oracle Netca Client 12.2.0.1.0
  97. Oracle Notification Service 12.2.0.1.0
  98. Oracle Notification Service for Instant Client 12.2.0.1.0
  99. Oracle ODBC Driver 12.2.0.1.0
  100. Oracle ODBC Driverfor Instant Client 12.2.0.1.0
  101. Oracle OLAP 12.2.0.1.0
  102. Oracle OLAP API 12.2.0.1.0
  103. Oracle OLAP RDBMS Files 12.2.0.1.0
  104. Oracle One-Off Patch Installer 12.2.0.1.6
  105. Oracle Partitioning 12.2.0.1.0
  106. Oracle Programmer 12.2.0.1.0
  107. Oracle R Enterprise Server Files 12.2.0.1.0
  108. Oracle RAC Deconfiguration 12.2.0.1.0
  109. Oracle RAC Required Support Files-HAS 12.2.0.1.0
  110. Oracle Real Application Testing 12.2.0.1.0
  111. Oracle Recovery Manager 12.2.0.1.0
  112. Oracle Scheduler Agent 12.2.0.1.0
  113. Oracle Security Developer Tools 12.2.0.1.0
  114. Oracle Spatial and Graph 12.2.0.1.0
  115. Oracle SQL Developer 12.2.0.1.0
  116. Oracle Starter Database 12.2.0.1.0
  117. Oracle Text 12.2.0.1.0
  118. Oracle Text ATG Language Support Files 12.2.0.1.0
  119. Oracle Text Required Support Files 12.2.0.1.0
  120. Oracle Universal Connection Pool 12.2.0.1.0
  121. Oracle Universal Installer 12.2.0.1.4
  122. Oracle USM Deconfiguration 12.2.0.1.0
  123. Oracle Wallet Manager 12.2.0.1.0
  124. Oracle XML Development Kit 12.2.0.1.0
  125. Oracle XML Query 12.2.0.1.0
  126. oracle.swd.commonlogging 13.3.0.0.0
  127. oracle.swd.opatchautodb 12.2.0.1.5
  128. oracle.swd.oui.core.min 12.2.0.1.4
  129. Parser Generator Required Support Files 12.2.0.1.0
  130. Perl Interpreter 5.22.0.0.0
  131. Perl Modules 5.22.0.0.0
  132. PL/SQL 12.2.0.1.0
  133. PL/SQL Embedded Gateway 12.2.0.1.0
  134. Platform Required Support Files 12.2.0.1.0
  135. Precompiler Common Files 12.2.0.1.0
  136. Precompiler Common Files for Core 12.2.0.1.0
  137. Precompiler Required Support Files 12.2.0.1.0
  138. Precompilers 12.2.0.1.0
  139. RDBMS Required Support Files 12.2.0.1.0
  140. RDBMS Required Support Files for Instant Client 12.2.0.1.0
  141. Required Support Files 12.2.0.1.0
  142. Secure Socket Layer 12.2.0.1.0
  143. SQL*Plus 12.2.0.1.0
  144. SQL*Plus Files for Instant Client 12.2.0.1.0
  145. SQL*Plus Required Support Files 12.2.0.1.0
  146. SQLJ Runtime 12.2.0.1.0
  147. SSL Required Support Files for InstantClient 12.2.0.1.0
  148. Tracle File Analyzer 12.2.0.1.0
  149. XDK Required Support Files 12.2.0.1.0
  150. XML Parser for Java 12.2.0.1.0
  151. XML Parser for Oracle JVM 12.2.0.1.0
  152. There are 128 products installed in this Oracle Home.


  153. There are no Interim patches installed in this Oracle Home.


  154. --------------------------------------------------------------------------------

  155. OPatch succeeded.

产品清单检查,及冲突检查

点击(此处)折叠或打开

  1. $ORACLE_HOME/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME

  2. create a.txt
  3. /home/oracle/soft/26129945/25983138
  4. $ORACLE_HOME/OPatch/opatch prereq CheckSystemSpace -phBaseFile /home/oracle/soft/a.txt

停止数据库及相关服务,开始应用补丁,这里的补丁集 也有GI的,单机环境,所以只选择数据库的即可

点击(此处)折叠或打开

  1. cd /home/oracle/soft/26129945/25983138

  2. $ORACLE_HOME/OPatch/opatch apply
应用完毕后,我们查看一下数据库字典信息,发现什么都没有……

opatch检查显示更新完毕,但对于数据库来说,没用……

点击(此处)折叠或打开

  1. [oracle@test12 25983138]$ $ORACLE_HOME/OPatch/opatch lsinventory
  2. Oracle Interim Patch Installer version 12.2.0.1.9
  3. Copyright (c) 2017, Oracle Corporation. All rights reserved.


  4. Oracle Home : /oracle/app/oracle/product/12.2.0/dbhome_1
  5. Central Inventory : /oracle/app/oraInventory
  6.    from : /oracle/app/oracle/product/12.2.0/dbhome_1/oraInst.loc
  7. OPatch version : 12.2.0.1.9
  8. OUI version : 12.2.0.1.4
  9. Log file location : /oracle/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/opatch/opatch2017-08-13_15-37-24PM_1.log

  10. Lsinventory Output file location : /oracle/app/oracle/product/12.2.0/dbhome_1/cfgtoollogs/opatch/lsinv/lsinventory2017-08-13_15-37-24PM.txt

  11. --------------------------------------------------------------------------------
  12. Local Machine Information::
  13. Hostname: test12
  14. ARU platform id: 226
  15. ARU platform description:: Linux x86-64

  16. Installed Top-level Products (1):

  17. Oracle Database 12c 12.2.0.1.0
  18. There are 1 products installed in this Oracle Home.


  19. Interim patches (1) :

  20. Patch 25983138 : applied on Sun Aug 13 15:35:57 CST 2017
  21. Unique Patch ID: 21358214
  22. Patch description: "DATABASE BUNDLE PATCH: 12.2.0.1.170620 (25983138)"
  23.    Created on 18 Jun 2017, 23:01:52 hrs PST8PDT
  24.    Bugs fixed:
  25.      23026585, 24336249, 24929210, 24942749, 25036474, 25110233, 25410877
  26.      25417050, 25427662, 25459958, 25547901, 25569149, 25600342, 25600421
  27.      25606091, 25655390, 25662088, 24385983, 24923215, 25099758, 25429959
  28.      25662101, 25728085, 25823754, 22594071, 23665623, 23749454, 24326846
  29.      24334708, 24560906, 24573817, 24578797, 24609996, 24624166, 24668398
  30.      24674955, 24744686, 24811725, 24827228, 24831514, 24908321, 24976007
  31.      25184555, 25210499, 25211628, 25223839, 25262869, 25316758, 25337332
  32.      25455795, 25457409, 25539063, 25546608, 25612095, 25643931, 25410017



  33. --------------------------------------------------------------------------------

  34. OPatch succeeded.


其实等于修改后没有将sql文件 更新到数据库中
下面开始更新sql文本


点击(此处)折叠或打开

  1. 首先打开所有pdb,当然你不想也没办法
  2. alter pluggable database all open;

  3. 开始应用sql
  4. [oracle@test12 OPatch]$ ./datapatch -verbose
  5. SQL Patching tool version 12.2.0.1.0 Production on Sun Aug 13 15:41:24 2017
  6. Copyright (c) 2012, 2017, Oracle. All rights reserved.

  7. Log file for this invocation: /oracle/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_6995_2017_08_13_15_41_24/sqlpatch_invocation.log

  8. Connecting to database...OK
  9. Note: Datapatch will only apply or rollback SQL fixes for PDBs
  10.        that are in an open state, no patches will be applied to closed PDBs.
  11.        Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
  12.        (Doc ID 1585822.1)
  13. Bootstrapping registry and package to current versions...done
  14. Determining current state...done

  15. Current state of SQL patches:
  16. Bundle series DBBP:
  17.   ID 170620 in the binary registry and not installed in any PDB

  18. Adding patches to installation queue and performing prereq checks...
  19. Installation queue:
  20.   For the following PDBs: CDB$ROOT PDB$SEED FIRSOULDBPDB FIRSOUL01
  21.     Nothing to roll back
  22.     The following patches will be applied:
  23.       25983138 (DATABASE BUNDLE PATCH 12.2.0.1.170620)

  24. Installing patches...
  25. Patch installation complete. Total patches installed: 4

  26. Validating logfiles...
  27. Patch 25983138 apply (pdb CDB$ROOT): SUCCESS
  28.   logfile: /oracle/app/oracle/cfgtoollogs/sqlpatch/25983138/21358214/25983138_apply_FIRSOUL_CDBROOT_2017Aug13_15_41_45.log (no errors)
  29. Patch 25983138 apply (pdb PDB$SEED): SUCCESS
  30.   logfile: /oracle/app/oracle/cfgtoollogs/sqlpatch/25983138/21358214/25983138_apply_FIRSOUL_PDBSEED_2017Aug13_15_42_16.log (no errors)
  31. Patch 25983138 apply (pdb FIRSOULDBPDB): SUCCESS
  32.   logfile: /oracle/app/oracle/cfgtoollogs/sqlpatch/25983138/21358214/25983138_apply_FIRSOUL_FIRSOULDBPDB_2017Aug13_15_42_16.log (no errors)
  33. Patch 25983138 apply (pdb FIRSOUL01): SUCCESS
  34.   logfile: /oracle/app/oracle/cfgtoollogs/sqlpatch/25983138/21358214/25983138_apply_FIRSOUL_FIRSOUL01_2017Aug13_15_42_16.log (no errors)
  35. SQL Patching tool complete on Sun Aug 13 15:48:33 2017

下次查看数据库字典

点击(此处)折叠或打开

  1. SQL> col action_time format a30
  2. SQL> col namespace for a15
  3. SQL> col comments for a40
  4. SQL> col version for a15
  5. SQL> col action for a10
  6. SQL> select action_time,action,namespace,version,comments from dba_registry_history;


  7. ACTION_TIME ACTION NAMESPACE VERSION COMMENTS
  8. ------------------------------ ---------- --------------- --------------- ----------------------------------------
  9.                                BOOTSTRAP DATAPATCH 12.2.0.1 RDBMS_12.2.0.1.0_LINUX.X64_170125

  10. 依然不显示…… 什么情况

哦,对了,Oracle12c还有一个视图……  补丁已更新: DATABASE BUNDLE PATCH 12 . 2 . 0 . 1 . 170620

点击(此处)折叠或打开

  1. SQL>
  2. SQL> col status for a8
  3. SQL> col description for a40
  4. SQL> col version for a10
  5. SQL> select patch_id,patch_uid,version,action,status,action_time,description from dba_registry_sqlpatch;

  6.   PATCH_ID PATCH_UID VERSION ACTION STATUS ACTION_TIME DESCRIPTION
  7. ---------- ---------- ---------- ---------- -------- ------------------------------ ----------------------------------------
  8.   25983138 21358214 12.2.0.1 APPLY SUCCESS 13-AUG-17 03.48.32.294218 PM DATABASE BUNDLE PATCH 12.2.0.1.170620

  9. 1 row selected.

不错,不错,收尾工作
如果 OJVM PSU,OJVM PSU 也安装
需要执行下面脚本

点击(此处)折叠或打开

  1. cd $ORACLE_HOME/rdbms/admin
  2. sqlplus /nolog
  3. SQL> CONNECT / AS SYSDBA
  4. SQL> @utlrp.sql

  5. SQL > @dbmsjdev.sql
  6. SQL > exec dbms_java_dev.disable

后记:一定要看readme文件  ,关于集群的 后续找时间测试,当然,首先需要测试安装Oracle12c RAC…… 






来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/29487349/viewspace-2143457/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/29487349/viewspace-2143457/

你可能感兴趣的:(【PATCH】Oracle12c升级补丁初体验)