MPatcher

Mike's Patcher

TODO

MPatcher aims to automate Oracle patching (Release Updates). This page includes a reference for the various scripts that make up the tool.

Install

Patcher should be installed in /u01/dba/patcher.

It relies on the following variables from .profile/.bash_profile...

P_OS

PTAR

..and expects the following alias script to be called...

. /u01/dba/patcher/.alias

Add aliases to /u01/dba/patcher/.alias to quickly switch between ORACLE_SIDs on the same server (if necessary)... Examples called ORCL1, ORCL2, ORCL3 and ORCL4 are included for reference. E.g.

alias ORCL1='. /home/oracle/.bash_profile.ORCL1'

Create missing patch variable files in /u01/dba/patcher/var.

The following lines should be in /etc/sudoers...

## Allow oracle to run /u01/dba/patcher/perms.sh as root

oracle   localhost = (root) NOPASSWD: /u01/dba/patcher/perms.sh

Command Reference

checkreg

Queries patch information from registry$patch. 

checkreg


ACTION_TIME                      PATCH_ID DESCRIPTION

------------------------------ ---------- ------------------------------------------------------------

27-APR-20 13.53.23.280012        30805580 OJVM RELEASE UPDATE 12.2.0.1.200414

27-APR-20 13.53.26.453299        30886680 DATABASE APR 2020 RELEASE UPDATE 12.2.0.1.200414

27-APR-20 16.11.55.612517        30805580 OJVM RELEASE UPDATE 12.2.0.1.200414

27-APR-20 16.11.59.149423        30886680 DATABASE APR 2020 RELEASE UPDATE 12.2.0.1.200414

pvars [set]

Prints patch variables used by Patcher.

pvars

     Target Version: 122010

       Combo Patch#: 30783641

 DB Release Update#: 30886680

JVM Release Update#: 30805580

If you run pvars with the "set" argument it reads from the latest file matching the Target version in /u01/dba/patcher/var and sets the variables.

Configuration

.profile/.bash_profile

# DBA Patch Variables


case $(uname) in

  AIX)   export P_OS=AIX64-5L

         export AIXTHREAD_SCOPE=S

         ;;

  Linux) export P_OS=Linux-x86-64

         ;;

esac

export PATCH_SERVE=mylms001        # Local Management Server

export PTAR=122010                 # This is the number that appears in patch download files


. /u01/dba/patcher/.alias          # Set aliases (used to simplify patching)

/u01/dba/patcher/.alias

alias menu='/home/oracle/menu.sh'


alias applyoff='/u01/dba/patcher/apply.sh off'

alias applyon='/u01/dba/patcher/apply.sh on'

alias applystat='/u01/dba/patcher/apply.sh stat'

alias applylag='/u01/dba/patcher/apply.sh lag'


alias dbopenresetlogs='sqlplus -s / as sysdba @/u01/dba/patcher/sql/dbopenresetlogs.sql'

alias dbmount='sqlplus -s / as sysdba @/u01/dba/patcher/sql/dbmount.sql'

alias dbstart='sqlplus -s / as sysdba @/u01/dba/patcher/sql/dbstart.sql'

alias dbupgrd='sqlplus -s / as sysdba @/u01/dba/patcher/sql/dbstartupg.sql'

alias dbshut='sqlplus -s / as sysdba @/u01/dba/patcher/sql/dbshutdown.sql'

alias checkreg='sqlplus -s / as sysdba @/u01/dba/patcher/sql/checkreg.sql'

alias grpset='sqlplus -s / as sysdba @/u01/dba/patcher/sql/grpset.sql "Patch_${PCOM}"'

alias grpdrop='sqlplus -s / as sysdba @/u01/dba/patcher/sql/grpdrop.sql "Patch_${PCOM}"'

alias grpshow='sqlplus -s / as sysdba @/u01/dba/patcher/sql/grpshow.sql'

alias grpfback='sqlplus -s / as sysdba @/u01/dba/patcher/sql/grpfback.sql "Patch_${PCOM}"'

alias invobjcnt='sqlplus -s / as sysdba @/u01/dba/patcher/sql/invobjcnt.sql'

alias invobjowncnt='sqlplus -s / as sysdba @/u01/dba/patcher/sql/invobjowncnt.sql'

alias invobjown='sqlplus -s / as sysdba @/u01/dba/patcher/sql/invobjown.sql'

alias invobj='sqlplus -s / as sysdba @/u01/dba/patcher/sql/invobj.sql'

alias listlist='ps -ef | grep tnslsnr | grep -v grep | awk '\''{ print $5, $8, $9 }'\'''

alias lsinv='opatch lsinventory | grep -E "${RJVM}|${DBRU}"'

alias opdbru='/u01/dba/patcher/opapply.sh dbru'

alias opojvm='/u01/dba/patcher/opapply.sh ojvm'

alias perms='sudo /u01/dba/patcher/perms.sh'

alias pvars='. /u01/dba/patcher/pvars.sh'

alias prereq='/u01/dba/patcher/prereq.sh'

alias showlist='lsnrctl stat ${LISTENER_NAME}'

alias startlist='lsnrctl start ${LISTENER_NAME}'

alias stoplist='lsnrctl stop ${LISTENER_NAME}'


alias ORCL1='. ~/.bash_profile.ORCL1'

alias ORCL2='. ~/.bash_profile.ORCL2'

alias ORCL3='. ~/.bash_profile.ORCL3'

alias ORCL4='. ~/.bash_profile.ORCL4'