Total Pageviews

Apply PSU patch in RAC database with physical standby database in place

Scope:

This post explains steps to "Apply PSU patch" on database with Physical standby.



1. Disable the log shipping from primary database to the standby database.

   SQL> alter system set log_archive_dest_state_2=defer;

2. Cancel the Media Recovery 
   
   SQL> alter database recover managed standby database cancel;

Note: First Patch standby and then primary database.

---  Patching Standby starts here ---
3. Stop standby database and other resources from the DB home of standby database.
3.1 If database is configured on RAC 
  
    $ srvctl stop database -d <standby DB name>
    $ lsnrctl stop <listener_name>

 3.2 If database is not on RAC

    $ export ORACLE_HOME=<path to database home>
    $ export ORACLE_SID=<SID_name>
    $ sqlplus "/ as sysdba"
    SQL> shutdown immediate;
          SQL> exit;
    
    $ lsnrctl stop <listener_name>

4. Check opatch version and opatch output - opatch lsinventory should complete (in case of RAC, output should be run on all nodes) 

    $ export ORACLE_HOME=<path to database home>

    $ export ORACLE_SID=<SID_name>
    $ opatch version (Check required opatch version for this PSU patch, from readme file  available in patch direcoty)
    $ opatch lsinventory

5. Check if the patch is conflicting with existing patches

$ opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir <path to direcroty where patch is unzipped>

6. Go to the directory where patched is unzipped.

   $ cd <path to direcroty where patch is unzipped>
   $ opatch apply <path to direcroty where patch is unzipped>
   $.
   $. ... <output is truncated here> ...
   $.
   $ Do you wish to remain uninformed of security issues ([Y]es,          [N]o) [N]: Y
   $ Is the local system ready for patching? [y|n] Y

Note: If standby database is configured on RAC, one by one, perform step 3,4,5 on other nodes 

7. Here database home (in case of RAC, on all nodes are patched successfully).

7.1 Start  physical standby database in mount state. 

Note: Do not start the recovery and also do not open database in read only mode.


7.2 Start database 

   $ srvctl start database -d <standby DB name> -o mount
   or
   $ sqlplus "/ as sysdba"
   SQL> startup mount;

7.3 Start listener

   $ lsnrctl start <listener_name>

Note: Do not run any of the post patch scripts like catbundle.sql as this is required to be run on primary side after patch is applied on primary side and logsync is enabled between primary and standby.


                                             ---  Patching Standby database Ends here ---
                                 
                                       --- Patching Primary database Starts from Here --- 

8. Go to primary database side and perform step 3,4,5,6
9. Start database and listener 

9.1 lsnrctl start <listener_name>

9.2 srvctl start database -d <Primary DB name>

10. Start the log shipping on primary side.

   SQL> alter system set log_archive_dest_state_2=enable;

11. Start media recovery on standby database.

   $ sqlplus "/ as sysdba"


  11.1 If standby database is having "Standby Redo logfiles" configured

   SQL> alter database recover managed standby database using     
        current logfile disconnect from session;


  11.2 If  "Standby Redo logfiles" are not configured.

   SQL> alter database recover managed standby database disconnect from session;


10. On Primary database, run post patch scripts (catbundle) 
   $ cd $ORACLE_HOME/rdbms/admin
   $ sqlplus "/ as sysdba"
   SQL> @catbundle.sql psu apply

11. CrossCheck the status of PSU aaplied.

   SQL> select * from registry$history order by action_time;

12. Check  the status of archive sync of standby database with primary. Once both are in sync check the status of PSU applied on standby database.
  
    SQL> select * from registry$history order by action_time;

--------------------------- The End ---------------------------


No comments:

Post a Comment