Tuesday, June 28, 2016

Database PSU + OJVM Combo Patch Activity


Database PSU + OJVM Combo Patch Activity

Steps for applying PSU + OJVM Patch

1.    Check OS version

2.    Make a directory to take all the pre checks and binary backup
mkdir <location where you have enough space>
cd <location where you have enough space>

3.    Take crontab backup and comment it
crontab –l > crontab_bkup
crontab –e
To Disabled Entry $:%s/^/##VAIBHAV##/g
To Enable Entry $:%s/## VAIBHAV ##//g

4.    Set path for opatch
export PATH=$ORACLE_HOME/OPatch:$PATH
opatch lsinventory > opatch_bkup

5.    Now need to take DB precheck
spool precheck.log
set echo on
col host_name for a15
select name, open_mode,host_name,log_mode from v$database,v$instance;
select * from v$version;
col owner for a15
col object_name for a35
select count(*) from dba_objects where status='INVALID';
select count(*), status  from dba_objects  group by status;

====================================

select OWNER,OBJECT_NAME,OBJECT_TYPE,status from DBA_OBJECTS where status = 'INVALID';
select owner,count(1) from dba_objects where status='INVALID' group by owner;

> to compile invalid objects :

select 'ALTER ' || OBJECT_TYPE || ' ' || owner || '.' || OBJECT_NAME || ' COMPILE;' from dba_objects where status = 'INVALID';

==============================
set lines 200
col COMMENTS for a20
col ACTION for a10
col ACTION_TIME for a30
col NAMESPACE for a10
col BUNDLE_SERIES for a20
col VERSION for a10
select * from registry$history;

=========================================

col COMP_NAME for a40
col VERSION for a20
col STATUS for a10
set lines 150
select comp_name,version,status from dba_registry;

=========================================

spool off

6.    Shut down the database
shut immediate

7.    Take binary backup

cd $ORACLE_HOME/..

tar -cvf - 11.2.0.4 | compress > <location where you have enough space>/11.2.0.4.tar.gz

8.    Now download the Combo patch from Oracle Support and unzip to your location

Check its README file first,
Then check its conflict with your opatch inventory
opatch prereq CheckConflictAgainstOHWithDetail –phBaseDir < patch location >

Example : opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /opt/app/Vaibhav/Vaibhav_PSUApril_2016/22378146/21948347

9.    Now if precheck succeded successfully, then fire command opatch apply

10. Same needs to do for OJVM also, precheck and apply


11. For applying the PSU at db level, start the database in normal mode
startup
@$ORACLE_HOME/rdbms/admin/catbundle.sql psu apply
@$ORACLE_HOME/rdbms/admin/utlrp.sql

12. Shut down the database and start it in upgrade mode as per README if applying OJVMs for 2015 onwards
startup upgrade
@<OJVM Patch location>/postinstall.sql
13. Now after successfully applying OJVM, shut down the database and startup normally

14. Do post checks as done in prechecks and check INVALID components and INVALID objects. It should be as same as precheck
All done !!!

No comments:

Post a Comment