Applying CPUJan2012 Patch on 11.2.0.2/Linux(64 bit)
STEPS:-
- Database Version
- OS version
- Download CPUJan2012 patch for 11.2.0.2.0
- Opatch Version
- Sessions Status
- Invalid objects
- Status of Oracle Services
- Backup
- Apply Opatch
- Post Installation
- Check the status from registry$history
- Recompiling Views in Database
1) Database Version
SQL> select * from v$version; BANNER -------------------------------------------------------------------------------- Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production PL/SQL Release 11.2.0.2.0 - Production CORE 11.2.0.2.0 Production TNS for Linux: Version 11.2.0.2.0 - Production NLSRTL Version 11.2.0.2.0 - Production SQL>
2) OS version
oracle-ckpt.com> file /bin/ls
/bin/ls: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped oracle-ckpt.com>
3) Download CPUJan2012 patch for 11.2.0.2
4) Opatch Version
To apply CPUJan2012, OPatch utility version 11.2.0.1.0 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
oracle-ckpt.com> export PATH=/u00/app/oracle/product/11.2.0/OPatch:$PATH
oracle-ckpt.com> opatch lsinventory
Invoking OPatch 11.2.0.1.1
Oracle Interim Patch Installer version 11.2.0.1.1
Copyright (c) 2009, Oracle Corporation. All rights reserved.
Oracle Home : /u00/app/oracle/product/11.2.0
Central Inventory : /u00/app/oraInventory
from : /etc/oraInst.loc
OPatch version : 11.2.0.1.1
OUI version : 11.2.0.2.0
OUI location : /u00/app/oracle/product/11.2.0/oui
Log file location : /u00/app/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2012-03-03_06-32-39AM.log
Patch history file: /u00/app/oracle/product/11.2.0/cfgtoollogs/opatch/opatch_history.txt
Lsinventory Output file location : /u00/app/oracle/product/11.2.0/cfgtoollogs/opatch/lsinv/lsinventory2012-03-03_06-32-39AM.txt
--------------------------------------------------------------------------------
Installed Top-level Products (1):
Oracle Database 11g 11.2.0.2.0
There are 1 products installed in this Oracle Home.
5) Sessions Status
Check How Many sesion are ACTIVE, If any found Ask Application team to bring down all Applications/Processes.
SQL> select username,count(*) from v$session where username is not nulll group by username; USERNAME COUNT(*) ------------------------------ ---------- 26 SOTCADM 6 SYS 1 SQL>
6) Invalid objects
SQL> select count(*),object_type from dba_objects where status <> 'VALID' and OWNER !='PUBLIC' and OBJECT_TYPE!='SYNONYM' group by object_type; COUNT(*) OBJECT_TYPE ---------- ------------------- 38 TRIGGER 2 VIEW SQL>
7) Status of Oracle Services
oracle-ckpt.com> ps -ef|grep pmon oracle 8016 30235 0 02:17 pts/0 00:00:00 grep pmon oracle-ckpt.com> ps -ef|grep tns oracle 8019 30235 0 02:17 pts/0 00:00:00 grep tns oracle-ckpt.com>
8 ) Backup
Take Cold Backup of Database & Backup of (ORACLE_HOME & Inventory)
oracle-ckpt.com> tar -zcpvf 11.2.0_Home_Inventory_Backup_$(date +%Y%m%d).tar.gz /u00/app/oracle/product/11.2.0 /u00/app/oraInventory/ /u00/app/oracle/product/11.2.0/ /u00/app/oracle/product/11.2.0/jdev/ /u00/app/oracle/product/11.2.0/jdev/lib/ /u00/app/oracle/product/11.2.0/jdev/lib/jdev-rt.jar /u00/app/oracle/product/11.2.0/jdev/lib/javacore.jar /u00/app/oracle/product/11.2.0/jdev/doc/ /u00/app/oracle/product/11.2.0/jdev/doc/extension/ /u00/app/oracle/product/11.2.0/jdev/doc/extension/extension.xsd /u00/app/oracle/product/11.2.0/olap/ --- All files related to ORACLE_HOME & Inventory ------ /u00/app/oraInventory/orainstRoot.sh /u00/app/oraInventory/ContentsXML/ /u00/app/oraInventory/ContentsXML/comps.xml /u00/app/oraInventory/ContentsXML/libs.xml /u00/app/oraInventory/ContentsXML/inventory.xml /u00/app/oraInventory/install.platform /u00/app/oraInventory/oui/ /u00/app/oraInventory/oui/srcs.lst oracle-ckpt.com>
9) Apply Opatch
oracle-ckpt.com> export PATH=$ORACLE_HOME/OPatch:$PATH: oracle-ckpt.com> opatch napply -skip_subset -skip_duplicate Invoking OPatch 11.2.0.1.1 Oracle Interim Patch Installer version 11.2.0.1.1 Copyright (c) 2009, Oracle Corporation. All rights reserved. UTIL session Oracle Home : /u00/app/oracle/product/11.2.0 Central Inventory : /u00/app/oraInventory from : /etc/oraInst.loc OPatch version : 11.2.0.1.1 OUI version : 11.2.0.2.0 OUI location : /u00/app/oracle/product/11.2.0/oui Log file location : /u00/app/oracle/product/11.2.0/cfgtoollogs/opatch/opatch2012-02-26_02-17-44AM.log Patch history file: /u00/app/oracle/product/11.2.0/cfgtoollogs/opatch/opatch_history.txt Invoking utility "napply" Checking conflict among patches... Checking if Oracle Home has components required by patches... Checking skip_duplicate Checking skip_subset Checking conflicts against Oracle Home... OPatch continues with these patches: 11830776 11830777 12586486 12586487 12586488 12586489 12586491 12586492 12586493 12586494 12586495 12586496 12846268 12846269 13343244 13386082 13468884 Do you want to proceed? [y|n] y User Responded with: Y Running prerequisite checks... OPatch detected non-cluster Oracle Home from the inventory and will patch the local system only. Please shutdown Oracle instances running out of this ORACLE_HOME on the local system. (Oracle Home = '/u00/app/oracle/product/11.2.0') Is the local system ready for patching? [y|n] y User Responded with: Y Backing up files affected by the patch 'NApply' for restore. This might take a while... Applying patch 11830776... ApplySession applying interim patch '11830776' to OH '/u00/app/oracle/product/11.2.0' Backing up files affected by the patch '11830776' for rollback. This might take a while... Patching component oracle.sysman.console.db, 11.2.0.2.0... Updating jar file "/u00/app/oracle/product/11.2.0/sysman/jlib/emCORE.jar" with "/sysman/jlib/emCORE.jar/oracle/sysman/eml/admin/rep/AdminResourceBundle.class" Updating jar file "/u00/app/oracle/product/11.2.0/sysman/jlib/emCORE.jar" with "/sysman/jlib/emCORE.jar/oracle/sysman/eml/admin/rep/AdminResourceBundleID.class" Updating jar file "/u00/app/oracle/product/11.2.0/sysman/jlib/emCORE.jar" with "/sysman/jlib/emCORE.jar/oracle/sysman/eml/admin/rep/UserData.class" Copying file to "/u00/app/oracle/product/11.2.0/oc4j/j2ee/oc4j_applications/applications/em/em/admin/rep/editUserSummary.uix" Patching component oracle.rdbms, 11.2.0.2.0... Updating archive file "/u00/app/oracle/product/11.2.0/lib/libserver11.a" with "lib/libserver11.a/qerrm.o" Updating archive file "/u00/app/oracle/product/11.2.0/lib/libserver11.a" with "lib/libserver11.a/kspt.o" Updating archive file "/u00/app/oracle/product/11.2.0/lib/libserver11.a" with "lib/libserver11.a/qmix.o" Updating archive file "/u00/app/oracle/product/11.2.0/lib/libserver11.a" with "lib/libserver11.a/qmxtk.o" Updating archive file "/u00/app/oracle/product/11.2.0/rdbms/lib/libknlopt.a" with "rdbms/lib/libknlopt.a/kkxwtp.o" Copying file to "/u00/app/oracle/product/11.2.0/rdbms/lib/kkxwtp.o" ApplySession adding interim patch '13468884' to inventory Verifying the update... Inventory check OK: Patch ID 13468884 is registered in Oracle Home inventory with proper meta-data. Files check OK: Files from Patch ID 13468884 are present in Oracle Home. Running make for target client_sharedlib Running make for target client_sharedlib Running make for target ioracle The local system has been patched and can be restarted. UtilSession: N-Apply done. OPatch succeeded. oracle-ckpt.com>
10) Post Installation
database instance running on the Oracle home being patched, connect to the database using SQL*Plus using SYSDBA and run the catbundle.sql script as follows: oracle-ckpt.com> sqlplus / as sysdba SQL*Plus: Release 11.2.0.2.0 Production on Sun Feb 26 02:26:39 2012 Copyright (c) 1982, 2010, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> @?/rdbms/admin/catbundle.sql cpu apply
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
Generating apply and rollback scripts...
Check the following file for errors:
/u00/app/oracle/cfgtoollogs/catbundle/catbundle_CPU_PROD_GENERATE_2012Feb26_02_27_09.log
Apply script: /u00/app/oracle/product/11.2.0/rdbms/admin/catbundle_CPU_PROD_APPLY.sql
Rollback script: /u00/app/oracle/product/11.2.0/rdbms/admin/catbundle_CPU_PROD_ROLLBACK.sql
PL/SQL procedure successfully completed.
Executing script file...
SQL> COLUMN spool_file NEW_VALUE spool_file NOPRINT
SQL> SELECT '/u00/app/oracle/cfgtoollogs/catbundle/' || 'catbundle_CPU_' || name || '_APPLY_' || TO_CHAR(SYSDATE, 'YYYYMonDD_hh24_mi_ss', 'NLS_DATE_LANGUAGE=''AMERICAN''') || '.log' AS spool_file FROM v$database;
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 4,
10 'CPU',
11 'CPUJan2012');
1 row created.
SQL> COMMIT;
Commit complete.
SQL> SPOOL off
SQL> SET echo off
Check the following log file for errors:
/u00/app/oracle/cfgtoollogs/catbundle/catbundle_CPU_PROD_APPLY_2012Feb26_02_27_12.log
SQL>
11) Check the status from registry$history
12) Compile Invalid objects by executing “utlrp.sql”.
Before Patching
SQL> select count(*),object_type from dba_objects where status <> 'VALID' and OWNER !='PUBLIC' and OBJECT_TYPE!='SYNONYM' group by object_type; COUNT(*) OBJECT_TYPE ---------- ------------------- 38 TRIGGER 2 VIEW SQL>
After Patching & Recompile
SQL> select count(*),object_type from dba_objects where status <> 'VALID' and OWNER !='PUBLIC' and OBJECT_TYPE!='SYNONYM' group by object_type;
COUNT(*) OBJECT_TYPE ---------- ------------------- 2 VIEW SQL>
13) Opatch Status
oracle-ckpt.com> opatch lsinventory|grep 13343244 Patch 13343244 : applied on Sun Feb 26 02:21:14 EST 2012 12419321, 12828071, 13343244, 11724984 oracle-ckpt.com>
Hi ckpt,
Your post was helpful for me…
Can you tell me, after applying CPUJan2012 Patch to ORACLE_HOME.
Whenever we create a new DB using dbca do we need to run the following scripts:
@?/rdbms/admin/catbundle cpu apply
@?/cpu/view_recompile/view_recompile_jan2008cpu.sql
can you help me in this…
First, You will apply CPU patch for existing database, If you even create Database using DBCA on top of that if you apply CPU patch then only you have to execute those scripts, until unless you no need to execute them. Again these quarterly patches are highly recommended to apply. So consider them.
Thanks Basha,
In document it was mentioned that @catbundle.sql cpu apply script should be applied for all database running in the ORACLE_HOME path.
Can you tell me do i need to run @recompile_precheck_jan2008cpu.sql and @view_recompile_jan2008cpu.sql scripts also in all the databases are in the database running in the instances or is it enough if I run this as mentioned in the document in HOMEpath as sqlplus /nolog.
And you mentioned that we have to do CPU patch again for every new database created using dBCA even after installing patch but in document it was mentioned only about recompile script.. can you clear on this also??
Your reply help me alot thanks….
Basha pls do this favor this will be very helpful for me..
can you pls tell me @view_recompile_jan2008cpu.sql and @recompile_precheck_jan2008cpu.sql should be run in each and every database in the homepath??
pls kindly clear my doubt thaks alot…
If you applied patch on a home, you have to execute those scripts on all the databases whatever dependent on that home.
Thanks a lot Basha for your replies.. I learned a lot and your post help me so much thanks once again..
You need not run @?/rdbms/admin/catbundle cpu apply and @?/cpu/view_recompile/view_recompile_jan2008cpu.sql if you have created the database after patch was applied on home. Just keep one rule with you: ” Once Oracle Home is patched, execution of any script as per read me file is applicable only to existing database in that home.”
Thanks for that, Did i mention any where that i should run this script even if we create new database after applying patch? 🙂