Thursday, June 4, 2020

Oracle Patching Demo|| PSU Patching || 11g Release 2 (11.2.0.4) - OPatch


Maintaining patch compliance helps ensure performance and security in your Oracle system

Why do we do patching?

-         Security

-         BUG fixes

-         New feature enhancement

-         Upgradations

-         Compliance

What all we do patching in Oracle database?

-         Grid Home/binaries (In case of Oracle RAC)

-         Oracle Home/binaries

-         Databases

What are types are patching in Oracle database?

-         Rolling Patching (Hot patching, Online Patching, Out of place patching)

-         Non-Rolling Patching

What are types re patches do Oracle has?

-         Bundle patch

-         ONEOFF patch

-         Online patch

-         Composite patch

-         Merge patching many more 

What are tolls we do use in Oracle patching?

-         OPatch (in case of Binaries)

-         Catbudle-11g & datapatch-12c (in case of database)

Note: There are other patching in Exadata, YUM patching, CELL patching, IB switch patching and other component’s patching


Master Document for downloading Latest Patches: 888828.1

BUG List:

Bug Fix List: the 11.2.0.4 Patch Bundles for Oracle Exadata Database Machine (Doc ID 1601749.1)  

 

Start with Oracle 11g Patching:

1) Prechks: 

-Patch_April2017

$ORACLE_HOME/OPatch/opatchprereqCheckConflictAgainstOHWithDetail -phBaseDir/u01/patches/25440411/24828123

$ORACLE_HOME/OPatch/opatchprereqCheckConflictAgainstOHWithDetail -phBaseDir/u01/patches/25440411/23054319/custom/server/23054319

$ORACLE_HOME/OPatch/opatchprereqCheckSystemSpace -phBaseDir/u01/patches/25440411/24828123

$ORACLE_HOME/OPatch/opatchprereqCheckSystemSpace -phBaseDir/u01/patches/25440411/23054319/custom/server/23054319


2) backup database and oracle binaries before patching and stop listener & database:

 ps -ef|grepsmon

cat /etc/oratab

ps -ef | grep agent | grep java | sed 's/\s\+/ /g' | cut -d " " -f 1,8 | sed 's/\/jdk.*//'


-- database backup

-- Oracle home binaries backup 


lsnrctl stop

lsnrctlstatus

shut immediate

 

3) Stop Agent:

 su -l oracle -c "/opt/OracleHomes/agent_home/core/12.1.0.3.0/bin/emctl stop agent"

su -l oracle -c "/opt/OracleHomes/agent_home/core/12.1.0.3.0/bin/emctl status agent"

 

4) Change the ownership of patch directory:

chown -R oracle:oinstall /u01/patches

--Place the latest Patch 6880880 


5) Create response file

/u01/app/oracle/product/11204/dbhome_1/OPatch/ocm/bin/emocmrsp -output /u01/patches/ocm.rsp 

6) Patching

/u01/patches/25440411/23054319/custom/server/23054319/custom/scripts/prepatch.sh -dbhome /u01/app/oracle/product/11204/dbhome_1

/u01/app/oracle/product/11204/dbhome_1/OPatch/opatchnapply -oh /u01/app/oracle/product/11204/dbhome_1 -local -silent -ocmrf /u01/patches/ocm.rsp /u01/patches/25440411/24828123

/u01/app/oracle/product/11204/dbhome_1/OPatch/opatchnapply -oh /u01/app/oracle/product/11204/dbhome_1 -local -silent -ocmrf /u01/patches/ocm.rsp /u01/patches/25440411/23054319/custom/server/23054319

/u01/patches/25440411/23054319/custom/server/23054319/custom/scripts/postpatch.sh -dbhome /u01/app/oracle/product/11204/dbhome_1

 

7) Oracle home patch verification

/u01/app/oracle/product/11204/dbhome_1/OPatch/opatchlspatches -oh /u01/app/oracle/product/11204/dbhome_1

 

8) Database patch

Verify which database you are connected to    

              select name from v$database;

              select database_role from v$database;

             

Check for invalid objects            

              column comp_name format a40

              column version format a12

              column status format a15

              select comp_name,version,status from dba_registry;

         

              column owner format a15

              column object_name format a40

              column object_type format a20

              select owner, object_name, object_type from dba_objects where status='INVALID' order by object_type,owner,object_name;

             

If there are a lot of invalids, this next command will list only the invalids containing SYS in the owner

              select owner, object_name, object_type from dba_objects where status='INVALID' and owner like '%SYS%' order by object_type,owner,object_name;

If there are invalids then run utlrp and check again      

              @?/rdbms/admin/utlprp.sql 16

              select comp_name,version,status from dba_registry;

              select owner, object_name, object_type from dba_objects where status='INVALID' order by object_type,owner,object_name;

 

Execute the catbundle script    

              @?/rdbms/admin/catbundle.sqlexa apply

              @?/rdbms/admin/utlprp.sql 8

             

Check invalids again     

              select comp_name,version,status from dba_registry;

              select owner, object_name, object_type from dba_objects where status='INVALID' order by object_type,owner,object_name;


9) Database patch verification:

Check that the apply finished successfully            

              select * from dba_registry_history;


col ACTION for a20

col NAMESPACE for a20

col VERSION for a30

col BUNDLE_SERIES for a20

col COMMENTS for a50

select * from dba_registry_history;

 

Regards

Mallik


2 comments:

Automation Script | Archivelog Generation Hourly Monitoring

1. List out all the running databases and pic one database where we want to monitore the archive log generation from last 1 month. [oracle@o...