Sunday, June 13, 2021

Oracle Home Patching Steps + Post Patching Database (datapatch) Steps - April 2021 CPU/SPU

 DB Home patching:

=================

1) Stop DB Home as root user

ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1  /u01/app/oracle/product/19.0.0.0/dbhome_1/bin/srvctl stop home -o /u01/app/oracle/product/19.0.0.0/dbhome_1 -s /u01/patches/dbhome_1.state -n oraclerac1

2) grant permision on patch directory as root user

chown -R oracle:oinstall /u01/patches/

3) As oracle user do prechks 

su - oracle
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch version
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch lspatches
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch lsinv |grep applied
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch lsinv |grep desc
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch lspatches -oh /u01/app/oracle/product/19.0.0.0/dbhome_1

Conflict pre checks:

/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patches/PSU/32545008/32545013 -oh /u01/app/oracle/product/19.0.0.0/dbhome_1
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patches/PSU/32545008/32579761 -oh /u01/app/oracle/product/19.0.0.0/dbhome_1

System space prechk:

/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch prereq CheckSystemSpace -phBaseDir /u01/patches/PSU/32545008/32545013 -oh /u01/app/oracle/product/19.0.0.0/dbhome_1
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch prereq CheckSystemSpace -phBaseDir /u01/patches/PSU/32545008/32579761 -oh /u01/app/oracle/product/19.0.0.0/dbhome_1

4) Apply Patch:

/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch apply -oh /u01/app/oracle/product/19.0.0.0/dbhome_1 -silent /u01/patches/PSU/32545008/32545013
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch apply -oh /u01/app/oracle/product/19.0.0.0/dbhome_1 -silent /u01/patches/PSU/32545008/32579761

5) Post verification

/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch lspatches
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch lsinv |grep applied
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch lsinv |grep desc
/u01/app/oracle/product/19.0.0.0/dbhome_1/OPatch/opatch lspatches -oh /u01/app/oracle/product/19.0.0.0/dbhome_1

6) Start ORACLE_HOME as root user

ORACLE_HOME=/u01/app/oracle/product/19.0.0.0/dbhome_1  /u01/app/oracle/product/19.0.0.0/dbhome_1/bin/srvctl start home -o /u01/app/oracle/product/19.0.0.0/dbhome_1 -s /u01/patches/dbhome_1.state -n oraclerac1


Database Patching:

==================

1) Do database prechks

column comp_name format a40
column version format a12
column status format a15
select comp_name,version,status from dba_registry;
column owner format a15
column object_name format a40
column object_type format a20
select owner, object_name, object_type from dba_objects where status='INVALID' and owner like '%SYS%' order by object_type,owner,object_name;
COLUMN NAME FORMAT A15
COLUMN RESTRICTED FORMAT A10
COLUMN OPEN_TIME FORMAT A30
SELECT NAME, OPEN_MODE, RESTRICTED, OPEN_TIME FROM V$PDBS;
set LINES 200
COLUMN action_time FORMAT A20
COLUMN action FORMAT A20
COLUMN namespace FORMAT A20
COLUMN version FORMAT A10
COLUMN comments FORMAT A30
COLUMN bundle_series FORMAT A10
select name,open_mode,database_role from gv$database;
select PATCH_ID, VERSION, ACTION, BUNDLE_ID, STATUS from dba_registry_sqlpatch order by ACTION_TIME;
select owner, object_name, object_type from dba_objects where status='INVALID' and owner like '%SYS%' order by object_type,owner,object_name;
select comp_id,comp_name,version,status from dba_registry;
select name, cause, type, message, status from pdb_plug_in_violations where type = 'ERROR' and status !='RESOLVED' order by name, time;
select INST_ID,CON_ID,NAME,RESTRICTED,OPEN_MODE from gV$CONTAINERS;
@?/rdbms/admin/utlprp.sql 16

2) Run the database post steps

cd $ORACLE_HOME/OPatch
./datapatch -verbose

3) Verify the database post steps

set pagesize 20;
set linesize 200;
col ACTION_TIME format a30;
col DESCRIPTION format a50;
select PATCH_ID,BUNDLE_ID,BUNDLE_SERIES,status from dba_registry_sqlpatch;

Regards,
Mallik

No comments:

Post a Comment

Automation Script | Archivelog Generation Hourly Monitoring

1. List out all the running databases and pic one database where we want to monitore the archive log generation from last 1 month. [oracle@o...