Read Only Oracle Home – Part 2

Read Only Oracle Home – Part 2

January 16, 2020 0 By dianarobete

Previous week we talked about the Read Only Oracle Home, what it is, and how it’s structured. If you need a refresher, or if you haven’t had a chance to read it, here is the link to the article.

In today’s post, we will get our hands dirty and actually create a Read Only Oracle Home. At the end I’ll also show you what happens when you try to convert an existing Oracle Home, that already has a database running in it.

Creating the Read Only Oracle Home, is composed of 2 easy steps, and an optional one, if you decide to also create a database.

  1. Step 1. Software only installation of the Oracle Database
  2. Step 2. Enable Read Only Oracle Home. Run script roohctl
  3. Step 3. Optional, create database with DBCA or other method.

Let’s see the actions in detail below!

Step 1. Software only installation of the Oracle Database

If you installed 19c previously, you must have the software download (the zip file). If you don’t have it, then download the software. Once you downloaded 19c software, unzip the file to the directory you want to install it into. You unzip the file straight to the directory that will be your Oracle Home. In my case, I will unzip it to C:\oracle\dbhome_2. After this process is complete, run the setup.exe as Administrator, and choose Set Up Software Only.

Go through the rest of the screens and options, until you complete the installation. In the end, this is what you should get:

Step 2. Enable Read Only Oracle Home. Run script roohctl

Open up command line cmd, make sure you run it as Administrator, and navigate to Oracle Home\bin folder, in my case C:\oracle\dbhome_2\bin. Run the following command:

roohctl.bat -enable

The details and output of the command go to a file to C:\oracle\cfgtoollogs\roohctl\roohctl-200114PM085103.log as per the screenshot.

If you read the log file, you’ll see everything that was happening here. The main thing is, that the registry is updated on Windows. If on Unix, then the orabasetab is updated. Windows registry update:

HKEY_LOCAL_MACHINE subkey = SOFTWARE\ORACLE\KEY_OraDB19Home2 value= ORACLE_HOME_READONLY

The following directories and sub directories also got created: C:\oracle\homes\ORaDB19Home2 , C:\oracle\database.

We can verify now that this Oracle Home is Read Only, by running the orabasehome and orabaseconfig commands. If these point to the location of the Oracle Home, then the home is read write, if they do not point to the Oracle Home, then the home is Read Only.

cd c:\oracle\dbhome_2\bin
orabasehome
C:\oracle\homes\OraDB19Home2
orabaseconfig
C:\oracle

Step 3. Optional, create database with DBCA or other method.

This step is optional, depending on the purpose of your Oracle Home.

What happens when you try to enable an existing Oracle Home that has a database or listener running? When you try running the roohctl file, it will fail, with the following error:

c:\oracle\WINDOWS.X64_193000_db_home\bin>roohctl.bat -enable
Enabling Read-Only Oracle home.
Cannot enable Read-Only Oracle home in a configured Oracle home.
The Oracle Home is configured with databases 'TESTDB'.
The Oracle Home is configured with listeners 'LISTENER'.

The take away is, that you must enable the home to be Read Only, before you create any database, or listener.

If you enjoyed this article, and would like to learn more about databases, please sign up to my weekly email, and you will receive The Ultimate 3 Step Guide To Find The Root Cause Of The Slow Running SQL!