How to apply patch in oracle step by step 19c on Linux/AIX
Description:
In this article we are going to see steps used to apply the Patch on Oracle 19c Database in Linux/AIX.
Environment is single instance database.
Prerequisites:
Step 1. Take full database RMAN backup:
$ rman target /
run
{
allocate channel disk1 device type disk;
allocate channel disk2 device type disk;
allocate channel disk3 device type disk;
allocate channel disk4 device type disk;
allocate channel disk5 device type disk;
crosscheck archivelog all;
delete expired archivelog all;
backup current controlfile format '/u01/backup/ORCL_control_%d_%D_%M_%Y_%U.bkp';
backup as compressed backupset database format '/u01/backup/ORCL_rman_%d_%D_%M_%Y_%U.bkp';
backup as compressed backupset archivelog all format '/u01/backup/ORCL_Arch_%U.archbkp';
backup spfile format '/u01/backup/ORCL_spfile_%U';
release channel disk1;
release channel disk2;
release channel disk3;
release channel disk4;
release channel disk5;
}
Step 2. Take Oracle Home Backup:
$ cd $ORACLE_HOME
$ tar -cvf oracle_home_<date>.tar $ORACLE_HOME
Step 3. Check invalid objects:
SQL> select count(*) from dba_objects where status='INVALID';
SQL> select owner,count(*) from dba_objects where status='INVALID' group by owner;
Step 4. Check dba_registry:
SQL> col DESCRIPTION for a60
SQL> col ACTION_TIME for a30
SQL> select INSTALL_ID, PATCH_ID, PATCH_UID, ACTION, ACTION_TIME, DESCRIPTION from dba_registry_sqlpatch;
SQL> col comp_name for a40
SQL> col comp_id for a15
SQL> col status for a10
SQL> col version for a15
SQL> select comp_id, version, comp_name, status from dba_registry;
Step 5. Check OPatch details:
$ cd $ORACLE_HOME/OPatch
$ ./opatch version
$ ./opatch lsinventory
$ ./opatch lspatches
Step 6. Check the Current Database Version:
SQL> select banner_full from v$version;
Patching Steps:
Step 1. Stop Database Services:
$ lsnrctl stop
SQL> shut immediate
Step 2. Set proper paths:
$ export ORACLE_SID=
$ export ORACLE_HOME=
$ export PATH=
Step 3. Check conflicts:
$ cd $ORACLE_HOME/OPatch
$ ./opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir /u01/patch/Patch_19.25/36912597
$ ./opatch prereq CheckSystemSpace -phBaseDir /u01/patch/Patch_19.25/36912597
$ ./opatch prereq CheckActiveFilesAndExecutables -phBaseDir /u01/patch/Patch_19.25/36912597
Step 4. Apply the Patch if no issues found in prechecks:
$ cd /u01/patch/Patch_19.25/36912597
$ /u01/app/oracle/product/19c/19c_home/OPatch/opatch apply
Step 5. Start Database Services:
SQL> startup
$ lsnrctl start
Post Steps:
Step 1. Run datapatch -verbose:
$ cd $ORACLE_HOME/OPatch
$ ./datapatch -verbose
Step 2. Compile the invalid objects:
SQL> @?/rdbms/admin/utlrp.sql
Step 3. Verify the patch:
$ cd $ORACLE_HOME/OPatch
$ ./opatch lsinventory
$ ./opatch lspatches
Step 4. Check dba registry:
SQL> col DESCRIPTION for a60
SQL> col ACTION_TIME for a30
SQL> select INSTALL_ID, PATCH_ID, PATCH_UID, ACTION, ACTION_TIME, DESCRIPTION from dba_registry_sqlpatch;
SQL> col comp_name for a40
SQL> col comp_id for a15
SQL> col status for a10
SQL> col version for a15
SQL> select comp_id, version, comp_name, status from dba_registry;
Step 5. Check invalid objects:
SQL> select count(*) from dba_objects where status='INVALID';
SQL> select owner,count(*) from dba_objects where status='INVALID' group by owner;
