Oracle 11g RAC 环境打PSU补丁(11.2.0.4-11.2.0.4.17)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/leo__1990/article/details/90437214

环境 :Oracle 11g RAC 11.2.0.4 

 

opatch p6880880_112000_Linux-x86-64.zip

GI 补丁 p25476126_112040_Linux-x86-64.zip

数据库补丁 p24732075_112040_Linux-x86-64.zip

一.升级opatch:

mv OPatch OPatch.bak
unzip p6880880_112000_Linux-x86-64.zip -d /u01/app/11.2.0/grid
chown -R grid:oinstall OPatch

二 GI 打补丁

1 更新opatch的版本(每个节点都执行)

[root@rac1 grid]# mv OPatch OPatch.bak
[root@rac1 /]# unzip p6880880_112000_Linux-x86-64.zip -d /u01/app/11.2.0/grid
[root@rac2 /]# chown -R grid:oinstall /u01/app/11.2.0/grid/OPatch

2 检查opatch的版本

[grid@rac1 OPatch]$ /u01/app/11.2.0/grid/OPatch/opatch version
OPatch Version: 11.2.0.3.16

OPatch succeeded.

3 检查 Inventory有效性:

[grid@rac1 OPatch]$ /u01/app/11.2.0/grid/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME
Oracle Interim Patch Installer version 11.2.0.3.16
Copyright (c) 2017, Oracle Corporation.  All rights reserved.


Oracle Home       : /u01/app/11.2.0/grid
Central Inventory : /u01/app/oraInventory
   from           : /u01/app/11.2.0/grid/oraInst.loc
OPatch version    : 11.2.0.3.16
OUI version       : 11.2.0.4.0
Log file location : /u01/app/11.2.0/grid/cfgtoollogs/opatch/opatch2017-06-08_04-24-59AM_1.log

Lsinventory Output file location : /u01/app/11.2.0/grid/cfgtoollogs/opatch/lsinv/lsinventory2017-06-08_04-24-59AM.txt

--------------------------------------------------------------------------------
Local Machine Information::
Hostname: rac1
ARU platform id: 226

ARU platform description:: Linux x86-64

Installed Top-level Products (1): 

Oracle Grid Infrastructure 11g                                       11.2.0.4.0
There are 1 products installed in this Oracle Home.


Installed Products (89): 

Agent Required Support Files                                         10.2.0.4.5
Assistant Common Files                                               11.2.0.4.0
Automatic Storage Management Assistant                               11.2.0.4.0
Bali Share                                                           1.1.18.0.0
Buildtools Common Files                                              11.2.0.4.0
Character Set Migration Utility                                      11.2.0.4.0
Cluster Ready Services Files                                         11.2.0.4.0
Cluster Verification Utility Common Files                            11.2.0.4.0
Cluster Verification Utility Files                                   11.2.0.4.0
Database SQL Scripts                                                 11.2.0.4.0
Deinstallation Tool                                                  11.2.0.4.0
Enterprise Manager Common Core Files                                 10.2.0.4.5
Enterprise Manager Common Files                                      10.2.0.4.5
Enterprise Manager plugin Common Files                               11.2.0.4.0
Expat libraries                                                       2.0.1.0.1
HAS Common Files                                                     11.2.0.4.0
HAS Files for DB                                                     11.2.0.4.0
Installation Common Files                                            11.2.0.4.0
Installation Plugin Files                                            11.2.0.4.0
Installer SDK Component                                              11.2.0.4.0
Java Development Kit                                                1.5.0.51.10
LDAP Required Support Files                                          11.2.0.4.0
OLAP SQL Scripts                                                     11.2.0.4.0
Oracle Advanced Security                                             11.2.0.4.0
Oracle Clusterware RDBMS Files                                       11.2.0.4.0
Oracle Configuration Manager Deconfiguration                         10.3.1.0.0
Oracle Containers for Java                                           11.2.0.4.0
Oracle Core Required Support Files                                   11.2.0.4.0
Oracle Database 11g                                                  11.2.0.4.0
Oracle Database 11g Multimedia Files                                 11.2.0.4.0
Oracle Database Deconfiguration                                      11.2.0.4.0
Oracle Database User Interface                                       2.2.13.0.0
Oracle Database Utilities                                            11.2.0.4.0
Oracle DBCA Deconfiguration                                          11.2.0.4.0
Oracle Extended Windowing Toolkit                                    3.4.47.0.0
Oracle Globalization Support                                         11.2.0.4.0
Oracle Globalization Support                                         11.2.0.4.0
Oracle Grid Infrastructure 11g                                       11.2.0.4.0
Oracle Help For Java                                                  4.2.9.0.0
Oracle Ice Browser                                                    5.2.3.6.0
Oracle Internet Directory Client                                     11.2.0.4.0
Oracle Java Client                                                   11.2.0.4.0
Oracle JDBC/OCI Instant Client                                       11.2.0.4.0
Oracle JDBC/THIN Interfaces                                          11.2.0.4.0
Oracle JFC Extended Windowing Toolkit                                4.2.36.0.0
Oracle JVM                                                           11.2.0.4.0
Oracle LDAP administration                                           11.2.0.4.0
Oracle Locale Builder                                                11.2.0.4.0
Oracle Multimedia                                                    11.2.0.4.0
Oracle Multimedia Client Option                                      11.2.0.4.0
Oracle Multimedia Java Advanced Imaging                              11.2.0.4.0
Oracle Multimedia Locator                                            11.2.0.4.0
Oracle Multimedia Locator RDBMS Files                                11.2.0.4.0
Oracle Net                                                           11.2.0.4.0
Oracle Net Listener                                                  11.2.0.4.0
Oracle Net Required Support Files                                    11.2.0.4.0
Oracle Netca Client                                                  11.2.0.4.0
Oracle Notification Service                                          11.2.0.3.0
Oracle Notification Service (eONS)                                   11.2.0.4.0
Oracle One-Off Patch Installer                                       11.2.0.3.4
Oracle Quality of Service Management (Client)                        11.2.0.4.0
Oracle Quality of Service Management (Server)                        11.2.0.4.0
Oracle RAC Deconfiguration                                           11.2.0.4.0
Oracle RAC Required Support Files-HAS                                11.2.0.4.0
Oracle Recovery Manager                                              11.2.0.4.0
Oracle Security Developer Tools                                      11.2.0.4.0
Oracle Text Required Support Files                                   11.2.0.4.0
Oracle Universal Installer                                           11.2.0.4.0
Oracle USM Deconfiguration                                           11.2.0.4.0
Oracle Wallet Manager                                                11.2.0.4.0
Parser Generator Required Support Files                              11.2.0.4.0
Perl Interpreter                                                     5.10.0.0.2
Perl Modules                                                         5.10.0.0.1
PL/SQL                                                               11.2.0.4.0
PL/SQL Embedded Gateway                                              11.2.0.4.0
Platform Required Support Files                                      11.2.0.4.0
Precompiler Required Support Files                                   11.2.0.4.0
RDBMS Required Support Files                                         11.2.0.4.0
RDBMS Required Support Files for Instant Client                      11.2.0.4.0
RDBMS Required Support Files Runtime                                 11.2.0.4.0
Required Support Files                                               11.2.0.4.0
Secure Socket Layer                                                  11.2.0.4.0
SQL*Plus                                                             11.2.0.4.0
SQL*Plus Files for Instant Client                                    11.2.0.4.0
SQL*Plus Required Support Files                                      11.2.0.4.0
SSL Required Support Files for InstantClient                         11.2.0.4.0
Universal Storage Manager Files                                      11.2.0.4.0
XDK Required Support Files                                           11.2.0.4.0
XML Parser for Java                                                  11.2.0.4.0
There are 89 products installed in this Oracle Home.


There are no Interim patches installed in this Oracle Home.


--------------------------------------------------------------------------------

OPatch succeeded.

4 配置OCM 

用root用户在/u01/app/11.2.0/grid/OPatch/ocm/bin/下,用emocmrsp生成ocm.rsp文件(该文件会生成在当前目录)

[root@rac1 /]#cd /u01/app/11.2.0/grid/OPatch/ocm/bin 
[root@rac1 bin]#./emocmrsp 

将生成的ocm.rsp放到/u01/app/11.2.0/grid/OPatch/ocm/bin/目录下

5 停止OEM

 
$ <ORACLE_HOME>/bin/emctl stop dbconsole

6 解压patch文件,给成grid的权限 

unzip p25476126_112040_Linux-x86-64.zip
chown -R grid:oinstall /25476126

7 Patching GI  用root用户执行如下

Case 1: GI Home and the Database Homes that are not shared and ACFS file system is not configured.
As root user, execute the following command on each node of the cluster:
--官方文档有说明GI HOME, ORCLE HOME 不在共享目录,ACFS 文件系统没有配置话,在每个节点执行
# opatch auto <UNZIPPED_PATCH_LOCATION>/25476126 -ocmrf <ocm response file>

Case 2: GI Home is not shared, Database Home is shared, ACFS may be used.
--官方文档有说明GI HOME 不在共享目录, ORCLE HOME 在共享目录,ACFS 文件系统配置话,在每个节点按照下面的步骤执行

Patching instructions:
    1 From the Oracle database home, make sure to stop the Oracle RAC databases running on all nodes. As the database home owner execute:
       $ <ORACLE_HOME>/bin/srvctl stop database –d <db-unique-name>
    2 On the 1st node, unmount the ACFS file systems. See My Oracle Support Document 1494652.1 for unmounting ACFS file systems.
    3 On the 1st node, apply the patch to the GI Home using the opatch auto command. As root user, execute the following command:
       # opatch auto <UNZIPPED_PATCH_LOCATION>/25476126 -ocmrf <ocm response file>
    4 If the message, "A system reboot is recommended before using ACFS” is shown, then a reboot must be issued before continuing. Failure to do so will result in running with an unpatched ACFS/ADVM/OKS driver.
    5 On the 1st node, remount ACFS file systems. See My Oracle Support Document 1494652.1 for mounting ACFS file systems.
    6 On the 1st node, apply the patch to the Database home using the opatch auto command. Since the Database home is shared, this operation will patch the Database home across the cluster. Note that a USM only patch cannot be applied to a database home. As root user, execute the following command:
       # opatch auto <UNZIPPED_PATCH_LOCATION>/25476126 -oh <DATABASE_HOME> -ocmrf <ocm response file>
    7 On the 1st node only, restart the Oracle instance, which you have previously stopped in Step 1. As the database home owner execute:
       $ <ORACLE_HOME>/bin/srvctl start instance –d <db-unique-name> -n <nodename>
    8 On the 2nd (next) node, unmount the ACFS file systems. See My Oracle Support Document 1494652.1 for unmounting ACFS file systems.
    9 On the 2nd node, apply the patch to GI Home using the opatch auto command. As root user, execute the following command:
       # opatch auto <UNZIPPED_PATCH_LOCATION>/25476126 -oh <GI_HOME> -ocmrf <ocm response file>
    10 If the message, "A system reboot is recommended before using ACFS” is shown, then a reboot must be issued before continuing. Failure to do so will result in running with an unpatched ACFS/ADVM/OKS driver.
    11 On the 2nd node, running the opatch auto command in Step 9 will restart the stack.
    12 On the 2nd node, remount ACFS file systems. See My Oracle Support Document 1494652.1 for mounting ACFS file systems.
    13 On the 2nd node only, restart the Oracle instance, which you have previously stopped in Step 1. As the database home owner execute:
       $ <ORACLE_HOME>/bin/srvctl start instance –d <db-unique-name> -n <nodename>
    14 Repeat Steps 8 through 13 for all remaining nodes of the cluster.


[root@rac1 bin]# /u01/app/11.2.0/grid/OPatch/opatch auto /25476126 -ocmrf /u01/app/11.2.0/grid/OPatch/ocm/bin/ocm.rsp
Executing /u01/app/11.2.0/grid/perl/bin/perl /u01/app/11.2.0/grid/OPatch/crs/patch11203.pl -patchdir / -patchn 25476126 -ocmrf /u01/app/11.2.0/grid/OPatch/ocm/bin/ocm.rsp -paramfile /u01/app/11.2.0/grid/crs/install/crsconfig_params

This is the main log file: /u01/app/11.2.0/grid/cfgtoollogs/opatchauto2017-06-08_04-52-40.log

This file will show your detected configuration and all the steps that opatchauto attempted to do on your system:
/u01/app/11.2.0/grid/cfgtoollogs/opatchauto2017-06-08_04-52-40.report.log

2017-06-08 04:52:40: Starting Clusterware Patch Setup
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params
The opatch minimum version  check for patch //25476126/24732075 failed  for /u01/app/oracle/product/11.2.0/db_1
The opatch minimum version  check for patch //25476126/23054319/custom/server/23054319 failed  for /u01/app/oracle/product/11.2.0/db_1
Opatch version check failed for oracle home  /u01/app/oracle/product/11.2.0/db_1
Opatch version  check failed
ERROR: update the opatch version for the failed homes and retry

opatch auto failed.

--我的环境符合第一种情况 结果执行报错,后来命令加上 -oh /u01/app/11.2.0/grid 执行成功

[root@rac1 bin]# /u01/app/11.2.0/grid/OPatch/opatch auto /25476126 -oh /u01/app/11.2.0/grid -ocmrf /u01/app/11.2.0/grid/OPatch/ocm/bin/ocm.rsp
Executing /u01/app/11.2.0/grid/perl/bin/perl /u01/app/11.2.0/grid/OPatch/crs/patch11203.pl -patchdir / -patchn 25476126 -oh /u01/app/11.2.0/grid -ocmrf /u01/app/11.2.0/grid/OPatch/ocm/bin/ocm.rsp -paramfile /u01/app/11.2.0/grid/crs/install/crsconfig_params

This is the main log file: /u01/app/11.2.0/grid/cfgtoollogs/opatchauto2017-06-08_04-53-26.log

This file will show your detected configuration and all the steps that opatchauto attempted to do on your system:
/u01/app/11.2.0/grid/cfgtoollogs/opatchauto2017-06-08_04-53-26.report.log

2017-06-08 04:53:26: Starting Clusterware Patch Setup
Using configuration parameter file: /u01/app/11.2.0/grid/crs/install/crsconfig_params

Stopping CRS...
Stopped CRS successfully

patch //25476126/24732075  apply successful for home  /u01/app/11.2.0/grid 
patch //25476126/23054319  apply successful for home  /u01/app/11.2.0/grid 
patch //25476126/22502505  apply successful for home  /u01/app/11.2.0/grid 
出现// 是因为我把补丁包放在根目录下了,在/目录下创建个文件夹software就不会出这样问题例如/software/25476126/24732075
Starting CRS...
Installing Trace File Analyzer
CRS-4123: Oracle High Availability Services has been started.

opatch auto succeeded.
以上步骤也要在另一个节点执行

--脚本执行只需要在一个节点执行即可(最好节点1执行)

8 执行catbundle.sql 脚本

[oracle@rac1 ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.4.0 Production on Thu Jun 8 05:40:48 2017

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, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL>

SQL> @?/rdbms/admin/catbundle.sql psu apply

PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.


PL/SQL procedure successfully completed.


Generating apply and rollback scripts...
Check the following file for errors:
/u01/app/oracle/cfgtoollogs/catbundle/catbundle_PSU_LEO_GENERATE_2017Jun08_05_43_01.log
Apply script: /u01/app/oracle/product/11.2.0/db_1/rdbms/admin/catbundle_PSU_LEO_APPLY.sql
Rollback script: /u01/app/oracle/product/11.2.0/db_1/rdbms/admin/catbundle_PSU_LEO_ROLLBACK.sql

PL/SQL procedure successfully completed.

Executing script file...

SQL> COLUMN spool_file NEW_VALUE spool_file NOPRINT
SQL> SELECT '/u01/app/oracle/cfgtoollogs/catbundle/' || 'catbundle_PSU_' || name || '_APPLY_' || TO_CHAR(SYSDATE, 'YYYYMonDD_hh24_mi_ss', 'NLS_DATE_LANGUAGE=''AMERICAN''') || '.log' AS spool_file FROM v$database;

SQL> SPOOL &spool_file
SQL> exec dbms_registry.set_session_namespace('SERVER')

PL/SQL procedure successfully completed.

SQL> ALTER SESSION SET current_schema = SYS;

Session altered.

SQL> PROMPT Updating registry...
Updating registry...
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     0,
 10     'PSU',
 11     'Patchset 11.2.0.2.0');

1 row created.

SQL> COMMIT;

Commit complete.

SQL> SPOOL off
SQL> SET echo off
Check the following log file for errors:
/u01/app/oracle/cfgtoollogs/catbundle/catbundle_PSU_LEO_APPLY_2017Jun08_05_43_11.log

9 执行utlrp.sql 脚本 

SQL> @?/rdbms/admin/utlrp.sql

TIMESTAMP
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_BGN  2017-06-08 05:47:20

DOC>   The following PL/SQL block invokes UTL_RECOMP to recompile invalid
DOC>   objects in the database. Recompilation time is proportional to the
DOC>   number of invalid objects in the database, so this command may take
DOC>   a long time to execute on a database with a large number of invalid
DOC>   objects.
DOC>
DOC>   Use the following queries to track recompilation progress:
DOC>
DOC>   1. Query returning the number of invalid objects remaining. This
DOC>      number should decrease with time.
DOC>         SELECT COUNT(*) FROM obj$ WHERE status IN (4, 5, 6);
DOC>
DOC>   2. Query returning the number of objects compiled so far. This number
DOC>      should increase with time.
DOC>         SELECT COUNT(*) FROM UTL_RECOMP_COMPILED;
DOC>
DOC>   This script automatically chooses serial or parallel recompilation
DOC>   based on the number of CPUs available (parameter cpu_count) multiplied
DOC>   by the number of threads per CPU (parameter parallel_threads_per_cpu).
DOC>   On RAC, this number is added across all RAC nodes.
DOC>
DOC>   UTL_RECOMP uses DBMS_SCHEDULER to create jobs for parallel
DOC>   recompilation. Jobs are created without instance affinity so that they
DOC>   can migrate across RAC nodes. Use the following queries to verify
DOC>   whether UTL_RECOMP jobs are being created and run correctly:
DOC>
DOC>   1. Query showing jobs created by UTL_RECOMP
DOC>         SELECT job_name FROM dba_scheduler_jobs
DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>
DOC>   2. Query showing UTL_RECOMP jobs that are running
DOC>         SELECT job_name FROM dba_scheduler_running_jobs
DOC>            WHERE job_name like 'UTL_RECOMP_SLAVE_%';
DOC>#

PL/SQL procedure successfully completed.


TIMESTAMP
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
COMP_TIMESTAMP UTLRP_END  2017-06-08 05:47:28

DOC> The following query reports the number of objects that have compiled
DOC> with errors.
DOC>
DOC> If the number is higher than expected, please examine the error
DOC> messages reported with each object (using SHOW ERRORS) to see if they
DOC> point to system misconfiguration or resource constraints that must be
DOC> fixed before attempting to recompile these objects.
DOC>#

OBJECTS WITH ERRORS
-------------------
                  0

DOC> The following query reports the number of errors caught during
DOC> recompilation. If this number is non-zero, please query the error
DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors
DOC> are due to misconfiguration or resource constraints that must be
DOC> fixed before objects can compile successfully.
DOC>#

ERRORS DURING RECOMPILATION
---------------------------
                          0


Function created.


PL/SQL procedure successfully completed.


Function dropped.


PL/SQL procedure successfully completed.

10 执行 @dbmsjdev.sql 脚本 

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

11 升级Oracle恢复管理器目录

如果您正在使用Oracle恢复管理器,则需要对目录进行升级。输入以下命令来升级它:

$ rman catalog username/password@alias
RMAN> UPGRADE CATALOG;

12 检查GI的打补丁情况  

[grid@rac1 OPatch]$ /u01/app/11.2.0/grid/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME |grep -i patch
Oracle Interim Patch Installer version 11.2.0.3.16
OPatch version    : 11.2.0.3.16
Log file location : /u01/app/11.2.0/grid/cfgtoollogs/opatch/opatch2017-06-08_06-01-18AM_1.log
Lsinventory Output file location : /u01/app/11.2.0/grid/cfgtoollogs/opatch/lsinv/lsinventory2017-06-08_06-01-18AM.txt
Oracle One-Off Patch Installer                                       11.2.0.3.4
Interim patches (3) :
Patch  22502505     : applied on Thu Jun 08 05:05:25 CST 2017
Unique Patch ID:  19880366
Patch description:  "ACFS Patch Set Update : 11.2.0.4.160419 (22502505)"
   Patch Location in Inventory:
   Patch Location in Storage area:
     /u01/app/11.2.0/grid/.patch_storage/22502505_Feb_17_2016_00_12_23
Patch  23054319     : applied on Thu Jun 08 05:01:51 CST 2017
Unique Patch ID:  20209287
Patch description:  "OCW Patch Set Update : 11.2.0.4.160719 (23054319)"
     crspatch.pm --> ORACLE_HOME/crs/install/crspatch.pm
   Patch Location in Inventory:
   Patch Location in Storage area:
     /u01/app/11.2.0/grid/.patch_storage/23054319_Jul_15_2016_14_38_17
Patch  24732075     : applied on Thu Jun 08 04:59:17 CST 2017
Unique Patch ID:  21176096
Patch description:  "Database Patch Set Update : 11.2.0.4.170418 (24732075)"
Sub-patch  24006111; "Database Patch Set Update : 11.2.0.4.161018 (24006111)"
Sub-patch  23054359; "Database Patch Set Update : 11.2.0.4.160719 (23054359)"
Sub-patch  22502456; "Database Patch Set Update : 11.2.0.4.160419 (22502456)"
Sub-patch  21948347; "Database Patch Set Update : 11.2.0.4.160119 (21948347)"
Sub-patch  21352635; "Database Patch Set Update : 11.2.0.4.8 (21352635)"
Sub-patch  20760982; "Database Patch Set Update : 11.2.0.4.7 (20760982)"
Sub-patch  20299013; "Database Patch Set Update : 11.2.0.4.6 (20299013)"
Sub-patch  19769489; "Database Patch Set Update : 11.2.0.4.5 (19769489)"
Sub-patch  19121551; "Database Patch Set Update : 11.2.0.4.4 (19121551)"
Sub-patch  18522509; "Database Patch Set Update : 11.2.0.4.3 (18522509)"
Sub-patch  18031668; "Database Patch Set Update : 11.2.0.4.2 (18031668)"
Sub-patch  17478514; "Database Patch Set Update : 11.2.0.4.1 (17478514)"
     bug16595641.sql --> ORACLE_HOME/patch/scripts/bug16595641.sql
     bug17088068.sql --> ORACLE_HOME/patch/scripts/bug17088068.sql
     bug17381384.sql --> ORACLE_HOME/patch/scripts/bug17381384.sql
     bug19289642.sql --> ORACLE_HOME/patch/scripts/bug19289642.sql
     bug22380919.sql --> ORACLE_HOME/patch/scripts/bug22380919.sql
     ins_rdbms.mk --> ORACLE_HOME/rdbms/lib/patchset_opt_all jox_refresh_knlopt ioracle
     sdopatch.sql --> ORACLE_HOME/md/admin/sdopatch.sql
   Patch Location in Inventory:
   Patch Location in Storage area:
     /u01/app/11.2.0/grid/.patch_storage/24732075_Feb_22_2017_21_40_49
OPatch succeeded.

三 升级 DB PSU  

1 更新opatch的版本(每个节点都执行)

[root@rac1 /]# cd /u01/app/oracle/product/11.2.0/db_1/
[root@rac1 db_1]# mv OPatch OPatch.bak
[root@rac1 db_1]# cd /
[root@rac1 /]# unzip p6880880_112000_Linux-x86-64.zip -d /u01/app/oracle/product/11.2.0/db_1
[root@rac1 /]# chown -R oracle:oinstall /u01/app/oracle/product/11.2.0/db_1/OPatch

2 检查opatch 版本 (每个节点都执行) 

root@rac1 db_1]# /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch version

OPatch Version: 11.2.0.3.16

OPatch succeeded.

3 确定当前安装的一次性补丁是否与PSU补丁冲突(每个节点都执行): 

unzip p24732075_112040_<platform>.zip
chown -R oracle:oinstall 24732075
cd 24732075
opatch prereq CheckConflictAgainstOHWithDetail -ph ./

[oracle@rac2 24732075]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
Oracle Interim Patch Installer version 11.2.0.3.16
Copyright (c) 2017, Oracle Corporation.  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.16
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2017-06-08_16-17-45PM_1.log

Invoking prereq "checkconflictagainstohwithdetail"

Prereq "checkConflictAgainstOHWithDetail" passed.

OPatch succeeded.

4 安装 Patch 

--官方文档说明

Patch Installation Instructions
Conflicting patches should be rolled back before applying the patch, otherwise opatch apply will report conflicts again.
Follow these steps:
     1 If you are using a Data Guard Physical Standby database, you must install this patch on both the primary database and the physical standby database, as described by My Oracle Support Document 278641.1.
     2 If this is an Oracle RAC environment, install the PSU patch using the OPatch rolling (no downtime) installation method as the PSU patch is rolling Oracle RAC installable. Refer to My Oracle Support Document 244241.1 Rolling Patch - OPatch Support for RAC.
     3 If this is not a Oracle RAC environment, shut down all instances and listeners associated with the Oracle home that you are updating. For more information, see Oracle Database Administrator's Guide.
     4 Rollback any patches found during the One-off Patch Conflict Detection.
     5 Set your current directory to the directory where the patch is located and then run the OPatch utility by entering the following commands:
         unzip p24732075_112040_<platform>.zip
         cd 24732075
         opatch apply
     6 Install all resolutions to conflicts found during the One-off Patch Conflict Detection.
     7 If there are errors, refer to Section 5, "Known Issues".
	 
根据官方文档说明 RAC 环境 按照下面步骤使用rolling Patch 执行
具体可参考 http://blog.csdn.net/tianlesoftware/article/details/9171251
         unzip p24732075_112040_<platform>.zip
         cd 24732075
         opatch apply

--查看实例状态
[oracle@rac1 ~]$ srvctl status database -d leo
Instance leo1 is running on node rac1
Instance leo2 is running on node rac2
--停止节点1 上的实例
[oracle@rac1 ~]$ srvctl stop instance -d leo -i leo1
[oracle@rac1 ~]$ srvctl status intance -d leo -i leo1
Instance leo1 is not running on node rac1

--用oracle 用户安装Patch

[root@rac1 /] unzip  p24732075_112040_Linux-x86-64.zip
[root@rac1 /]# chown -R oracle:oinstall /24732075/
[root@rac1 /]# cd /24732075/
[oracle@rac2 24732075]$  /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch apply

Oracle Interim Patch Installer version 11.2.0.3.16
Copyright (c) 2017, Oracle Corporation.  All rights reserved.


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.16
OUI version       : 11.2.0.4.0
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2017-06-08_08-23-32AM_1.log

Verifying environment and performing prerequisite checks...
OPatch continues with these patches:   17478514  18031668  18522509  19121551  19769489  20299013  20760982  21352635  21948347  22502456  23054359  24006111  24732075  

Do you want to proceed? [y|n]
y
User Responded with: Y
All checks passed.
Provide your email address to be informed of security issues, install and
initiate Oracle Configuration Manager. Easier for you if you use your My
Oracle Support Email address/User Name.
Visit http://www.oracle.com/support/policies.html for details.
Email address/User Name: 

You have not provided an email address for notification of security issues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o) [N]:  Y



Please shutdown Oracle instances running out of this ORACLE_HOME on the local system.
(Oracle Home = '/u01/app/oracle/product/11.2.0/db_1')


Is the local system ready for patching? [y|n]
Y
User Responded with: Y
Backing up files...
Applying sub-patch '17478514' to OH '/u01/app/oracle/product/11.2.0/db_1'

Patching component oracle.rdbms, 11.2.0.4.0...

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

Patching component oracle.sdo, 11.2.0.4.0...

Patching component oracle.sysman.agent, 10.2.0.4.5...

Patching component oracle.xdk, 11.2.0.4.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...

Patching component oracle.sdo.locator, 11.2.0.4.0...

Patching component oracle.nlsrtl.rsf, 11.2.0.4.0...

Patching component oracle.xdk.rsf, 11.2.0.4.0...

Patching component oracle.rdbms.rman, 11.2.0.4.0...
Applying sub-patch '18031668' to OH '/u01/app/oracle/product/11.2.0/db_1'

Patching component oracle.rdbms, 11.2.0.4.0...

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

Patching component oracle.ldap.rsf, 11.2.0.4.0...

Patching component oracle.rdbms.crs, 11.2.0.4.0...

Patching component oracle.precomp.common, 11.2.0.4.0...

Patching component oracle.ldap.rsf.ic, 11.2.0.4.0...

Patching component oracle.rdbms.deconfig, 11.2.0.4.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...

Patching component oracle.rdbms.rman, 11.2.0.4.0...
Applying sub-patch '18522509' to OH '/u01/app/oracle/product/11.2.0/db_1'

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

Patching component oracle.rdbms, 11.2.0.4.0...

Patching component oracle.precomp.common, 11.2.0.4.0...

Patching component oracle.rdbms.rman, 11.2.0.4.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...

Patching component oracle.rdbms.deconfig, 11.2.0.4.0...
Applying sub-patch '19121551' to OH '/u01/app/oracle/product/11.2.0/db_1'

Patching component oracle.precomp.common, 11.2.0.4.0...

Patching component oracle.sysman.console.db, 11.2.0.4.0...

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

Patching component oracle.rdbms.rman, 11.2.0.4.0...

Patching component oracle.rdbms, 11.2.0.4.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...

Patching component oracle.ordim.client, 11.2.0.4.0...

Patching component oracle.ordim.jai, 11.2.0.4.0...
Applying sub-patch '19769489' to OH '/u01/app/oracle/product/11.2.0/db_1'
ApplySession: Optional component(s) [ oracle.sysman.agent, 11.2.0.4.0 ]  not present in the Oracle Home or a higher version is found.

Patching component oracle.precomp.common, 11.2.0.4.0...

Patching component oracle.ovm, 11.2.0.4.0...

Patching component oracle.xdk, 11.2.0.4.0...

Patching component oracle.rdbms.util, 11.2.0.4.0...

Patching component oracle.rdbms, 11.2.0.4.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...

Patching component oracle.xdk.parser.java, 11.2.0.4.0...

Patching component oracle.oraolap, 11.2.0.4.0...

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

Patching component oracle.xdk.rsf, 11.2.0.4.0...

Patching component oracle.rdbms.rman, 11.2.0.4.0...

Patching component oracle.rdbms.deconfig, 11.2.0.4.0...
Applying sub-patch '20299013' to OH '/u01/app/oracle/product/11.2.0/db_1'

Patching component oracle.rdbms.dv, 11.2.0.4.0...

Patching component oracle.rdbms.oci, 11.2.0.4.0...

Patching component oracle.precomp.common, 11.2.0.4.0...

Patching component oracle.sysman.agent, 10.2.0.4.5...

Patching component oracle.xdk, 11.2.0.4.0...

Patching component oracle.sysman.common, 10.2.0.4.5...

Patching component oracle.rdbms, 11.2.0.4.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...

Patching component oracle.xdk.parser.java, 11.2.0.4.0...

Patching component oracle.sysman.console.db, 11.2.0.4.0...

Patching component oracle.xdk.rsf, 11.2.0.4.0...

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

Patching component oracle.sysman.common.core, 10.2.0.4.5...

Patching component oracle.rdbms.rman, 11.2.0.4.0...

Patching component oracle.rdbms.deconfig, 11.2.0.4.0...
Applying sub-patch '20760982' to OH '/u01/app/oracle/product/11.2.0/db_1'

Patching component oracle.sysman.console.db, 11.2.0.4.0...

Patching component oracle.rdbms, 11.2.0.4.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...

Patching component oracle.rdbms.rsf, 11.2.0.4.0...
Applying sub-patch '21352635' to OH '/u01/app/oracle/product/11.2.0/db_1'

Patching component oracle.sysman.agent, 10.2.0.4.5...

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

Patching component oracle.rdbms.rman, 11.2.0.4.0...

Patching component oracle.rdbms, 11.2.0.4.0...
Applying sub-patch '21948347' to OH '/u01/app/oracle/product/11.2.0/db_1'
ApplySession: Optional component(s) [ oracle.tfa, 11.2.0.4.0 ]  not present in the Oracle Home or a higher version is found.

Patching component oracle.sysman.agent, 10.2.0.4.5...

Patching component oracle.ovm, 11.2.0.4.0...

Patching component oracle.xdk, 11.2.0.4.0...

Patching component oracle.rdbms, 11.2.0.4.0...

Patching component oracle.nlsrtl.rsf, 11.2.0.4.0...

Patching component oracle.xdk.parser.java, 11.2.0.4.0...

Patching component oracle.sysman.console.db, 11.2.0.4.0...

Patching component oracle.xdk.rsf, 11.2.0.4.0...

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

Patching component oracle.sysman.oms.core, 10.2.0.4.5...
Applying sub-patch '22502456' to OH '/u01/app/oracle/product/11.2.0/db_1'
ApplySession: Optional component(s) [ oracle.tfa, 11.2.0.4.0 ]  not present in the Oracle Home or a higher version is found.

Patching component oracle.precomp.common, 11.2.0.4.0...

Patching component oracle.oraolap.dbscripts, 11.2.0.4.0...

Patching component oracle.rdbms.olap, 11.2.0.4.0...

Patching component oracle.oraolap, 11.2.0.4.0...

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

Patching component oracle.rdbms.rman, 11.2.0.4.0...

Patching component oracle.rdbms, 11.2.0.4.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...
Applying sub-patch '23054359' to OH '/u01/app/oracle/product/11.2.0/db_1'

Patching component oracle.rdbms.dv, 11.2.0.4.0...

Patching component oracle.rdbms, 11.2.0.4.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...

Patching component oracle.rdbms.rsf, 11.2.0.4.0...
Applying sub-patch '24006111' to OH '/u01/app/oracle/product/11.2.0/db_1'

Patching component oracle.sqlplus.ic, 11.2.0.4.0...

Patching component oracle.sqlplus, 11.2.0.4.0...

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

Patching component oracle.rdbms, 11.2.0.4.0...

Patching component oracle.rdbms.dbscripts, 11.2.0.4.0...
Applying sub-patch '24732075' to OH '/u01/app/oracle/product/11.2.0/db_1'

Patching component oracle.precomp.common, 11.2.0.4.0...

Patching component oracle.sysman.plugin.db.main.agent, 11.2.0.4.0...

Patching component oracle.sqlplus.ic, 11.2.0.4.0...

Patching component oracle.sqlplus, 11.2.0.4.0...

Patching component oracle.rdbms.rsf, 11.2.0.4.0...

Patching component oracle.rdbms, 11.2.0.4.0...

Patching component oracle.rdbms.util, 11.2.0.4.0...

Patching component oracle.ordim.client, 11.2.0.4.0...

Patching component oracle.ordim.jai, 11.2.0.4.0...

Patching component oracle.ordim.server, 11.2.0.4.0...

Connection closed by foreign host.


--启动节点1,关闭节点2
[oracle@rac1 ~]$ srvctl start instance -d leo -i leo1
[oracle@rac1 ~]$ srvctl stop intance -d leo -i leo2
[oracle@rac1 ~]$ srvctl status database -d leo
Instance leo1 is running on node rac1
Instance leo2 is not running on node rac2

--在节点2 应用Patch: 步骤和节点1作一样

--启动节点2 实例
[oracle@rac1 ~]$ srvctl start instance -d leo -i leo2
[oracle@rac1 ~]$  srvctl status database -d leo
Instance leo1 is running on node rac1
Instance leo2 is running on node rac2

5 执行脚本catbundle.sql 对于rac 环境只需要在一个节点执行即可 

cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle.sql psu apply
SQL> QUIT

6 执行脚本 utlrp.sql 

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

7 执行脚本 dbmsjdev.sql 

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

8 验证Opatch 是否升级成功

--每个节点都执行

[oracle@rac2 ~]$ /u01/app/oracle/product/11.2.0/db_1/OPatch/opatch lsinventory -detail -oh $ORACLE_HOME |grep -i patch
Oracle Interim Patch Installer version 11.2.0.3.16
OPatch version    : 11.2.0.3.16
Log file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2017-06-08_16-51-28PM_1.log
Lsinventory Output file location : /u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2017-06-08_16-51-28PM.txt
Oracle One-Off Patch Installer                                       11.2.0.3.4
Interim patches (1) :
Patch  24732075     : applied on Thu Jun 08 08:33:30 CST 2017
Unique Patch ID:  21176096
Patch description:  "Database Patch Set Update : 11.2.0.4.170418 (24732075)"
Sub-patch  24006111; "Database Patch Set Update : 11.2.0.4.161018 (24006111)"
Sub-patch  23054359; "Database Patch Set Update : 11.2.0.4.160719 (23054359)"
Sub-patch  22502456; "Database Patch Set Update : 11.2.0.4.160419 (22502456)"
Sub-patch  21948347; "Database Patch Set Update : 11.2.0.4.160119 (21948347)"
Sub-patch  21352635; "Database Patch Set Update : 11.2.0.4.8 (21352635)"
Sub-patch  20760982; "Database Patch Set Update : 11.2.0.4.7 (20760982)"
Sub-patch  20299013; "Database Patch Set Update : 11.2.0.4.6 (20299013)"
Sub-patch  19769489; "Database Patch Set Update : 11.2.0.4.5 (19769489)"
Sub-patch  19121551; "Database Patch Set Update : 11.2.0.4.4 (19121551)"
Sub-patch  18522509; "Database Patch Set Update : 11.2.0.4.3 (18522509)"
Sub-patch  18031668; "Database Patch Set Update : 11.2.0.4.2 (18031668)"
Sub-patch  17478514; "Database Patch Set Update : 11.2.0.4.1 (17478514)"
     bug16595641.sql --> ORACLE_HOME/patch/scripts/bug16595641.sql
     bug17088068.sql --> ORACLE_HOME/patch/scripts/bug17088068.sql
     bug17381384.sql --> ORACLE_HOME/patch/scripts/bug17381384.sql
     bug19289642.sql --> ORACLE_HOME/patch/scripts/bug19289642.sql
     bug22380919.sql --> ORACLE_HOME/patch/scripts/bug22380919.sql
     catmacpatch.sql --> ORACLE_HOME/rdbms/admin/catmacpatch.sql
     catmacpatch_rb.sql --> ORACLE_HOME/rdbms/admin/catmacpatch_rb.sql
     ins_rdbms.mk --> ORACLE_HOME/rdbms/lib/patchset_opt_all jox_refresh_knlopt ioracle
     sdopatch.sql --> ORACLE_HOME/md/admin/sdopatch.sql
     xmlpatch --> ORACLE_HOME/bin/xmlpatch
   Patch Location in Inventory:
   Patch Location in Storage area:
     /u01/app/oracle/product/11.2.0/db_1/.patch_storage/24732075_Feb_22_2017_21_40_49
OPatch succeeded.

9 版本说明 PSU 只能通过 dba_registry_history,v$version 看不到这些信息 

SQL> select * from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE	11.2.0.4.0	Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production

SQL> set lines 500     
SQL> select * from dba_registry_history;

ACTION_TIME								    ACTION			   NAMESPACE			  VERSION	   ID BUNDLE_SERIES		   COMMENTS
--------------------------------------------------------------------------- ------------------------------ ------------------------------ ------------------------------ ---------- ------------------------------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
24-AUG-13 12.03.45.119862 PM						    APPLY			   SERVER			  11.2.0.4	    0 PSU 			   Patchset 11.2.0.2.0
11-MAY-17 02.10.33.871453 AM						    APPLY			   SERVER			  11.2.0.4	    0 PSU 			   Patchset 11.2.0.2.0
08-JUN-17 05.43.11.521029 AM						    APPLY			   SERVER			  11.2.0.4	    0 PSU 			   Patchset 11.2.0.2.0
08-JUN-17 08.01.28.111312 AM						    APPLY		
2017-06-15 09:3826650原创Oracle 11g编辑删除 本文链接:https://www.cndba.cn/leo1990/article/1992
[2017-06-15 09:3826650 Yuánchuàng Oracle 11g biānjí shānchú běnwén liànjiē:Https://Www.Cndba.Cn/leo1990/article/1992]
2017-06-15 09:3826650 original Oracle 11g edit delete

Link to this article: https://www.cndba.cn/leo1990/article/1992
 

猜你喜欢

转载自blog.csdn.net/leo__1990/article/details/90437214