oracle 11gr2 11.2.0.4升级11.2.0.4.2
更新的补丁安装包有如下:
1.p6880880_112000_LINUX.zip
2.p18031668_112040_Linux-x86-64.zip
1.把Opatch的环境变量配置
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
2.检查当前数据库的版本
opatch version
[oracle@kadora4 OPatch]$ opatch version
OPatch Version: 11.2.0.3.4
OPatch succeeded.
opatch lsinventory
[oracle@kadora4 OPatch]$ opatch lsinventory
Oracle Interim Patch Installer version 11.2.0.3.4
Copyright (c) 2012, Oracle Corporation.
OracleHome
Central Inventory : /opt/oraInventory
OPatchversion
OUIversion
Log file location :/opt/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2014-07-07_10-44-39AM_1.log
Lsinventory Output file location :/opt/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2014-07-07_10-44-39AM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (1):
Oracle Database11g
There are 1 products installed in this Oracle Home.
There are no Interim patches installed in this Oracle Home.
--------------------------------------------------------------------------------
3.更新补丁工具包
cd $ORACLE_HOME/
mv OPatch OPath_bak
unzip p6880880_112000_LINUX.zip
cd OPatch
[oracle@racdb1 db_1]$ cd OPatch
[oracle@racdb1 OPatch]$ ls
crs
[oracle@racdb1 OPatch]$
[oracle@racdb1 OPatch]$ opatch version
OPatch Version: 11.2.0.3.6
OPatch succeeded.
4.检查你需要打的补丁是否与现有的补丁有冲突
unzip p18031668_112040_Linux-x86-64.zip
cd 18031668
[oracle@racdb1 18031668]$ opatch prereqCheckConflictAgainstOHWi
Oracle Interim Patch Installer version 11.2.0.3.6
Copyright (c) 2013, Oracle Corporation.
PREREQ session
OracleHome
Central Inventory : /u01/app/oraInventory
OPatchversion
OUIversion
Log file location :/u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2014-07-09_01-59-50AM_1.log
Invoking prereq "checkconflictagainstohwi
Prereq "checkConflictAgainstOHWi
OPatch succeeded.
5.备份数据库
略...........................................................................
6.关闭数据库并更新最新的补丁
sqlplus / as sysdba
shutdown immediate
cd 18031668
opatch apply
opatch apply
Oracle Interim Patch Installer version 11.2.0.3.6
Copyright (c) 2013, Oracle Corporation.
OracleHome
Central Inventory : /u01/app/oraInventory
OPatchversion
OUIversion
Log file location :/u01/app/oracle/product/11.2/db_1/cfgtoollogs/opatch/17478514_Apr_02_2014_15_38_28/apply2014-04-02_15-38-28PM_1.log
You have not provided an email address for notification of securityissues.
Do you wish to remain uninformed of security issues ([Y]es, [N]o)[N]:
Please shutdown Oracle instances running out of this ORACLE_HOME onthe local system.
(Oracle Home = '/u01/app/oracle/product/11.2/db_1')
Is the local system ready for patching? [y|n]
y
User Responded with: Y
Backing up files...
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...
OPatch found the word "warning" in the stderr of the makecommand.
Please look at this stderr. You can re-run this make command.
Stderr output:
ins_emagent.mk:113: warning: overriding commands for target`nmosudo'
ins_emagent.mk:52: warning: ignoring old commands for target`nmosudo'
/u01/app/oracle/product/11.2/db_1/sysman/lib/ins_emagent.mk:113:warning: overriding commands for target `nmosudo'
/u01/app/oracle/product/11.2/db_1/sysman/lib/ins_emagent.mk:52:warning: ignoring old commands for target `nmosudo'
Verifying the update...
Patch 17478514 successfully applied
OPatch Session completed with warnings.
Log file location:/u01/app/oracle/product/11.2/db_1/cfgtoollogs/opatch/17478514_Apr_02_2014_15_38_28/apply2014-04-02_15-38-28PM_1.log
OPatch completed with warnings.
7.查看补丁:
opatch lsinventory
oracle@racdb1OPatch]$
Oracle Interim Patch Installer version 11.2.0.3.6
Copyright (c) 2013, Oracle Corporation.
OracleHome
Central Inventory : /u01/app/oraInventory
OPatchversion
OUIversion
Log file location :/u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/opatch2014-07-09_02-10-23AM_1.log
Lsinventory Output file location :/u01/app/oracle/product/11.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2014-07-09_02-10-23AM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (1):
Oracle Database11g
There are 1 product(s) installed in this Oracle Home.
Interim patches (1) :
Patch
Unique Patch ID:
Patch description:
Sub-patch
--------------------------------------------------------------------------------
8.执行catbundle.sql将补丁信息反射到数据库中,使数据库知道你最后一次打了什么补丁或者回滚了哪些补丁:
SQL> @?/rdbms/admin/catbundle.sql psu apply
SQL> Rem
SQL>
SQL> SET TERMOUT on
SQL> SET ECHO off
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
1 row selected.
1 row selected.
Generating apply and rollback scripts...
Check the following file for errors:
/u01/app/oracle/cfgtoollogs/catbundle/catbundle_PSU_FTDB_GENERATE_2014Apr02_17_20_18.log
Apply script:/u01/app/oracle/product/11.2/db_1/rdbms/admin/catbundle_PSU_FTDB_APPLY.sql
Rollback script:/u01/app/oracle/product/11.2/db_1/rdbms/admin/catbundle_PSU_FTDB_ROLLBACK.sql
PL/SQL procedure successfully completed.
Executing script file...
1 row selected.
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;
1 row selected.
SQL> SPOOL &spool_file
SQL> exec dbms_registry.set_session_namespace('SERVER')
PL/SQL procedure successfully completed.
SQL> PROMPT Skipping Spatial because it is not installed orversions mismatch...
Skipping Spatial because it is not installed or versionsmismatch...
SQL> ALTER SESSION SET current_schema = SYS;
Session altered.
SQL> PROMPT Updating registry...
Updating registry...
SQL> INSERT INTO registry$history
1 row created.
SQL> COMMIT;
Commit complete.
SQL> SPOOL off
SQL> SET echo off
Check the following log file for errors:
9.如果你使用了RMAN的catalog,那么你还要更新CATALOG数据库:
$ rman catalog username/password@alias
RMAN> UPGRADE CATALOG
10.如果你打了补丁发现有问题,那么你需要回滚补丁:
opatch rollback -id 18031668
使用以上命令就可以回滚相应ID的补丁
11.然后需要执行以下脚本将补丁回滚的信息反射到数据库中
cd $ORACLE_HOME/rdbms/admin
sqlplus /nolog
SQL> CONNECT / AS SYSDBA
SQL> STARTUP
SQL> @catbundle_PSU__ROLLBACK.sql
SQL> QUIT