- ANKUSH THAVALI
- 27 Sep, 2023
- 0 Comments
- 3 Mins Read
How To Apply PSU Patch On Standby Database
How To Apply Psu Patch On Standby Database ?
To apply psu patch on  physical standby database, 1st we need to appy patch on standby, and then on primary. Below are the steps.
P.S. Download patch from Oracle Support.Â
1.Check the database_role for both database :Â
On Primary, SQL> select database_role from v$database; DATABASE_ROLE ---------------- PRIMARY On Standby , SQL> select database_role from v$database; SDATABASE_ROLE ---------------- PHYSICAL STANDBY
On Primary , check log gap between primary and standby ( it should be zero).
On Primary , SQL>select LOG_ARCHIVED-LOG_APPLIED "LOG_GAP" from (SELECT MAX(SEQUENCE#) LOG_ARCHIVED FROM V$ARCHIVED_LOG WHERE DEST_ID=1 AND ARCHIVED='YES'), (SELECT MAX(SEQUENCE#) LOG_APPLIED FROM V$ARCHIVED_LOG WHERE DEST_ID=2 AND APPLIED='YES'); LOG_GAP ------ 0
3. Disable Shipping on Primary :Â
On PRIMARY SQL> alter system set log_archive_dest_state_2=defer; System altered.
4. CANCEL THE RECOVERY ON STANDBY.
On STANDBY SQL> alter database recover managed standby database cancel; databas altered.
5. Shutdown the listener and database at standby:
On STANDBY SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. STANDBY$ lsnrctl stop
6. Go to the patch location in standby and unzip it.
On Standby standby$ cd /u01/app/PATCH standby$ unzip p16056266_11203_linux.zip standby$cd 16056266 STANDBY$pwd u01/app/PATCH/16056266
7. Check the patch conflict with ORACLE_HOME.
STANDBY$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./ Oracle Interim Patch Installer version 11.2.0.3 Copyright (c) 2015, Oracle Corporation. All rights reserved. PREREQ session Oracle Home : /home/oracle/app/oracle/product/11.2.0/dbhome_1 Oracle Home Inventory : /home/oracle/app/oracle/product/11.2.0/dbhome_1/sainventory OPatch version : 11.2.0.3 Product information : n/a Log file location : /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2015-07-29_08-55-45AM_1.log Patch history file: /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch_history.txt Invoking prereq "checkconflictagainstohwithdetail" Prereq "checkConflictAgainstOHWithDetail" passed. OPatch succeeded.
8. Now apply the patch(on standby)
node2$ cd /u01/app/PATCH/16056266 node2$ $ORACLE_HOME/OPatch/opatch apply
9. Start the standby database in mount state and start the listener
node2$ lsnrctl start SQL> startup mount
10. Now shutdown the database and listener in primary.
node1$ lsnrctl stop SQL> shutdown immediate;
11. Go to patch location and unzip the patch.
primary$ cd /u01/app/PATCH primary$ cd /u01/app/PATCH primary$ unzip p16056266_11203_linux.zip primary$ cd 16056266 primary$ pwd /u01/app/PATCH/16056266 $ unzip p16056266_11203_linux.zip primary$ cd 16056266 PRIMRAY$ pwd /u01/app/PATCH/16056266
12. Check the patch conflict with ORACLE_HOME.
NODE1$ $ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./ Oracle Interim Patch Installer version 11.2.0.3 Copyright (c) 2015, Oracle Corporation. All rights reserved. PREREQ session Oracle Home : /home/oracle/app/oracle/product/11.2.0/dbhome_1 Oracle Home Inventory : /home/oracle/app/oracle/product/11.2.0/dbhome_1/sainventory OPatch version : 11.2.0.3 Product information : n/a Log file location : /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch2015-07-29_08-55-45AM_1.log Patch history file: /home/oracle/app/oracle/product/11.2.0/dbhome_1/cfgtoollogs/opatch/opatch_history.txt Invoking prereq "checkconflictagainstohwithdetail" Prereq "checkConflictAgainstOHWithDetail" passed. OPatch succeeded.
13. Now apply the patch on primary.
NODE1$ cd /u01/app/PATCH/16056266 NODE1$ $ORACLE_HOME/OPatch/opatch apply
14. Now start the database and listener.
NODE1$ lsnrctl start SQL> startup ORACLE instance started. Total System Global Area 684785664 bytes Fixed Size 2229640 bytes Variable Size 222300792 bytes Database Buffers 457179136 bytes Redo Buffers 3076096 bytes Database mounted. Database opened.
15. Enable archive shipping in primary
SQL> alter system set log_archive_dest_state_2=enable; System altered.
16. Start the recovery(MRP) on standby:
NODE2> select PROCESS,CLIENT_PROCESS,THREAD#,SEQUENCE#,BLOCK# from v$managed_standby where process = 'MRP0' or client_process='LGWR'; PROCESS CLIENT_P THREAD# SEQUENCE# BLOCK# --------- -------- ---------- ---------- ---------- RFS LGWR 1 37628 1358 STANDBY> alter database recover managed standby database disconnect; Database altered.
17. Run the catbundle.sql script from PRIMARY.
SQL>@$ORACLE_HOME/rdbms/admin/catbundle.sql psu apply
18. Check the registry history in primary( this patch should be listed there).
SQL> SELECT * FROM DBA_REGISTRY_HISTORY;