Applying Patches on Oracle 12c Guide

This is an overview procedure on how to apply Oracle Patches (PSU) on Oracle 12cR1 databases (12.1.0.2). Its very important that you read the official documentation (readme.html) that is being provided with the patch being released in case oracle is listing new requirements.

********* STEPS for Applying PSU on 12c in Unix environment:

1.first collect preliminary database information and spool it in a file.

make a directory and call it before_patch: mkdir before_patch

cd before_patch

sqlplus ‘/as sysdba’

set pages 300
set lines 250
col owner for a17;
col object_name for a35;
col object_type for a20;
col action for a15;
col comments for a40;
col comp_name for a40;
col version for a15;

spool before_patch.log
SELECT NAME FROM V$DATABASE;
SELECT * from V$VERSION;
SELECT ACTION,VERSION,COMMENTS FROM SYS.REGISTRY$HISTORY;
SELECT * from dba_registry_sqlpatch;
SELECT COMP_NAME,VERSION,STATUS FROM DBA_REGISTRY;
select count(*) from dba_objects where status = ‘INVALID’;
select owner, count(*) from dba_objects where status <>’VALID’ group by owner order by 1;
Select owner, object_type, object_name
from dba_objects where status <>’VALID’ order by 1,2,3;
spool off

2. edit your Oracle inventory and make sure its pointing to the right location

3.shutdown listener and shutdown the database.

you can check the database listener name in your server by executing the unix command: ps -ef |  gep inh

or going directly to $ORACLE_HOME/network/admin and executing the command: lsnrctl stop listener_db1

4. in 12c the patches are being setup depending if you have JAVA component in your database or not.

For 12.1.0.2 if there is no JAVA component
go to the location of the patch:

cd ../20834354/20299023
then execute the OPatch utiltiy
OPatch/opatch apply -invPtrLoc /etc/oraInst.loc

For 12.1.0.2 if JAVA component exists
cd ../20834354/20415564
Opatch/12.1.0.1.7/OPatch/opatch apply -invPtrLoc /etc/oraInst.loc

*** the output will be similar to this:

Do you want to proceed? [y|n]
Y
Email address/User Name:
Press enter

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]:
Yes

Is the local system ready for patching? [y|n]
Y

5. Run Bundle

##### To run the bundle for 12.1.0.2 FOR NON-JAVA
sqlplus ‘/as sysdba’
STARTUP
exit
cd $ORACLE_HOME/OPatch
./datapatch -verbose
—–Please make sure you receive the following message “Patch 20299023 apply: SUCCESS
sqlplus ‘/as sysdba’
col PRODUCT for a60;
col VERSION for a10;
col STATUS for a15;
col description for a60;
col action_time for a30;
set lines 133
select patch_id, version, status, description, action_time from dba_registry_sqlpatch order by 1;

##### To run the bundle for 12.1.0.2 FOR JAVA
sqlplus ‘/as sysdba’
STARTUP UPGRADE
QUIT
cd $ORACLE_HOME/OPatch
./datapatch –verbose
sql
shutdown immediate
STARTUP

6. Post Patching
cd
mkdir after_patch
cd after_patch
sql
sqlplus ‘/as sysdba’
col action for a15;
col comments for a40;
col comp_name for a40;
col version for a15;
set pages 300
set lines 300

spool after_patch.log
select name from v$database;
select * from v$version;
select ACTION,VERSION,COMMENTS from sys.registry$history;
select COMP_NAME,VERSION,STATUS from dba_registry;
select * from dba_registry_sqlpatch;
select count(*) from dba_objects where status = ‘INVALID’;
select owner, count(*) from dba_objects where status <>’VALID’ group by owner order by 1;
Select owner, object_type, object_name
from dba_objects where status <>’VALID’ order by 1,2,3;
spool off

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s