To apply psu patch on physical standby database setup, 1st patch need to be applied on standby, and then on primary. Below are the steps. Download patch from oracle support.
- Check the database_role for both dbs
PRIMARY> select database_role from v$database;
DATABASE_ROLE
—————-
PRIMARY
STANDBY> select database_role from v$database;
SDATABASE_ROLE
—————-
PHYSICAL STANDBY
2.Run below in primary to check log gap between primary and standby ( it should be zero)
PRIMARY >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
PRIMARY> alter system set log_archive_dest_state_2=defer; System altered.
4. CANCEL THE RECOVERY ON STANDBY
STANDBY> alter database recover managed standby database cancel; databas altered.
Shutdown the listener and database in standby:
STANDBY > shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. STANDBY$ lsnrctl stop LISTENER_STBY
Go to the patch location in standby and unzip it.
STANDBY$ cd /u01/app/JUN15_PATCH STANDBY$ unzip p16056266_11203_linux.zip STANDBY$cd 16056266 STANDBY$pwd u01/app/JUN15_PATCH/16056266
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.
Now apply the patch(on standby)
STANDBY$ cd /u01/app/JUN15_PATCH/16056266 STANDBY$ $ORACLE_HOME/OPatch/opatch apply
Start the standby database in mount state and start the listener
STANDBY$ lsnrctl start STANDBY> startup mount
Now shutdown the database and listener in primary
PRIMARY$ lsnrctl stop LISTENER_PROD PRIMARY > shutdown immediate;
Go to patch location and unzip the patch
PRIMRAY$ cd /u01/app/JUN15_PATCH PRIMRAY$ unzip p16056266_11203_linux.zip PRIMRAY$ cd 16056266 PRIMRAY$ pwd /u01/app/JUN15_PATCH/16056266
Check the patch conflict with ORACLE_HOME
PRIMRAY$ $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.
Now apply the patch on primary
PRIMRAY$ cd /u01/app/JUN15_PATCH/16056266 PRIMRAY$ $ORACLE_HOME/OPatch/opatch apply
Now start up open the database and listener.
PRIMRAY$ lsnrctl start LISTENER_PROD PRIMARY > 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.
Enable archive shipping in primary
PRIMARY> alter system set log_archive_dest_state_2=enable; System altered.
Start the recovery(MRP) on standby:
STANDBY> 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.
Run the catbundle.sql script from PRIMARY
PRIMARY > @$ORACLE_HOME/rdbms/admin/catbundle.sql psu apply
Check the registry history in primary( this patch should be listed there)
PRIMARY> SELECT * FROM DBA_REGISTRY_HISTORY;
why on standby first, anyhow you are stopping primary
In this we can apply standby first because after we can perform switchover to minimize the downtime
But you did not switchover
because it’s related to patching only