# [23ai] Installing Oracle23ai on OraLinux9

*If you prefer to read in Spanish* *Spanish version.*

The goal of this post is as follows: To create a new database using the *Oracle Database Configuration Assistant* (**DBCA**) on 23ai.

In this case, we defined an **IaaS** with **Oracle Linux 9** on OCI. So, first thing first, we need to set up an Oracle 23ai because it is a new environment.

```bash
[root@~]# grep PRETTY_NAME /etc/os-release
PRETTY_NAME="Oracle Linux Server 9.6"
```

In order to successfully set up Oracle 23ai, we need the following files:

```bash
[root@test1 tmp]# ls -lac *rpm
-rw-r--r--. 1 root root 1412957372 Sep  2 09:47 oracle-database-free-23ai-23.9-1.el9.x86_64.rpm
-rw-r--r--. 1 root root      30688 Sep  2 09:30 oracle-database-preinstall-23c-1.0-0.5.el8.x86_64.rpm
```

A quick note on where we can find these files:

* oracle-database-preinstall-23c-1.0-0.5.el8.x86\_64.rpm [here](https://yum.oracle.com/repo/OracleLinux/OL8/developer/x86_64/).
    
* oracle-database-free-23ai-23.9-1.el9.x86\_64.rpm. [here](https://www.oracle.com/database/free/get-started/).
    

So, let's get down to business!

### Installing and Configuring

* Install the Linux RPM oracle-database-preinstall-23c-1.0-0.5.el8.x86\_64.rpm:
    

```bash
[root@tmp]# dnf install oracle-database-preinstall-23c-1.0-0.5.el8.x86_64.rpm -y
Last metadata expiration check: 1:54:40 ago on Tue 02 Sep 2025 07:46:07 AM GMT.
Dependencies resolved.
....
....
Complete!
```

* Install the Linux RPM oracle-database-free-23ai-23.9-1.el9.x86\_64.rpm:
    

```bash
[root@test1 tmp]# wget https://objectstorage.....
[root@test1 tmp]# dnf install oracle-database-free-23ai-23.9-1.el9.x86_64.rpm -y
Last metadata expiration check: 2:06:18 ago on Tue 02 Sep 2025 07:46:07 AM GMT.
Dependencies resolved.
....
....  
 3/3
Installed:
  oracle-database-free-23ai-23.9-1.x86_64  oracle-database-preinstall-23ai-1.0-3.el9.x86_64
Complete!
```

So, after running both rpm, we can find the following script, **oracle-free-23ai,** in /etc/init.d in order to create the database 23ai. Before running it the script, we need to set the DB\_PASSWORD environment variable.

```bash
[root@test1 tmp]#  export DB_PASSWORD=oracle
[root@test1 tmp]# (echo "${DB_PASSWORD}"; echo "${DB_PASSWORD}";) | /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.
Enter SYS user password:
*****
Enter SYSTEM user password:
********
Enter PDBADMIN User Password:
*********
Prepare for db operation
7% complete
Copying database files
29% complete
Creating and starting Oracle instance
30% complete
33% complete
36% complete
39% complete
43% complete
Completing Database Creation
47% complete
49% complete
50% complete
Creating Pluggable Databases
54% complete
71% complete
Executing Post Configuration Actions
93% complete
Running Custom Scripts
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: test1/FREEPDB1
     Multitenant container database: test1
```

Done! In this setup, we can already with 23ai in our environment. Lastly,as a wee bit trick, we can to configure **.bashrc** and **.bash\_profile** files in order to work with the binaries easily, such as **sqlplus**, **dbca**, or even **tkproff**.

Below we can see the **.bashrc** after updating it:

```bash
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]
then
    PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
        for rc in ~/.bashrc.d/*; do
                if [ -f "$rc" ]; then
                        . "$rc"
                fi
        done
fi
ORACLE_HOME=/opt/oracle/product/23ai/dbhomeFree; export ORACLE_HOME
PATH=/bin:/usr/bin:/usr/local/sbin:/usr/sbin:$ORACLE_HOME/bin:$ORACLE_HOME/lib:$ORACLE_HOME/OPatch/:$ORACLE_HOME/lib; export PATH
LD_LIBRARY_PATH=${ORACLE_HOME}/lib; export LD_LIBRARY_PATH

ORACLE_SID=FREE; export ORACLE_SID
PDB_NAME=FREEPDB1; export PDB_NAME
```

Don’t forget that the goal is to use **dbca** in order to do the following:

* Generate a template using the current database.
    
* Drop the current database.
    
* Create a new database using the response and template files.
    

We run **dbca** with the option -**silent**. The **\-silent** option indicates to run **dbca** in silent mode.

### Generate a template

```bash
[oracle@test1 ~]$ dbca -silent \
-createTemplateFromDB \
-sourceDB FREE \
-templateName FREE.template \
-sysDBAUserName SYS \
-sysDBAPassword oracle
Prepare for db operation
33% complete
Creating a template from the database
37% complete
40% complete
43% complete
47% complete
50% complete
53% complete
57% complete
60% complete
63% complete
67% complete
Creating template
100% complete
The template "/opt/oracle/product/23ai/dbhomeFree/assistants/dbca/templates/FREE.template.dbt" creation completed.
Look at the log file "/opt/oracle/cfgtoollogs/dbca/silent.log_2025-09-02_12-09-54PM_170638" for further details.
```

### Drop the current database

Before dropping the database, we need to switch off the database.

```bash
[oracle@test1 ~]$ dbca -silent \
-deleteDatabase \
-sourceDB FREE \
-sysDBAUserName sys \
-sysDBAPassword oracle
[WARNING] [DBT-11503] The instance (FREE) is not running on the local node. This may result in partial delete of Oracle database.
   CAUSE: A locally running instance is required for complete deletion of Oracle database instance and database files.
   ACTION: Specify a locally running database, or execute DBCA on a node where the database instance is running.
[WARNING] [DBT-19202] The Database Configuration Assistant will delete the Oracle instances and datafiles for your database. All information in the database will be destroyed.
Prepare for db operation
32% complete
Connecting to database
35% complete
39% complete
42% complete
45% complete
48% complete
52% complete
65% complete
Updating network configuration files
68% complete
Deleting instance and datafiles
84% complete
100% complete
Database deletion completed.
Look at the log file "/opt/oracle/cfgtoollogs/dbca/FREE/FREE0.log" for further details.
```

### Create a new database

To create the database, we are going to work with the following files:

```bash
[oracle@test1 ~]$ ls -lac config/
total 52
drwxr-xr-x. 2 oracle oinstall    49 Sep  3 06:35 .
drwx------. 3 oracle oinstall   127 Sep  2 15:47 ..
-rw-r-----. 1 oracle oinstall 20942 Sep  2 15:47 FREE.template.dbt
-rw-r-----. 1 oracle oinstall 25378 Sep  3 06:35 shadow.rsp
```

* **FREE.template.dbt**, it is the template that we created in the previous step. Therefore, we are going to edit the template in order to remove the references to FREEPDB1. The goal is to create the cdb without pdbs
    

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1756818902278/4902b0c3-df86-4a22-b5ca-240319b3a2b1.png align="center")

* **shadow.rsp**. It is the response file that we use to run **dbca**. It is a copy of response file template (*$ORACLE\_HOME/assistants/dbca/dbca.rsp*) tailored to our needs.
    
    Below, you can see the response file after it has been upgraded:
    
    ```bash
    [oracle@test1 ~]$ more config/shadow.rsp | grep -v ^$ | grep -v ^#
    responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v23.0.0
    gdbName=FREE
    sid=FREE
    createAsContainerDatabase=true
    numberOfPDBs=0
    templateName=/home/oracle/config/FREE.template.dbt
    sysPassword=*********
    systemPassword=********
    ```
    

After we have upgraded both files, we run **dbca** in silent mode using our response file :

```bash
[oracle@test1 ~]$ dbca -createDatabase -silent -responseFile /home/oracle/config/shadow.rsp
Prepare for db operation
4% complete
Creating and starting Oracle instance
5% complete
6% complete
8% complete
Creating database files
12% complete
Creating data dictionary views
13% complete
16% complete
17% complete
18% complete
24% complete
Oracle JVM
30% complete
36% complete
42% complete
44% complete
Oracle Text
46% complete
48% complete
Oracle OLAP
52% complete
Oracle Spatial
53% complete
60% complete
Oracle Label Security
68% complete
Oracle Database Vault
76% complete
Creating cluster database views
77% complete
84% complete
Completing Database Creation
86% complete
88% complete
Executing Post Configuration Actions
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/FREE10.log" for further details
```

Connect to the database as the SYS user:

```bash
[oracle@test1 ~]$ sqlplus /nolog

SQL*Plus: Release 23.0.0.0.0 - Production on Wed Sep 3 09:57:09 2025
Version 23.9.0.25.07

Copyright (c) 1982, 2025, Oracle.  All rights reserved.

SQL>
SQL> conn / as sysdba
Connected.
SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
```

Up to now, The database is up without pdbs, only the seed, thus we have configurated in our template.

We are going to make another test with the parameter **numberOfPDBs**. The functionality of the parameter is as follows: *Number of PDBs to create. The default is zero*. So If we look inside the response file that we have used, we can see that we had defined the variable with value zero.

```bash
[oracle@test1 ~]$ grep numberOfPDBs  config/shadow.rsp
# Name          : numberOfPDBs
numberOfPDBs=0
```

Hold on!,If we use the original template with the response file, Will it create a PDB or not? If we remenber, the original template had one PDB

Let’s check it!

* Drop the current database:
    
    ```bash
    [oracle@test1 ~]$ dbca -silent \
    -deleteDatabase \
    -sourceDB FREE \
    -sysDBAUserName sys \
    -sysDBAPassword ******
    [WARNING] [DBT-11503] The instance (FREE) is not running on the local node. This may result in partial delete of Oracle database.
       CAUSE: A locally running instance is required for complete deletion of Oracle database instance and database files.
       ACTION: Specify a locally running database, or execute DBCA on a node where the database instance is running.
    [WARNING] [DBT-19202] The Database Configuration Assistant will delete the Oracle instances and datafiles for your database. All information in the database will be destroyed.
    Prepare for db operation
    32% complete
    Connecting to database
    35% complete
    39% complete
    42% complete
    45% complete
    48% complete
    52% complete
    65% complete
    Updating network configuration files
    68% complete
    Deleting instance and datafiles
    84% complete
    100% complete
    Database deletion completed.
    Look at the log file "/opt/oracle/cfgtoollogs/dbca/FREE/FREE11.log" for further details.
    ```
    
* Create the database:
    
    ```bash
    [oracle@test1 ~]$ dbca -createDatabase -silent -responseFile /home/oracle/config/shadow.rsp
    Enter PDBADMIN User Password:
    
    Prepare for db operation
    4% complete
    Creating and starting Oracle instance
    5% complete
    6% complete
    8% complete
    Creating database files
    12% complete
    Creating data dictionary views
    13% complete
    16% complete
    17% complete
    18% complete
    24% complete
    Oracle JVM
    30% complete
    36% complete
    42% complete
    44% complete
    Oracle Text
    46% complete
    48% complete
    Oracle OLAP
    52% complete
    Oracle Spatial
    53% complete
    60% complete
    Oracle Label Security
    68% complete
    Oracle Database Vault
    76% complete
    Creating cluster database views
    77% complete
    84% complete
    Completing Database Creation
    86% complete
    88% complete
    Executing Post Configuration Actions
    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/FREE13.log" for further details.
    ```
    

Connect to the database as the SYS user:

```bash
[oracle@test1 ~]$ sqlplus /nolog

SQL*Plus: Release 23.0.0.0.0 - Production on Wed Sep 3 12:02:06 2025
Version 23.9.0.25.07

Copyright (c) 1982, 2025, Oracle.  All rights reserved.

SQL> conn / as sysdba
Connected.
SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
SQL>! grep pdb_dbid /home/oracle/config/FREE.template.dbt
      <PluggableDatabase pdb_name="PDB$SEED" con_id="2" pdb_dbid="3172087764"/>
      <PluggableDatabase pdb_name="FREEPDB1" con_id="3" pdb_dbid="302716810"/>
```

We can see that we don’t have any PDBs, only the seed.

Although our template has the definition of PDB "FREEPDB1", the response file indicates to **dbca** that number of PDBs is zero (numberOfPDBs=0).

If you want, you can download the files that I used from [here](https://github.com/dbaenlasombra/dbca).

I hope you enjoyed reading this post :)
