The question how to start an Oracle Database 23ai Free database instance at boot time recently came up in the forum and it’s a good reminder to post a short article how to do that.

This post is relevant to you if you

  • use a custom virtual machine (not Oracle’s pre-built virtual appliance for VirtualBox)
  • want to download and install the Oracle Database 23ai Free RPMs for use in a virtual machine (not a container)
  • use Linux x86-64 or aarch64

In that case, please read on! This post is not applicable to Oracle Database Enterprise Edition, Standard Edition 2, or any other edition than Oracle Database 23ai Free.

Install Oracle Database 23ai Free (RPM version)

The first step is to install the O/S. This article describes the installation of the Oracle Database 23ai Free database RPM for Oracle Linux 9.4 on x86-64, updated to September 24, 2024. Apart from very minor differences such as package names, it also applies to Oracle Linux 8 and other supported Linux distributions.

Start by installing the O/S as always, either using the GUI or your favourite automation tool following any procedures and standards you might have in your organisation. Once the system is installed and rebooted, log in as a sudo-enabled user, or root.

Preinstall RPM

The suggested next step is to install the preinstall RPM. It should take care of all the dependencies you need to pull into your system and is the simplest way of making sure they are present. The preinstall RPM represents an opinionated version of how the database software should be installed, and although it’s probably less of an issue with the Database Free installation, you should always consult your engineering department to get sign-off on the settings made by the preinstall PRM.

The preinstall-RPM can be directly accessed from Oracle’s YUM server, if you use RedHat or another RH-compatible distribution you can grab the preinstall RPM from Oracle’s website.

[vagrant@oraclefree ~]$ sudo dnf install -y oracle-database-preinstall-23ai.x86_64
Last metadata expiration check: 0:10:40 ago on Tue 24 Sep 2024 06:00:59 AM UTC.
Dependencies resolved.
========================================================================================================================
 Package                                Architecture  Version                            Repository                Size
========================================================================================================================
Installing:
 oracle-database-preinstall-23ai        x86_64        1.0-2.el9                          ol9_appstream             35 k
Installing dependencies:
 avahi-libs                             x86_64        0.8-20.el9                         ol9_baseos_latest         73 k
 bc                                     x86_64        1.07.1-14.el9                      ol9_baseos_latest        135 k

...

  smartmontools-1:7.2-9.el9.x86_64                             sssd-nfs-idmap-2.9.4-6.0.1.el9_4.1.x86_64                
  sysstat-12.5.4-8.0.1.el9_4.x86_64                            tar-2:1.34-6.el9_4.1.x86_64                              
  xml-common-0.6.3-58.el9.noarch                               xorg-x11-utils-7.5-40.el9.x86_64                         
  xorg-x11-xauth-1:1.1-10.el9.x86_64                          

Complete!

Installing Oracle Database 23ai Free

Next you require the Database RPM, which you also get from the get started page. Make sure to download the right version for your Linux distribution. With the RPM downloaded, you can install it as follows:

[vagrant@oraclefree ~]$ sudo dnf install -y oracle-database-free-23ai-1.0-1.el9.x86_64.rpm 
Last metadata expiration check: 0:04:31 ago on Tue 24 Sep 2024 06:11:45 AM UTC.
Dependencies resolved.
========================================================================================================================
 Package                                  Architecture          Version               Repository                   Size
========================================================================================================================
Installing:
 oracle-database-free-23ai                x86_64                1.0-1                 @commandline                1.3 G

Transaction Summary
========================================================================================================================
Install  1 Package

Total size: 1.3 G
Installed size: 3.5 G
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                1/1 
  Running scriptlet: oracle-database-free-23ai-1.0-1.x86_64                                                         1/1 
  Installing       : oracle-database-free-23ai-1.0-1.x86_64                                                         1/1 
  Running scriptlet: oracle-database-free-23ai-1.0-1.x86_64                                                         1/1 
[INFO] Executing post installation scripts...
[INFO] Oracle home installed successfully and ready to be configured.
To configure Oracle Database Free, optionally modify the parameters in '/etc/sysconfig/oracle-free-23ai.conf' 
and then run '/etc/init.d/oracle-free-23ai configure' as root.

  Verifying        : oracle-database-free-23ai-1.0-1.x86_64                                                         1/1 

Installed:
  oracle-database-free-23ai-1.0-1.x86_64                                                                                

Complete!

Create and configure a database

With the database installed you are nearly there! As per the INFO from the RPM output above, you can now change the defaults in /etc/sysconfig/oracle-free-23ai.conf such as the LISTENER_PORT and enable Transparent Data Encryption (TDE) or simply go ahead and run the configure step. If you are planning on moving the database to the cloud or otherwise use TDE you will find the option to configure TDE (CONFIGURE_TDE in /etc/sysconfig/oracle-free-23ai.conf) useful.

Review and edit the file, then configure the database:

[vagrant@oraclefree ~]$ sudo /etc/init.d/oracle-free-23ai configure
Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, 
contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. 
Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts:
Confirm the password:
Configuring Oracle Listener.
Listener configuration succeeded.
Configuring Oracle Database FREE.

...

100% complete
Database creation complete. For details check the logfiles at:
 /opt/oracle/cfgtoollogs/dbca/FREE.
Database Information:
Global Database Name:FREE
System Identifier(SID):FREE
Look at the log file "/opt/oracle/cfgtoollogs/dbca/FREE/FREE.log" for further details.

Connect to Oracle Database using one of the connect strings:
     Pluggable database: oraclefree/FREEPDB1
     Multitenant container database: oraclefree
[vagrant@oraclefree ~]$ 

You can start working with the database already, it’s up and running. It will not yet start automatically with the VM though, which is what you set up next.

Automatic start of Oracle Database 23ai Free

The database RPM comes with a start/stop script that you can use. First of all, reload systemd to make sure the newly installed file is visible:

[vagrant@oraclefree ~]$ sudo systemctl daemon-reload
[vagrant@oraclefree ~]$ sudo systemctl status oracle-free-23ai
○ oracle-free-23ai.service - SYSV: This script is responsible for taking care of configuring the RPM Oracle FREE Databa>
     Loaded: loaded (/etc/rc.d/init.d/oracle-free-23ai; generated)
     Active: inactive (dead)
       Docs: man:systemd-sysv-generator(8)

As you can see the script is neither enabled nor started. Let’s change that:

[vagrant@oraclefree ~]$ sudo systemctl enable oracle-free-23ai && sudo systemctl start oracle-free-23ai
oracle-free-23ai.service is not a native service, redirecting to systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable oracle-free-23ai

The database service is now enabled, and active:

[vagrant@oraclefree ~]$ sudo systemctl status oracle-free-23ai
● oracle-free-23ai.service - SYSV: This script is responsible for taking care of configuring the RPM Oracle FREE Databa>
     Loaded: loaded (/etc/rc.d/init.d/oracle-free-23ai; generated)
     Active: active (exited) since Tue 2024-09-24 06:35:47 UTC; 15s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 49778 ExecStart=/etc/rc.d/init.d/oracle-free-23ai start (code=exited, status=0/SUCCESS)
        CPU: 10ms

Sep 24 06:35:47 oraclefree systemd[1]: Starting SYSV: This script is responsible for taking care of configuring the RPM Ora>
Sep 24 06:35:47 oraclefree oracle-free-23ai[49778]: The Oracle Database instance FREE is already started.
Sep 24 06:35:47 oraclefree systemd[1]: Started SYSV: This script is responsible for taking care of configuring the RPM Orac>
lines 1-10/10 (END)

This setting ensures that Oracle Database 23ai starts automatically when the VM boots as well.

Happy testing!