Customizing configuration with Oracle RPM Installation

This installation was done on an OCI Compute – Free Tier

Many of you have perhaps already come across rpm installation of database software. Especially if you have the subscription to  Unbreakable Linux Network (ULN), you can install an Oracle Database with a single command, as documented here

Another functionality of this is the ability to create and configure a database in a one step process. However thre is a limitation, this process will always create a container database called ORCLDB.

I was preparing for a quick demo and wanted to have 2 container databases available on the server, this prompted to me to explore the options.

The init script /etc/init.d/oracledb_ORCLCDB-19c does have a configuration file associated, however the configurable parameters do not include the option to modify the database name directly. Below are the parameters you can control directly.

Configuration File :  /etc/sysconfig/oracledb_ORCLCDB-19c.conf

# LISTENER_PORT: Database listener
LISTENER_PORT=1521

# ORACLE_DATA_LOCATION: Database oradata location
ORACLE_DATA_LOCATION=/opt/oracle/oradata

# EM_EXPRESS_PORT: Oracle EM Express listener
EM_EXPRESS_PORT=5500

In order to change the database name there are 2 important things to doFirst up, in the script oracledb_ORCLCDB-19c update the ORACLE_SID variable as per your choice.I changed the SID to testdb and  also decided to change the name of the PDB to testpdb1 to better suite the purpose.  Below are the list of a few other variables that can be modified based on your purpose.

# Setting the required environment variables
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1

export ORACLE_VERSION=19c
export ORACLE_SID=testdb
export TEMPLATE_NAME=General_Purpose.dbc
export CHARSET=AL32UTF8
export PDB_NAME=testpdb1
export LISTENER_NAME=LISTENER
export NUMBER_OF_PDBS=1
export CREATE_AS_CDB=true

The next thing worth noting is that the oracledb_ORCLCDB-19c script sources the configuration file by using  the Oracle SID.

CONFIG_NAME="oracledb_$ORACLE_SID-$ORACLE_VERSION.conf"
CONFIGURATION="/etc/sysconfig/$CONFIG_NAME"

Thereby our second step is to create a copy of the configuration file based on the SID that you have chosen. e.g. For this case the file will be named as  /etc/sysconfig/oracledb_testdb-19c.conf

cd  /etc/sysconfig

#cp oracledb_ORCLCDB-19c.conf oracledb_$ORACLE_SID-19c.conf

cp oracledb_ORCLCDB-19c.conf oracledb_testdb-19c.conf

Since I was using the OCI Free Compute Instance to spin up my database, I did run into a problem with memory allocation, the workaround for which is well documented by Sean here.With the memory issue sorted I was able to proceed and create a container database TESTDB containing a pluggable database called TESTPDB, just as I wanted

$ /etc/init.d/oracledb_ORCLCDB-19c configure

$ cat /opt/oracle/cfgtoollogs/dbca/testdb.log

Prepare for db operation
DBCA_PROGRESS : 8%
Copying database files
DBCA_PROGRESS : 31%
Creating and starting Oracle instance
DBCA_PROGRESS : 32%
DBCA_PROGRESS : 36%
DBCA_PROGRESS : 40%
DBCA_PROGRESS : 43%
DBCA_PROGRESS : 46%
Completing Database Creation
DBCA_PROGRESS : 51%
DBCA_PROGRESS : 54%
Creating Pluggable Databases
DBCA_PROGRESS : 58%
DBCA_PROGRESS : 77%
Executing Post Configuration Actions
DBCA_PROGRESS : 100%
Database creation complete. For details check the logfiles at:
/opt/oracle/cfgtoollogs/dbca/testdb.
Database Information:
Global Database Name:testdb
System Identifier(SID):testdb

 

SYS@testdb:SQL> select name, cdb from v$database;

NAME CDB
--------- ---
TESTDB YES


SYS@testdb:SQL> select name from v$pdbs;

NAME
-------------
PDB$SEED
TESTPDB1

Hope this helps!