Oracle Patches
Patches are used to correct the bugs. It will change the last number of the version.
11.2.0.3.0 to 11.2.0.3.1 – PSU
Ex:
10g -10.2.0.4.0 version – alter system flush shared_pool/buffer_cache will not work
11g -11.2.0.3.0 version – $nid DB newid will not work. (Changing DB ID)
Types of Patch:
- Opatch – Oracle patch (It will fix only one bug)
- CPU – Critical patch update (Every quarter once)
- PSU – Patch set update (Bundle patch) 2.0.3.0 to 11.2.0.3.1
Opatch | CPU | PSU |
One off patch | Security patch | Bundle patch |
Size will be in KB | Size will be min 80 MB to Max 150 MB | Size will be min 250 MB to Max 280 MB |
Released every quarter once | ||
It will change the no 11.2.0.3.0 to 11.2.0.4.0 |
11.2.0.3.0 – major.minor.build.revision.release
11 – Major Database release number
2 – Database maintenance
0 – Application server
3 – Component specific
0 – platform specific
Note: To apply a patch we need downtime. Best practice PSU patch apply will be good, since it has O+CPU.
There is one more called “Migration patch” – It is a JDBC driver related one – no downtime needed for this.
Prerequesting
For all patches apply and command will be same.
Go to oracle website MOS — Choose type as patches — Search and download.
Download the patch from oracle site –www.metalink.oracle.com (Need a licensed credential)
Go to — patches update — product family — RDBMS servers –Enter Version –Platform
Choose the type –Patches. Search & download
If you know the patch number — Go to — patches update — product number —p1234
It will download & unzip two files. P6880880 – is OPatch patch, default it will come.
The patch always applied in both places.
- Oracle binaries/ software
- Database
Find out any existing patch or oracle version is equal and higher with the OPatch.
Generally, we need an equal or higher version of OPatch.
$ export ORACLE_HOME =/opt/oracle/product/11.2.0.3.0/dbhome –If you have a right bash_profile skip it.
$ /opt/oracle/product/11.2.0.3.0/dbhome/OPatch/opatch lsinventory
Oracle version : 11.2.0.3.0
OPatch version:11.1.0.7.0
Apply a patch for binaries
$ cd /opt
$ unzip p6880880_linux_86.zip
$ ls
$ cd /opt/oracle/product/11.2.0.3.0/dbhome
$ mv OPatch OPatch_old – Rename the OH folder
$ cd /opt
$ cp –r Opatch /opt/oracle/product/11.2.0.3.0/dbhome
Now check the OPatch version
$ /opt/oracle/product/11.2.0.3.0/dbhome/OPatch/opatch lsinventory
OPatch version:11.2.0.3.6
$ cd /opt
$ unzip p1234_linux_x86.zip
$ ls
$ cd to that patch folder
Shutdown the DB
$ /opt/oracle/product/11.2.0.3.0/dbhome/OPatch/opatch apply – local
Y: — enter — Y: — OPatch applied susscefully.
Local – It’s mainly for RAC. But do it as a best practice. – Optional
Apply – For single patch & napply – For subset of patch
For PSU – napply
Now check version
$ /opt/oracle/product/11.2.0.3.0/dbhome/OPatch/opatch lsinventory
Patch number 1234
Date : Today date
Apply a patch for Databases
We need to apply per database, if it has more than one.
$ export ORACLE_SID = Muthu
Sql> conn sys/sys as sysdba
Sql> startup
Sql> @?/sqlpatch/1234/catpostinstall.sql – normal
Sql> @?/sqlpatch/1234/catpostinstall.sql – PSU
Sql> @?/sqlpatch/1234/catCPU.sql – CPU
@ – to run ? – Oracle_Home
Then remaining databases …
Verify the patch
Sql> select * from dba_registry_history;
Bundel – Psu etc
Data – Today date
Rollback Patch
For Database
Sql> @?/sqlpatch/1234/catpostdeinstall.sql – normal
Sql> @?/sqlpatch/1234/catpostdeinstall.sql – PSU
Sql> @?/sqlpatch/1234/catCPUdeinstall.sql – CPU
For Binaries
$ /opt/…(OH)/OPatch/opatch rollback 1234
:Y–enter –Y: