Read-Only-Oracle-Home: the follow-up post

2019-08-11 Off By Markus Flechtner

After my recent post on read-only ORACLE_HOME I received some feedback and had some discussions with some colleagues on this topic.

So I decided that another post may be helpful.

In the documentation (https://docs.oracle.com/en/database/oracle/oracle-database/19/ladbi/running-demo-from-oracle-base-home.html#GUID-9C4D0762-7F36-4819-9D00-90ACE68E482B) Oracle advises you to move the demo directories out of the ORACLE_HOME directory to work properly.

This principle can be applied to some other directories, too.

As mentioned in my previous post, the $ORACLE_HOME/sqlpatch directory is a candidate for this procedure and I think $ORACLE_HOME/rdbms/audit is another one.

So the following shell commands can be helpful. It will move the directories to the $ORACLE_BASE/homes/<HOMENAME> directory and will replace the directories in $ORACLE_HOME with symbolic links:

 for DIR in `echo jdbc/demo odbc/demo ord/http/demo precomp/demo rdbms/demo sqlj/demo sqlplus/demo xdk/demo rdbms/audit sqlpatch`; do 
 if [ -e $ORACLE_HOME/$DIR ]
 then 
 echo Directory $DIR exists and will be moved to $(orabasehome)
 mkdir -p $(orabasehome)/$DIR
 mv $ORACLE_HOME/$DIR $ORACLE_HOME/$DIR.backup
 cp -r $ORACLE_HOME/$DIR.backup/* $(orabasehome)/$DIR 2>/dev/null
 ln -s $(orabasehome)/$DIR $ORACLE_HOME/$DIR
 else
 echo Directory $DIR does not exist. No action required.
 fi
 done 

Please note that not all directories are available in a pure RDBMS installation. Some of these directories are created when installation the “Database Examples”.

Of course, when installing new components (like the “Examples”) and when patching the software, the filesystem with $ORACLE_HOME must be read-write, but with the changes described above, I was able to patch a database (datapatch) with the software in a read-only-filesystem.

Taking these result when testing the read-only-ORACLE_HOME-feature, some questions arise:

  • Why doesn’t Oracle offer to make an ORACLE_HOME read-only in the installer?
  • Why doesn’t Oracle do the changes mentioned above (replacing directories in $ORACLE_HOME with symbolic links) automatically when making an ORACLE_HOME read-only with “roohctl -enable”?

But hopefully, there are improvements with this feature in the next releases.