Oracle by Example brandingCopying demo Directories to Configure a Read-Only Oracle Home

section 0Before You Begin

This 15-minute tutorial shows you how to configure a read-only Oracle Home.

Background

Oracle Database contains various demo directories that include a variety of examples and product demonstrations that you can use to learn about the products, options, and features of Oracle Database. In a read-only mode ORACLE_HOME, you cannot use these demo directories in ORACLE_HOME because writes are performed to these demo directories when they are used.

Many of the demo directories are not available by default. You must install Oracle Database Examples to view and use the examples and product demonstrations.

What Do You Need?


section 1Copying demo Directories

Copy the respective demo directory to the corresponding location in ORACLE_BASE_HOME. The following example shows how to copy the rdbms/demo directory from ORACLE_HOME to ORACLE_BASE_HOME:

  1. Log in to your computer as the Oracle software owner user (oracle).
  2. Set the ORACLE_BASE_HOME environment variable:
  3. export ORACLE_BASE_HOME=/u01/app/oracle/homes/OraDB18Home1
  4. Check if the rdbms/demo directory is copied to ORACLE_BASE_HOME:
    $ ls -l -d $ORACLE_BASE_HOME/rdbms/demo
  5. If the rdbms/demo directory has not been copied, then create it and copy it:
    $ mkdir -p $ORACLE_BASE_HOME/rdbms
    $ cp -r $ORACLE_HOME/rdbms/demo $ORACLE_BASE_HOME/rdbms/demo 

You must copy the following demo directories from ORACLE_HOME to ORACLE_BASE_HOME:

  • jdbc/demo
  • odbc/demo
  • ord/http/demo
  • sqlj/demo
  • sqlplus/demo
  • plsql/demo
  • xdk/demo

section 2Creating Symbolic Links

You must create symbolic links for all the demo directories.

For rdbms/demo, replace $ORACLE_HOME/rdbms/demo with a symbolic link to the copy.

  1. Ensure that the symbolic link does not already exist.
    $ ls -l -d $ORACLE_HOME/rdbms/demo
  2. If $ORACLE_HOME/rdbms/demo is still the original demo directory, rename it and replace it with the symbolic link.
    $ cd $ORACLE_HOME/rdbms
    $ mv demo demo.installed
    $ ln -s $ORACLE_BASE_HOME/rdbms/demo $ORACLE_HOME/rdbms/demo 

    Similarly, create the symbolic links for all the demo directories.

The xdk/demo directory requires a symbolic link at $ORACLE_HOME/xdk/include pointing to $ORACLE_BASE_HOME/xdk/include after you copy the xdk/demo directory.

  1. Ensure that the symbolic link does not already exist:
    $ ls -l -d $ORACLE_HOME/xdk/include
  2. If the symbolic link does not exist, then, run the following command:
    $ ln -s $ORACLE_HOME/xdk/include $ORACLE_BASE_HOME/xdk/include

Note: In the plsql/demo directory, ncmpdemo.sql is unusable in read-only mode.


section 3Copying the init.ora File

Copy the init.ora file from ORACLE_HOME/dbs directory to ORACLE_BASE_HOME/dbs directory.

  1. Log in to your computer as the Oracle software owner user (oracle).
  2. Check if the init.ora file exists in ORACLE_BASE_HOME/dbs directory.
    $ ls $ORACLE_BASE_HOME/dbs/init.ora 

    If an init.ora file exists in ORACLE_BASE_HOME/dbs directory, then update this init.ora file to be in-sync with the $ORACLE_HOME/dbs/init.ora file.

  3. If the init.ora file does not exist in ORACLE_BASE_HOME/dbs directory, then copy it from $ORACLE_HOME/dbs directory.
    cp $ORACLE_HOME/dbs/init.ora $ORACLE_BASE_HOME/dbs/init.ora