如何给Oracle数据库打PSU

可以查看Oracle数据库安装软件中的说明文档,去查看该给数据库打什么Patch。查到之后,可以去MOS(My Oracle Support)查找相关Patch及OPatch。

这次说的是打PSU:

对于Oracle 11.2.0.2来说,最新的PSU为p11724916_112020_Linux-x86-64,其README文档中有9部分,我认为前3部分比较重要:

Section 1, “Patch Information”
Section 2, “Prerequisites”
Section 3, “Installation”
Section 4, “Deinstallation”
Section 5, “Known Issues”
Section 6, “References”
Section 7, “Bugs Fixed by This Patch”
Section 8, “Modification History”
Section 9, “Documentation Accessibility”

第一部分,介绍Patch的一些基本信息,了解即可。

第二部分,介绍前期准备条件。这里说明了需要的OPatch的版本,对于11.2.0.2来说,OPatch需要的版本为6880880

You must use the OPatch utility version 11.2.0.1.3 or later to apply this patch. Oracle recommends that you use the latest released OPatch 11.2, which is available for download from My Oracle Support patch 6880880 by selecting the 11.2.0.0.0 release.

For information about OPatch documentation, including any known issues, see My Oracle Support Note 293369.1 OPatch documentation list.

第三部分,主要对打Patch的过程进行描述,包括前期校验、中期操作、后期工作。以例子说明:

根据PSU中README的提示,先检测PSU是否与其他one-off patches冲突:

[[email protected] OPatch]$ ./opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir ../11724916/

Invoking OPatch 11.2.0.1.6

Oracle Interim Patch Installer version 11.2.0.1.6

Copyright (c) 2011, Oracle Corporation. All rights reserved.

PREREQ session

Oracle Home : /opt/app/oracle/product/11.2.0/db_1

Central Inventory : /opt/app/oraInventory

from : /etc/oraInst.loc

OPatch version : 11.2.0.1.6

OUI version : 11.2.0.2.0

Log file location : /opt/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2011-07-12_14-37-04PM.log

Invoking prereq “checkconflictagainstohwithdetail”

Prereq “checkConflictAgainstOHWithDetail” passed.

OPatch succeeded.

应用Patch:

[[email protected] patch]$ cd 11724916/

[[email protected] 11724916]$ ../OPatch/opatch apply

Invoking OPatch 11.2.0.1.6

Oracle Interim Patch Installer version 11.2.0.1.6

Copyright (c) 2011, Oracle Corporation. All rights reserved.

Oracle Home : /opt/app/oracle/product/11.2.0/db_1

Central Inventory : /opt/app/oraInventory

from : /etc/oraInst.loc

OPatch version : 11.2.0.1.6

OUI version : 11.2.0.2.0

Log file location : /opt/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2011-07-12_14-39-11PM.log

Applying interim patch ‘11724916’ to OH ‘/opt/app/oracle/product/11.2.0/db_1′

Verifying environment and performing prerequisite checks…

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 = ‘/opt/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…

Patching component oracle.rdbms.rsf, 11.2.0.2.0…

Patching component oracle.rdbms, 11.2.0.2.0…

Copying file to “/opt/app/oracle/product/11.2.0/db_1/psu/11.2.0.2.2/catpsu.sql”

Copying file to “/opt/app/oracle/product/11.2.0/db_1/psu/11.2.0.2.2/catpsu_rollback.sql”

Patching component oracle.sysman.console.db, 11.2.0.2.0…

Patching component oracle.sysman.oms.core, 10.2.0.4.3…

Patching component oracle.ldap.rsf, 11.2.0.2.0…

Patching component oracle.rdbms.dv, 11.2.0.2.0…

Patching component oracle.rdbms.dbscripts, 11.2.0.2.0…

Patch 11724916 successfully applied

Log file location: /opt/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2011-07-12_14-39-11PM.log

OPatch succeeded.

查看已安装的补丁,从下面的内容可以看到我们刚刚打好的补丁11724916:

[[email protected] 11724916]$ ../OPatch/opatch lsinventory

Invoking OPatch 11.2.0.1.6

Oracle Interim Patch Installer version 11.2.0.1.6

Copyright (c) 2011, Oracle Corporation. All rights reserved.

Oracle Home : /opt/app/oracle/product/11.2.0/db_1

Central Inventory : /opt/app/oraInventory

from : /etc/oraInst.loc

OPatch version : 11.2.0.1.6

OUI version : 11.2.0.2.0

Log file location : /opt/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2011-07-12_14-42-07PM.log

Lsinventory Output file location : /opt/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2011-07-12_14-42-07PM.txt

——————————————————————————–

Installed Top-level Products (1):

Oracle Database 11g 11.2.0.2.0

There are 1 products installed in this Oracle Home.

Interim patches (1) :

Patch 11724916 : applied on Tue Jul 12 14:40:49 CST 2011

Unique Patch ID: 13739423

Created on 1 Apr 2011, 07:09:05 hrs PST8PDT

Bugs fixed:

10151017, 10158965, 11724916, 10190642, 10129643, 10018789, 9744252

10248523, 9956713, 10356513, 9715581, 9770451, 10170431, 10425676

10222719, 9591812, 10127360, 10094201, 11069199, 10245086, 10205230

10052141, 11818335, 11830776, 11830777, 9905049, 11830778, 10077191

10358019, 10219576, 10264680, 10209232, 10102506, 11067567, 9881076

10040531, 10218814, 9788588, 9735237, 10230571, 10079168, 10228151

10013431, 10217802, 10238786, 10052956, 11699057, 10080579, 10332111

10227288, 10329146, 10332589, 10110863, 10073683, 10019218, 10229719

10373381, 11724984, 9539440, 10411618, 10022980, 10187168, 6523037

9724970, 10084145, 10157402, 9651350, 10299224

——————————————————————————–

OPatch succeeded.

需要应用catbundle.sql才能最终完成打补丁的过程。

cd $ORACLE_HOME/rdbms/admin

SQL> @catbundle.sql psu apply

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

Generating apply and rollback scripts…

Check the following file for errors:

/opt/app/oracle/cfgtoollogs/catbundle/catbundle_PSU_CARELIFE_GENERATE_2011Jul13_09_24_30.log

Apply script: /opt/app/oracle/product/11.2.0/db_1/rdbms/admin/catbundle_PSU_CARELIFE_APPLY.sql

Rollback script: /opt/app/oracle/product/11.2.0/db_1/rdbms/admin/catbundle_PSU_CARELIFE_ROLLBACK.sql

PL/SQL procedure successfully completed.

Executing script file…

SQL> COLUMN spool_file NEW_VALUE spool_file NOPRINT

SQL> SELECT ‘/opt/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> PROMPT Skipping Oracle Database Vault because it is not installed or versions mismatch…

Skipping Oracle Database Vault because it is not installed or versions mismatch…

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.2’,

9 2,

10 ‘PSU’,

11 ‘PSU 11.2.0.2.2′);

1 row created.

SQL> COMMIT;

Commit complete.

参考资料:

Oracle Patch README文件

Kamus博客:http://www.dbform.com/html/2011/1518.html

普人特福的博客cnzz&51la for wordpress,cnzz for wordpress,51la for wordpress