Monday, April 3, 2017


OPatch Installation Steps 

opatch


(I) Prerequisites
--------------------

Before you install or deinstall the patch, ensure that you meet the following requirements:

1. Ensure that you shut down all the services running from the Oracle home.

2. Go through the README file for installation guides

3.      Ensure that you have OPatch 19 Release 12.2.0.1.19 or higher. Oracle recommends that you use the latest version available for  19 Release 12.2.0.1.19. 
Note:
If you do not have OPatch latest version then download it from patch# 6880880 for  19.XX or  12.XX

For information about OPatch documentation, including any known issues, see My Oracle Support Document 293369.1 OPatch documentation list:



$ cd /u01/software

$ unzip p31602782_198000DBRU_AIX64-5L.zip


Export Path
---------------

$ echo $PATH

$  echo $ORACLE_HOME
/u01/app/oracle/product/19.0.0/dbhome1

$ export PATH=$PATH:/u01/app/oracle/product/19.0.0/dbhome1/OPatch


(Only for Installation) Determine whether any currently installed interim patches conflict with this patch 31602782 as shown below:


$ cd <PATCH_TOP_DIR>/31602782

$ opatch prereq CheckConflictAgainstOHWithDetail -ph ./

-------------------------------------------------------------------------------------

(II) Installation  
-------------------
To install the patch, follow these steps: 
Shutdown  all databases and listeners running in this oracle_home

1. Set your current directory to the directory where the patch is located and then run the OPatch utility by entering the following commands:

$ cd <PATCH_TOP_DIR>/31602782

$ opatch apply

2. Verify whether the patch has been successfully installed by running the following command:

$ opatch lsinventory

3. Start the services from the Oracle home.


Postinstallation

Please go through the REAME of each patch before start Post-Installation process will be different for each patch

Perform the following postinstallation steps described in Loading Modified SQL Files Into the Database.

1.4.1 Loading Modified SQL Files Into the Database

To perform the postinstallation, follow these steps:

  1. The following steps load modified SQL files into the database.

    Datapatch is run to complete the post-install SQL deployment for the Update. For further details about Datapatch, including Known Issues and workarounds to common problems, see: Datapatch: Database 12c or later Post Patch SQL Automation (Doc ID 1585822.1).

    1. For each separate database running on the same shared Oracle home being patched, run the datapatch utility as described in the following table.

      Table 1-1 Steps to Run the Datapatch Utility for Standalone Database Versus Single or Multitenant (CDB or PDB) Database

      StepsStandalone DatabaseStepsSingle or Multitenant (CDB or PDB) Database

      1

      % sqlplus /nolog

      1

      % sqlplus /nolog

      2

      SQL> Connect / as sysdba

      2

      SQL> Connect / as sysdba

      3

      SQL> startup Footnote 1

      3

      SQL> startupFootnote 1

      4

      SQL> quit

      4

      SQL> alter pluggable database all open;Footnote 2

      5

      % cd $ORACLE_HOME/OPatch

      5

      SQL> quit

      6

      % ./datapatch -verbose

      6

      % cd $ORACLE_HOME/OPatch

      7

      % sqlplus /nolog

      7

      % ./datapatch -verbose

      8

      SQL> Connect / as sysdba

      8

      % sqlplus /nolog

      9

      SQL> shutdown

      9

      SQL> Connect / as sysdba

      10

      SQL> startupFoot 3

      10

      SQL> shutdown


      11

      SQL> startupFootnote 3



      12

      SQL> alter pluggable database all open;

1.4.2 - For no RU update patches


The following steps load modified SQL files into the database. For a RAC environment, perform these steps on only one node.

1. For each database instance running on the Oracle home being patched, connect to the database using SQL*Plus. Connect as SYSDBA and run the below script as follows:

$ sqlplus /nolog

SQL> CONNECT / AS SYSDBA

SQL> @?/sqlpatch/31602782/postinstall.sql

2. Check the output for any errors.


(IV) Deinstallation
------------------------

Ensure to follow the Prerequsites (Section I). To deinstall the patch, follow these steps:


1. Deinstall the patch by running the following command:

$ opatch rollback -id 31602782
  
2. Start the services from the Oracle home.

3. Ensure that you verify the Oracle Inventory and compare the output with the one run before the patch installation and re-apply any patches that were rolled back as part of this patch apply. To verify the inventory, run the following command:

$ opatch lsinventory


How to fix “OPatch failed with error code 41”



Errors and fixes
for data patch fails

$ . oraenv
ORACLE_SID = [testcdb] ?

$ ./datapatch -verbose -pdbs CDB\$ROOT,TESTPDB
SQL Patching tool version 19.12.0.0.0 Production on Wed Oct  6 16:16:48 2021
Copyright (c) 2012, 2021, Oracle.  All rights reserved.

Log file for this invocation: /u01/app/oracle/cfgtoollogs/sqlpatch/sqlpatch_42205464_2021_10_06_16_16_48/sqlpatch_invocation.log

Connecting to database...OK
Gathering database info...done

Note:  Datapatch will only apply or rollback SQL fixes for PDBs
       that are in an open state, no patches will be applied to closed PDBs.
       Please refer to Note: Datapatch: Database 12c Post Patch SQL Automation
       (Doc ID 1585822.1)

Bootstrapping registry and package to current versions...done
Determining current state...done

Current state of interim SQL patches:
Interim patch 32876380 (OJVM RELEASE UPDATE: 19.12.0.0.210720 (32876380)):
  Binary registry: Installed
  PDB CDB$ROOT: Not installed
  PDB TESTPDB: Not installed

Current state of release update SQL patches:
  Binary registry:
    19.12.0.0.0 Release_Update 210718143527: Installed
  PDB CDB$ROOT:
    Applied 19.8.0.0.0 Release_Update 200709022037 successfully on 12-SEP-20 12.11.40.138977 AM
  PDB TESTPDB:
    Applied 19.8.0.0.0 Release_Update 200709022037 successfully on 12-SEP-20 12.11.42.059852 AM

Adding patches to installation queue and performing prereq checks...done
Installation queue:
  For the following PDBs: CDB$ROOT TESTPDB
    No interim patches need to be rolled back
    Patch 32904851 (Database Release Update : 19.12.0.0.210720 (32904851)):
      Apply from 19.8.0.0.0 Release_Update 200709022037 to 19.12.0.0.0 Release_Update 210718143527
    The following interim patches will be applied:
      32876380 (OJVM RELEASE UPDATE: 19.12.0.0.210720 (32876380))

Installing patches...
Patch installation complete.  Total patches installed: 4

After fixing PDB$SEED, you can apply datapatch to it alone.

$ /u01/app/oracle/product/12.1.0.2/dbhome_1/OPatch/datapatch -verbose -pdbs 'PDB$SEED'

how to check data patch status.


SQL> set lines 300
SQL> select PATCH_ID,PATCH_TYPE,ACTION,STATUS,ACTION_TIME,DESCRIPTION from DBA_REGISTRY_SQLPATCH;

  PATCH_ID PATCH_TYPE ACTION          STATUS                    ACTION_TIME                                                   DESCRIPTION
---------- ---------- --------------- -------     --------------- ---     --------------------- ------------------------------       ----------------------------------------------------------------------
  31281355 RU  APPLY                      SUCCESS                   12-SEP-20 12.11.40.138977 AM             Database Release Update : 19.8 .0.0.200714 (31281355)
  32876380 INTERIM   APPLY           SUCCESS                   06-OCT-21 04.26.55.992418 PM            OJVM RELEASE UPDATE: 19.12.0.0.210720 (32876380)
  32904851 RU   APPLY                    SUCCESS                   06-OCT-21 04.26.55.985246 PM            Database Release Update : 19.12.0.0.210720 (32904851)


https://blogs.oracle.com/letthesunshinein/db12c-patching:-multitenant-datapatch-tips

No comments:

Post a Comment

  RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time https://shivanandarao-oracle.com/2012/12/05/rman-20207-until-time-or-re...