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/mpatcher.
It relies on the following variables from .profile/.bash_profile...
P_OS
PTAR
..and expects the following alias script to be called at the end of .profile/.bash_profile...
. /u01/dba/mpatcher/.alias
Add aliases to /u01/dba/mpatcher/.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/mpatcher/var.
The following lines should be in /etc/sudoers...
## Allow oracle to run /u01/dba/mpatcher/perms.sh as root
oracle localhost = (root) NOPASSWD: /u01/dba/mpatcher/perms.sh
Command Reference
Queries patch information from registry$patch.
checkreg
Returns the total number of invalid objects in the database.
invobjcnt
Runs opatch prereq checks
prereq
Prints/sets patch variables used by MPatcher.
pvars
It reads from the latest file matching the Target version in /u01/dba/patcher/var and sets the variables.Configuration
.profile/.bash_profile
case $(uname) in AIX) export P_OS=AIX64-5L export AIXTHREAD_SCOPE=S ;; Linux) export P_OS=Linux-x86-64 ;;esacexport PATCH_SERVE=mylms001 # Local Management Serverexport 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 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 bostart='${EMAGENT_HOME}/bin/emctl start blackout Patch_${PCOM} -nodeLevel'alias bostop='${EMAGENT_HOME}/bin/emctl stop blackout Patch_${PCOM}'alias bostat='${EMAGENT_HOME}/bin/emctl status blackout'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'