Oracle Patching: Difference between revisions

From AquaWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 46: Line 46:


Install Opatch
Install Opatch
    If OPatch is already installed rename the existing one to _old or _yyyymmdd
     Unzip the file and place in $ORACLE_HOME
     Unzip the file and place in $ORACLE_HOME
     ex: D:\oracle\product\X.X.X.X\dbhome_1
     ex: D:\oracle\product\X.X.X.X\dbhome_1
Line 52: Line 53:
== Determine current patch level ==
== Determine current patch level ==
     opatch lsinventory -patch -detail
     opatch lsinventory -patch -detail
== Obtain Patches ==
== Shutdown Services ==
    $ sqlpus
    SQL> CONNECT SYS@CARDS AS SYSDBA
    Enter password: <password>
    SQL> SHUTDOWN IMMEDIATE
    net stop msdtc
== Patch Dry Run ==
== Run Patch ==
    navigate to where the patch is then run
    opatch apply

Revision as of 15:48, 18 January 2023

Install Oracle Instant Client

Install the current Microsoft VS Redistributable

   https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

Download the latest version of the Oracle Instant Client

   https://www.oracle.com/database/technologies/instant-client/downloads.html
   You'll want to download both the basic and sdk packages for your system arch.

Extract both packages

   Copy the SDK directory from the SDK package and paste it into the other instantclient_XX_X directory

Copy the instantclient directory to

   D:/oracle/instantclient_XX_X

Update Env Vars

   Click on the Windows Icon and type environment variables.
   click on "Edit the system environment variables".

Add Variable

   Under the System Variables, click New...
   Enter the variable name OCI_LIB64
   And the value: D:/oracle/instantclient_XX_X
   Click OK, close those windows.

Install SQLplus Utility

Download the latest SQL*Plus Package

   https://www.oracle.com/database/technologies/instant-client/winx64-64-downloads.html

Unzip and Install

   Unzip the package, copy the contents of the zipped folder and place them in D:/oracle/instantclient_XX_X.
   Why Oracle has these all separate instead of just one package that you need is beyond me.

Connect to the Database

Pop open a terminal (I've been using as Admin) and type

   sqlplus user/password@CARDS
   EX: sqlplus cwf/password@CARDS
   I assume if no password is provided it'll prompt, which is safer. 
   We'll need sqlplus later to turn off the database. Opatch won't apply the patch otherwise.

Download the latest Opatch

Use the below link to log onto oracle support and download the Opatch file.

   https://support.oracle.com/knowledge/Oracle%20Database%20Products/274526_1.html
   follow instructions provided on the page. You'll need a oracle account linked to a product to view.

Install Opatch

   If OPatch is already installed rename the existing one to _old or _yyyymmdd
   Unzip the file and place in $ORACLE_HOME
   ex: D:\oracle\product\X.X.X.X\dbhome_1
   Opatch can be run from this path.

Determine current patch level

   opatch lsinventory -patch -detail

Obtain Patches

Shutdown Services

   $ sqlpus
   SQL> CONNECT SYS@CARDS AS SYSDBA
   Enter password: <password>
   SQL> SHUTDOWN IMMEDIATE
   net stop msdtc

Patch Dry Run

Run Patch

   navigate to where the patch is then run
   opatch apply