Oracle Patching

From AquaWiki
Revision as of 16:30, 19 January 2023 by 174.216.182.100 (talk)
Jump to navigation Jump to search

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

Stop Apache Services

   Open the Services window and stop Tomcat and httpd

Stop Oracle Services

   Open the Services window and stop
   OracleOraDB19Home1TNSListener19C_LISTENER
   OracleServiceCARDS
   OracleVssWriterCARDS

Gracefully shutdown the DB:

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

If there are errors you may need to rename .dll that it says are still running

   I appened _old.dll to the ones that it gave errors on. 

Patch Dry Run

Run Patch

   navigate to where the patch is then run
   opatch apply