Friday, April 19, 2019

Configuring Read Only OracleHome - 18c

Starting with Oracle Database 18c, you can configure an Oracle home in read-only mode. In a read-only Oracle home, all the configuration data and log files reside outside of the read-only Oracle home. This feature allows you to use the read-only Oracle home as a software image that can be distributed across multiple servers.

The concept of a read-only Oracle home, Oracle has committed to to separate configuration files from binaries. The Configuring Read Only OracleHome 18c have impact on the following methods / DBCA / Patching / Upgrade / Key stores



It's a common practice to separate the configuration from the binaries.
This will make it easier to clone and switch between existing Oracle homes during patching and upgrades, without having to seek out all additional config files.

Benefits of a Read-Only Oracle Home

  • Enables seamless patching and updating of Oracle databases without extended downtime.
  • Simplifies patching and mass roll-out as only one image needs to be updated to distribute a patch to many servers.
  • Simplifies provisioning by implementing separation of installation and configuration.

Initiate a Oracle RDBMS read-only software
  1. Perform a software-only Oracle Database installation
  2. Run the roohctl -enable script
    cd $ORACLE_HOME/bin
    . /roohctl -enable
    
  3. Create DB's => Run Oracle Database Configuration Assistant (Oracle DBCA) to create a database.
Check the Read only status RDBMS

My environment

[oracle@rac01 ~]$ env|grep ORA
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=rac01.labs.joords
ORACLE_HOME=/u01/app/oracle/product/18c/db_1
[oracle@rac01 ~]$ 

To validate if the ORACLE RDBMS software is read-only we need to do the following checks:

1.   orabasetab :
File holds a mapping between the ORACLE_HOME in the "/etc/oratab" file. This file is located in $ORACLE_HOME/install. The fourth field at the end of the line indicates you have a read-only Oracle home, when thus has the value "Y".

[oracle@rac01 ~]$  $ORACLE_HOME/install/orabasetab
orabasetab file is used to track Oracle Home associated with Oracle Base
/u01/app/oracle/product/18c/db_1:/u01/app/oracle:OraDB18Home1:Y:

2. Validate the new files starting with "ORABASE*" in the bin directory 

[oracle@rac01 ~]$ ls -trl $ORACLE_HOME/bin/orabas*
-rwxr-x---. 1 oracle oracle 1871655 Feb  7  2018 /u01/app/oracle/product/18c/db_1/bin/orabaseconfig
-rwxr-x---. 1 oracle oracle 1871653 Feb  7  2018 /u01/app/oracle/product/18c/db_1/bin/orabasehome
-rwxr-xr-x. 1 oracle oracle 6560987 Feb  7  2018 /u01/app/oracle/product/18c/db_1/bin/orabase

2a. orabaseconfig : 
The path "u01/app/oracle" is the setting of the ORACLE_BASE. For a read-only Oracle home the orabaseconfig command returns the ORACLE_BASE location. In a read/write ORACLE_HOME, the ORACLE_BASE_CONFIG path is the same as the ORACLE_HOME path because it is located at $ORACLE_HOME. When the environment is a read-only ORACLE_HOME, the ORACLE_BASE_CONFIG path is the same as ORACLE_BASE.

oracle@rac01 bin]$ cd $ORACLE_HOME/bin
[oracle@rac01 bin]$ pwd
/u01/app/oracle/product/18c/db_1/bin
[oracle@rac01 bin]$ ./orabaseconfig
/u01/app/oracle

PATH AND NAVIGATION
[oracle@rac01 bin]$ pwd
/u01/app/oracle/product/18c/db_1/bin
[oracle@rac01 bin]$  cd $(orabaseconfig)
[oracle@rac01 oracle]$ pwd
/u01/app/oracle

2b. orabasehome :
If the output of the orabasehome command is the same as $ORACLE_HOME, then your Oracle home is in read/write mode. If the output displays the path ORACLE_BASE/homes/HOME_NAME, then your Oracle home is in read-only mode.

oracle@rac01 bin]$ cd $ORACLE_HOME/bin
[oracle@rac01 bin]$ pwd
/u01/app/oracle/product/18c/db_1/bin
oracle@rac01 bin]$ ./orabasehome 
/u01/app/oracle/homes/OraDB18Home1
The path "u01/app/oracle/homes/OraDB18Home1" is the setting of the for the configuration files read-write for an ORACLE_HOME read-only software tree. For a read-only Oracle home the orabasehome command returns the ORACLE_BASE/home/OraDB18Home1 [The HOME_NAME used inside the inventory]  location. In a read/write ORACLE_HOME, the ORACLE_BASE_HOME path is the same as the ORACLE_HOME path because it is located at $ORACLE_HOME. 

PATH AND NAVIGATION
[oracle@rac01 oracle]$ cd $ORACLE_HOME/bin
[oracle@rac01 bin]$ pwd
/u01/app/oracle/product/18c/db_1/bin
[oracle@rac01 bin]$ cd $(orabasehome)
[oracle@rac01 OraDB18Home1]$ pwd
/u01/app/oracle/homes/OraDB18Home1

2c. orabase: 
This will be the location of the ORACLE_BASE. Changing ORACLE_BASE can be done by hanging the environment variable. The environment always takes precedence over what was specified at install time.  So for changing ORACLE_BASE you have to set the ORACLE_BASE variable.

Settings overview used by Oracle home  read/write as read only


Check files system after creating a databases: 


[oracle@rac01 ~]$ cd $ORACLE_BASE
[oracle@rac01 oracle]$ pwd
/u01/app/oracle
[oracle@rac01 oracle]$ ls -trl
total 4
drwxrwxr-x.  3 oracle oinstall   17 Mar  1 13:47 product
drwxr-xr-x.  2 oracle oinstall    6 Mar 18 15:39 checkpoints
drwxrwxr-x. 23 oracle oinstall 4096 Mar 18 15:56 diag
drwxr-x---.  3 oracle oinstall   26 Mar 18 16:02 homes
drwxr-x---.  5 oracle oinstall   49 Apr 12 11:48 cfgtoollogs
drwxr-x---.  4 oracle oinstall   30 Apr 12 12:37 admin
drwxr-x---.  4 oracle oinstall   34 Apr 12 12:47 audit
drwxr-x---.  2 oracle oinstall   48 Apr 16 13:28 dbs

[oracle@rac01 oracle]$ cd homes
[oracle@rac01 homes]$ ls
OraDB18Home1

See how the filesystem "OraDB18Home1" exists off using a kind of tree command:

[oracle@rac01 homes]$ ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/   /' -e 's/-/|/'

   |-OraDB18Home1
   |---admin
   |-----cdb1
   |-------xdb_wallet
   |---assistants
   |-----dbca
   |-------templates
   |---dbs
   |---install
   |---log
   |-----diag
   |-----rac01
   |-------client
   |---network
   |-----admin
   |-----log
   |-----trace
   |---rdbms
   |-----audit
   |-----log
   |-------8653418039223588E053650110AC309D
   |-------865419E7911738E4E053650110AC45B0
   |-------opatch
   |---------lsinv
 

Option to add to the Oracle profile

export ORACLE_BASE_HOME=$(/u01/app/oracle/product/18c/db_1/bin/orabasehome)
export ORACLE_BASE_CONFIG=$(/u01/app/oracle/product/18c/db_1/bin/orabaseconfig)

References:

No comments:

Post a Comment