How to apply PSU patch on dataguard environment

Step-by-Step Applying PSU Patch :

1.Download the latest Opatch Tool and latest patch from My Oracle Support.
p28163133_122010_Linux-x86-64.zip —>PSU patch
p6880880_122010_Linux-x86-64.zip —>Opatch

Review readme file on Patch 28163133.

2.Copy the patch and Opatch to the both DB Servers(PRIMARY AND STANDBY):
mkdir -p /oradata01/PRIMARY/PATCH_MAY
mkdir -p /oradata01/STANDBY/PATCH_MAY
ls -ltr
-rwxrw-rw- 1 oracle dba 271289497 Sep 21 18:52 p28163133_122010_Linux-x86-64.zip
-rwxrw-rw- 1 oracle dba 99183505 Sep 22 00:51 p6880880_122010_Linux-x86-64.zip

3.Unzip both files in both servers(PRIMARY AND STANDBY):
unzip p28163133_122010_Linux-x86-64.zip
unzip p6880880_122010_Linux-x86-64.zip
ls -ltr
drwxr-xr-x 5 oracle dba 4096 May 18 17:14 28163133
drwxr-x— 14 oracle dba 4096 May 18 17:14 OPatch
-rwxrw-rw- 1 oracle dba 271289497 Sep 21 18:52 p28163133_122010_Linux-x86-64.zip
-rwxrw-rw- 1 oracle dba 99183505 Sep 22 00:51 p6880880_122010_Linux-x86-64.zip
-rw-r–r– 1 oracle dba 293839 May 18 17:14 PatchSearch.xml

4.Take Backup of both ORACLE_HOME(PRIMARY AND STANDBY):

cd $ORACLE_HOME
cd ..
tar -cvf /oradata01/PRIMARY/PATCH_MAY/app.tar app/
tar -cvf /oradata01/STANDBY/PATCH_MAY/app.tar app/

5.Check the inventory details (PRIMARY AND STANDBY):

$ORACLE_HOME/OPatch/opatch lsinventory

6.Check Patch status before apply using below query(PRIMARY):

SET linesize 200
Set pagesize 200
col action_time FOR a20
col version FOR a10
col comments FOR a20
col action FOR a15
col namespace FOR a10
Col BUNDLE_SERIES for a15
SELECT PATCH_ID,ACTION,STATUS,ACTION_TIME,DESCRIPTION FROM dba_registry_sqlpatch;

If dba_registry not updated then run the following:

cd $ORACLE_HOME/OPatch
./datapatch -verbose

7.Check dba_registry status (PRIMARY):

set lin 200
col COMPONENT for a30
SELECT comp_name component, version, status FROM dba_registry;

8.Check the invalid object status and run utlrp(PRIMARY):

col owner for a20
col OBJECT_NAME for a30
set lin 200
SELECT DISTINCT object_name, object_type, owner FROM dba_objects
WHERE status=’INVALID’
ORDER BY owner, object_name, object_type;

@$ORACLE_HOME/rdbms/admin/utlrp.sql

9.Check the de details on both(PRIMARY AND STANDBY):

select status,instance_name,database_role,open_mode from v$database,v$Instance;

10.Run dgmgrl command on any server and DISABLE FAST_START FAILOVER(PRIMARY/STANDBY):

dgmgrl /
connect sys/”PASSWORD”@PRIMARYDB
or,
connect sys/”PASSWORD”@STANDBYDB
show configuration

DISABLE FAST_START FAILOVER;
disable configuration;
enable configuration;
show configuration;

11.Shutdown STANDBY Database and Listener
. oraenv
DBNAME
select name,open_mode,database_role from v$database;
select process,status,thread#,sequence# from v$managed_standby;
alter database recover managed standby database cancel;
shu immediate;
lsnrctl stop STANDBY

12.Check the OPatch version and Replace the latest OPatch if needed:

$ORACLE_HOME/OPatch/opatch version

cd /oradata01/STANDBY/PATCH_MAY
mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch_old
cp -r OPatch $ORACLE_HOME/
$ORACLE_HOME/OPatch/opatch version

13.Check the Conflict Apply PSU patch on ORACLE_HOME:

cd /oradata01/STANDBY/PATCH_MAY/28163133
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
$ORACLE_HOME/OPatch/opatch apply -report
$ORACLE_HOME/OPatch/opatch apply -report
$ORACLE_HOME/OPatch/opatch apply

14.Check the inventory details:

$ORACLE_HOME/OPatch/opatch lsinv

15.start the database and listener:
. oraenv
STANDBY
lsnrctl start STANDBY
sqlplus “/as sysdba”
startup mount;

16.Check if primary and standby are in sync:

archive log list; (primary)
select process,status,thread#,sequence# from v$managed_standby; (standby)

17.Run dgmgrl command to switchover :

dgmgrl /
connect sys/”PASSWORD”@PRIMARYDB
or,
connect sys/”PASSWORD”@STANDBYDB

DGMGRL> show configuration;

Configuration – DG_CONFIG

Protection Mode: MaxPerformance
Members:
PRIMARY – Primary database
STANDBY – Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS (status updated 34 seconds ago)

dgmgrl >switchover to ‘STANDBY’;

18.Shutdown the standby database and listener:
. oraenv
STANDBY
lsnrctl stop STANDBY
sqlplus “/as sysdba”
shu immediate;

19.Check the OPatch version and Replace the latest OPatch if needed:

$ORACLE_HOME/OPatch/opatch version

cd /oradata01/STANDBY/PATCH_MAY
mv $ORACLE_HOME/OPatch $ORACLE_HOME/OPatch_old
cp -r OPatch $ORACLE_HOME/
$ORACLE_HOME/OPatch/opatch version

20.Check the Conflict Apply PSU patch on ORACLE_HOME:

cd /oradata01/STANDBY/PATCH_MAY/28163133
$ORACLE_HOME/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -ph ./
$ORACLE_HOME/OPatch/opatch apply -report
$ORACLE_HOME/OPatch/opatch apply -report
$ORACLE_HOME/OPatch/opatch apply

21.Check the inventory details:

$ORACLE_HOME/OPatch/opatch lsinv

22.Startup the Database and Listener:

. oraenv
STANDBY
startup mount;
lsnrctl start standby;

23.Run dgmgrl command to switchover :

dgmgrl /
connect sys/”PASSWORD”@PRIMARYDB
or,
connect sys/”PASSWORD”@STANDBYDB

DGMGRL> show configuration;

Configuration – DG_CONFIG

Protection Mode: MaxPerformance
Members:
STANDBY – Primary database
PRIMARY – Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS (status updated 34 seconds ago)

dgmgrl >switchover to ‘PRIMARY’;

24.Startup the standby database and listener:
. oraenv
STANDBY
lsnrctl start STANDBY
sqlplus “/as sysdba”
startup mount;

25.Run datapatch command in primary:

cd $ORACLE_HOME/OPatch
./datapatch -verbose

26.Check the DBA_REGISTRY_SQLPATCH (PRIMARY):

SET linesize 200
Set pagesize 200
col action_time FOR a20
col version FOR a10
col comments FOR a20
col action FOR a15
col namespace FOR a10
Col BUNDLE_SERIES for a15
SELECT PATCH_ID,ACTION,STATUS,ACTION_TIME,DESCRIPTION FROM dba_registry_sqlpatch;

27.Check dba_registry status (PRIMARY):

set lin 200
col COMPONENT for a30
SELECT comp_name component, version, status FROM dba_registry;

28.Check the invalid object status and run utlrp(PRIMARY):

col owner for a20
col OBJECT_NAME for a30
set lin 200
SELECT DISTINCT object_name, object_type, owner FROM dba_objects
WHERE status=’INVALID’
ORDER BY owner, object_name, object_type;

@$ORACLE_HOME/rdbms/admin/utlrp.sql

29.Check opatch lsinventory and list of patches applied in ORACLE_HOME

$ORACLE_HOME/OPatch/opatch lsinventory

30.Enable FAST_START FAILOVER:

dgmgrl /
connect sys/”PASSWORD”@PRIMARYDB
or,
connect sys/”PASSWORD”@STANDBYDB
show configuration
ENABLE FAST_START FAILOVER;
show configuration;

31.Perform remote connectivity and basic sanity of the database:

sqlplus udpm@DBNAME
PASSWORD

Leave a Reply