Oracle RU (MPatcher)

Prepare

If MPatcher is already configured you don't need to do it again.
Must be set on every server for every patch

checkreg     # Check which patches are applied already

invobjcnt    # Fix and investigate any invalid objects

pvars        # Set/Check Patch Variables

prereq       # Investigate any errors (note any Conflicts that need to be rolled back)

Apply

Phsyical Standby Instance(s)

Skip this section if you do not have any physical standby instances

Set environment. e.g.

ORCL2

Stop any applications that are connecting to this instance (if any).

pvars        # Set/Check Patch Variables

bostart      # Start OEM Blackout

applyoff     # Stop Apply

grpset       # Set Guaranteed Restore Point

stoplist     # Stop Listener

dbshut       # Stop Instance

             # Rollback Conflicts (if necessary)

opdbru       # Apply Database Patch

opojvm       # Apply OJVM Patch

             # Apply Merge/Other patches (if necessary)

lsinv        # Check patches are applied

dbmount      # Mount database

             # Upgrade RMAN Catalog (if necessary)

startlist    # Start Listener

perms        # File permissions

Start any client applications that are connecting to this instance (if any).

To run this is a single command, with fail on any error, use...

date && ORCL2 && applyoff && grpset && stoplist && dbshut && opdbru && opojvm && lsinv && dbmount && startlist && perms && date

Primary Database Instance

Set environment. e.g.

ORCL1

Stop all applications that are connecting to this instance.

pvars        # Set/Check Patch Variables

grpset       # Set Guaranteed Restore Point

grpshow      # Show Guaranteed Restore Point

bostart      # Start OEM Blackout

bostat       # Show OEM Blackout Status

stoplist     # Stop Listener

dbshut       # Stop Instance

             # Rollback Conflicts (if necessary)

opdbru       # Apply Database Patch to ORACLE_HOME

opojvm       # Apply OJVM Patch to ORACLE_HOME

             # Apply Merge/Other patches (if necessary)

lsinv        # Check patches are applied

dbupgrd      # Start Database Instance in Upgrade mode

datapatch    # Apply Patch(es) to Database

dbshut       # Stop Instance

dbstart      # Start Database Instance in Normal mode

             # Upgrade RMAN Catalog (if necessary)

perms        # File permissions

invobjcnt    # Fix and investigate any invalid objects

checkreg     # Check Patch Registry

startlist    # Start Listener

bostop       # Stop OEM Blackout

To run this is a single command, with fail on any error, use...

date && ORCL1 && grpset && stoplist && dbshut && opdbru && opojvm && lsinv && dbupgrd && datapatch && dbshut && dbstart && perms && invobjcnt && checkreg && startlist && date

Finish

Start any client applications that are connecting to this instance (if any).

For each standby database. Set environment e.g.

ORCL2

applyon      # Start Apply

Test all databases (Primary and Standby), wait for Standby databases to resync, review alert logs etc...

applylag     # Report Apply Lag

bostop       # Stop OEM Blackout

grpdrop      # Drop Guaranteed Restore Point (only when you are happy all is working)

grpshow      # Check Guaranteed Restore Point has gone

For Primary database. Set environment e.g.

ORCL1

grpdrop      # Drop Guaranteed Restore Point (only when you are happy all is working)

grpshow      # Check Guaranteed Restore Point has gone

Flashback


NOTE: Using a Guaranteed Restore Point allows you to rollback the patches quickly but DOES RESULT IN DATA LOSS if users have performed any DML after patching is complete. NOTE: To avoid data loss use the Rollback procedure.

Phsyical Standby Instance(s)

Set environment. e.g.

ORCL2

Stop any applications that are connecting to this instance (if any).

pvars                                 # Set/Check Patch Variables

bostart                               # Start OEM Blackout

stoplist                              # Stop Listener

dbshut                                # Stop Instance

opatch rollback -id ${DBRU} -silent   # Rollback DB RU Patch from ORACLE_HOME

opatch rollback -id ${RJVM} -silent   # Rollback OJVM Patch from ORACLE_HOME

dbmount                               # Mount database

startlist                             # Start Listener

applyoff                              # Set Apply Off

grpfback                              # Flashback to Guaranteed Restore Point

perms                                 # File permissions

To run this is a single command, with fail on any error, use...

date && ORCL2 && stoplist && dbshut && opatch rollback -id ${DBRU} -silent && opatch rollback -id ${RJVM} -silent && dbmount && startlist && applyoff && grpfback && perms && date

Primary Database Instance

Set environment. e.g.

ORCL1

Stop all applications that are connecting to this instance.

pvars                                 # Set/Check Patch Variables

bostart                               # Start OEM Blackout

stoplist                              # Stop Listener

dbshut                                # Stop Instance

opatch rollback -id ${DBRU} -silent   # Rollback DB RU Patch from ORACLE_HOME

opatch rollback -id ${RJVM} -silent   # Rollback OJVM Patch from ORACLE_HOME

dbstart                               # Start Database Instance in Normal mode

startlist                             # Start Listener

grpfback                              # Flashback to Guaranteed Restore Point

dbopenresetlogs                       # Open reset Logs

invobjcnt                             # Check Invalid Objects

perms                                 # File permissions

checkreg                              # Check Patch Registry

 bostop                               # Stop OEM Blackout

To run this is a single command, with fail on any error, use...

date && ORCL1 && stoplist && dbshut && opatch rollback -id ${DBRU} -silent && opatch rollback -id ${RJVM} -silent && dbstart && startlist && grpfback && dbopenresetlogs && invobjcnt && perms && checkreg && date

Finish

Start all client applications that are connecting to this instance.

For each standby database. Set environment e.g.

ORCL2

applyon                               # Start Apply

Test all databases (Primary and Standby), wait for Standby databases to resync, review alert logs etc...

applylag     # Report Apply Lag

bostop       # Stop OEM Blackout

grpdrop      # Drop Guaranteed Restore Point (only when you are happy all is working)

grpshow      # Check Guaranteed Restore Point has gone

For Primary database. Set environment e.g.

ORCL1

grpdrop      # Drop Guaranteed Restore Point (only when you are happy all is working)

grpshow      # Check Guaranteed Restore Point has gone

Rollback


NOTE: If you Rollback a RU then you should reapply any previous RU before restarting applications.

Physical Standby Instance(s)

Set environment. e.g.

ORCL2

Stop any applications that are connecting to this instance (if any).

pvars                                 # Set/Check Patch Variables

bostart                               # Start OEM Blackout

stoplist                              # Stop Listener

dbshut                                # Stop Instance

opatch rollback -id ${DBRU} -silent   # Rollback DB RU Patch from ORACLE_HOME

opatch rollback -id ${RJVM} -silent   # Rollback OJVM Patch from ORACLE_HOME

dbmount                               # Mount database

                                      # Upgrade RMAN Catalog (if necessary)

perms                                 # File permissions

startlist                             # Start Listener

To run this is a single command, with fail on any error, use...

date && ORCL2 && dbshut && opatch rollback -id ${DBRU} -silent && opatch rollback -id ${RJVM} -silent && dbmount && perms && startlist && date

Primary Database Instance

Set environment. e.g.

ORCL1

Stop all applications that are connecting to this instance.

pvars                                 # Set/Check Patch Variables

bostart                               # Start OEM Blackout

invobjcnt                             # Check Invalid Objects

stoplist                              # Stop Listener

dbshut                                # Stop Instance

opatch rollback -id ${DBRU} -silent   # Rollback DB RU Patch from ORACLE_HOME

opatch rollback -id ${RJVM} -silent   # Rollback OJVM Patch from ORACLE_HOME

dbupgrd                               # Start Database Instance in Upgrade mode

datapatch                             # Apply Patch(es) to Database

dbshut                                # Stop Instance

dbstart                               # Start Database Instance in Normal mode

                                      # Upgrade RMAN Catalog (if necessary)

perms                                 # File permissions

invobjcnt                             # Check Invalid Objects

checkreg                              # Check Patch Registry

startlist                             # Start Listener

bostop                                # End OEM Blackout

To run this is a single command, with fail on any error, use...

date && ORCL1 && invobjcnt && stoplist && dbshut && opatch rollback -id ${DBRU} -silent && opatch rollback -id ${RJVM} -silent && dbupgrd && datapatch && dbshut && dbstart && perms && invobjcnt && checkreg && startlist && date

Finish

Start all client applications that are connecting to this instance.

For each standby database. Set environment e.g.

ORCL2

Test all databases (Primary and Standby), wait for Standby databases to resync, review alert logs etc...

applylag     # Report Apply Lag

bostop       # End OEM Blackout

grpdrop      # Drop Guaranteed Restore Point (only when you are happy all is working)

grpshow      # Check Guaranteed Restore Point has gone

For Primary database. Set environment e.g.

ORCL1

grpdrop      # Drop Guaranteed Restore Point (only when you are happy all is working)

grpshow      # Check Guaranteed Restore Point has gone

Bibliography

Oracle Patch Assurance - Data Guard Standby-First Patch Apply (Doc ID 1265700.1)