Oracle Database 23ai Free on Oracle Linux 8 on Azure User Guide
Videos
Overview
This guide covers deploying cloudimg's Oracle DB 23ai Free on OL8 image from the Azure Marketplace (offer oracle-db-23ai-free-oel8). The image runs Oracle AI Database 26ai Free, release 23.26, Oracle's current Free release and the direct successor of Oracle Database 23ai Free, on Oracle Linux 8. The FREE container database and its FREEPDB1 pluggable database are created and open when you first log in, and the database and listener start by themselves at every boot.
Every virtual machine gets its own database password on its first boot. Nothing is shared between virtual machines: on two virtual machines deployed from the same image, each one's password was rejected by the other with ORA-01017.
What's included
- Oracle AI Database 26ai Free, release 23.26.3 (64 bit), installed at
/opt/oracle/product/26ai/dbhomeFree - The
FREEcontainer database (CDB) with theFREEPDB1pluggable database (PDB), open read write - The Oracle Net Listener on TCP port 1521, listening on all interfaces
- The
oracle-free-26aiservice, which starts the database and the listener at boot - A first boot service,
oracle-free-firstboot, that sets a new random password forSYS,SYSTEMandPDBADMINon each virtual machine - SQL*Plus and SQLcl (
sql), with SQLcl and the database tools running on the operating system's OpenJDK 17, whichdnfkeeps up to date - AI Vector Search, JSON Relational Duality and the other features of Oracle Database Free
- Oracle Linux 8.10 with the Unbreakable Enterprise Kernel, SELinux enforcing, firewalld and chronyd running, and the Azure Linux Agent (waagent) for provisioning
- Hyper-V Generation 2 virtual machine
- cloudimg's support team on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours
Default user: azureuser · CDB: FREE · PDB: FREEPDB1 · Port: 1521 · Credentials: /stage/scripts/oracle-database-credentials.log
Prerequisites
- An active Microsoft Azure subscription
- The Azure CLI, installed locally or in Azure Cloud Shell (for Option B)
- An SSH key pair
- A network security group that allows SSH (TCP 22) from your own network only. Open TCP 1521 only if you will connect to the database from outside the virtual machine, and only from your own IP address (Step 7)
Step 1: Deploy the Virtual Machine
Option A: Azure Portal
- Open the Oracle DB 23ai Free on OL8 by cloudimg listing on the Azure Marketplace and choose Get it now, then Create
- Configure the basics:
- Subscription: Select your Azure subscription
- Resource Group: Create new or select existing
- Virtual Machine Name: Enter a name for your VM
- Region: Select your preferred Azure region
- Size: Select a size for your workload (see "Free edition limits" below for the memory the database uses)
- Under Administrator Account, select SSH public key, keep
azureuseras the username and enter your key - Under Inbound Port Rules, allow SSH (port 22), ideally from your own network only
- Click Review + Create, then Create
Option B: Azure CLI
The image carries a Marketplace purchase plan, so accept its terms once per subscription, then create the virtual machine. Replace <your-vm-size> with the size you chose:
az vm image terms accept --urn cloudimg1647283583153:oracle-db-23ai-free-oel8:default:latest
az vm create \
--resource-group myResourceGroup \
--name my-oracle-free-vm \
--image cloudimg1647283583153:oracle-db-23ai-free-oel8:default:latest \
--size <your-vm-size> \
--admin-username azureuser \
--generate-ssh-keys \
--public-ip-sku Standard
Step 2: Connect via SSH
Run these on your own workstation. Find the public IP, then connect:
az vm show --resource-group myResourceGroup --name my-oracle-free-vm --show-details --query publicIps -o tsv
ssh azureuser@<vm-ip>
There is no password to enter. If SSH asks for one, the key your client is offering is not the key you supplied at create time.
Step 3: Wait for the first boot to finish
On its first boot the virtual machine starts the database and then sets its per-VM password. On the virtual machines we checked this finished about two minutes after boot. Check it with:
systemctl is-active oracle-free-firstboot oracle-free-26ai
Both lines read active when the database is up and your password is ready. While the first boot is still running, the first line reads activating or inactive; wait a minute and check again. The first boot runs once: a later reboot keeps your password.
Step 4: Read your credentials
sudo ls -l /stage/scripts/oracle-database-credentials.log
sudo cat /stage/scripts/oracle-database-credentials.log
The file belongs to root with mode 0600 (-rw-------), so only root can read it. It records when it was generated and lists one password, generated for this virtual machine, for the SYSTEM, SYS (connect AS SYSDBA) and PDBADMIN (FREEPDB1 only) accounts, with the local and remote connection details. Change the passwords after your first login (Step 9).
Step 5: Connect locally with SQL*Plus
The database software belongs to the oracle operating system user, whose profile sets ORACLE_HOME, ORACLE_SID=FREE and the PATH. Switch to it and connect with operating system authentication, which needs no password:
sudo su - oracle
sqlplus / as sysdba
SELECT banner_full FROM v$version;
SELECT name, open_mode FROM v$pdbs;
The banner reads Oracle AI Database 26ai Free Release 23.26.3.0.0 - Develop, Learn, and Run for Free, and FREEPDB1 is READ WRITE (PDB$SEED is READ ONLY).
To connect to the pluggable database as SYSTEM through the listener, run this as the oracle user; SQL*Plus asks for the password from Step 4:
sqlplus system@//localhost:1521/FREEPDB1
SQLcl is on the oracle user's path as sql, and takes the same connect strings:
sql system@//localhost:1521/FREEPDB1
Step 6: A first AI Vector Search query
Oracle Database Free includes AI Vector Search: a VECTOR column type and the VECTOR_DISTANCE function. As the oracle user, sqlplus / as sysdba, this example creates a schema-only account (one that nobody can log in to directly), a small table of three-number embeddings, and finds the rows nearest to a query vector:
ALTER SESSION SET CONTAINER = FREEPDB1;
CREATE USER demo NO AUTHENTICATION DEFAULT TABLESPACE users QUOTA UNLIMITED ON users;
ALTER SESSION SET CURRENT_SCHEMA = demo;
CREATE TABLE docs (id NUMBER PRIMARY KEY, title VARCHAR2(40), embedding VECTOR(3, FLOAT32));
INSERT INTO docs VALUES (1, 'Backups', '[0.9, 0.1, 0.0]');
INSERT INTO docs VALUES (2, 'Networking', '[0.1, 0.9, 0.1]');
INSERT INTO docs VALUES (3, 'Restores', '[0.8, 0.2, 0.1]');
COMMIT;
SELECT title, ROUND(VECTOR_DISTANCE(embedding, VECTOR('[1, 0, 0]'), COSINE), 3) AS distance
FROM docs ORDER BY distance FETCH FIRST 2 ROWS ONLY;
TITLE DISTANCE
------------ ----------
Backups .006
Restores .037
Real embeddings have hundreds of dimensions and come from an embedding model, but the column type, the distance function and the FETCH FIRST pattern are the same. JSON Relational Duality works on the same table. This view presents each row as a JSON document that can also be updated:
CREATE JSON RELATIONAL DUALITY VIEW docs_dv AS
SELECT JSON {'_id': d.id, 'title': d.title} FROM docs d WITH UPDATE;
SELECT json_serialize(data) FROM docs_dv WHERE ROWNUM = 1;
For your own applications, create a normal user with a password (Step 9) instead of the schema-only demo account.
Step 7: Connect remotely
The listener accepts connections on all interfaces, and the virtual machine's own firewall (firewalld) already allows TCP 1521. What decides who can reach it is your network security group. Add an inbound rule for TCP 1521 from your own IP address only:
az network nsg rule create \
--resource-group myResourceGroup \
--nsg-name my-oracle-free-vmNSG \
--name allow-oracle-from-my-ip \
--priority 1010 \
--access Allow --protocol Tcp --direction Inbound \
--source-address-prefixes <your-ip>/32 \
--destination-port-ranges 1521
(az vm create names the security group <vm-name>NSG unless you chose one.) Then connect from SQL Developer, SQLcl or any Oracle client with:
- Host: the virtual machine's public IP
- Port:
1521 - Service name:
FREEPDB1 - User:
SYSTEM, or the application user you create in Step 9
sql system@//<vm-ip>:1521/FREEPDB1
Never open port 1521 to the whole internet.
Step 8: Manage the database service
As azureuser:
sudo /etc/init.d/oracle-free-26ai status
sudo /etc/init.d/oracle-free-26ai stop
sudo /etc/init.d/oracle-free-26ai start
status reports LISTENER status: RUNNING and FREE Database status: RUNNING. The service is enabled at boot, and FREEPDB1 opens read write again after every start, because its open state is saved. Listener details:
sudo su - oracle -c 'lsnrctl status'
Step 9: Change passwords and create an application user
As the oracle user, sqlplus / as sysdba:
-- in the CDB
ALTER USER SYSTEM IDENTIFIED BY "<new password>";
ALTER USER SYS IDENTIFIED BY "<new password>";
-- in the PDB
ALTER SESSION SET CONTAINER = FREEPDB1;
ALTER USER PDBADMIN IDENTIFIED BY "<new password>";
CREATE USER appuser IDENTIFIED BY "<password>" QUOTA UNLIMITED ON USERS;
GRANT DB_DEVELOPER_ROLE TO appuser;
Then connect your application as appuser@//<vm-ip>:1521/FREEPDB1. The credentials file is not updated when you change a password, so keep the new ones in your own password manager and delete or update the file.
Free edition limits
Oracle limits Oracle Database Free to 2 CPU threads, 2 GB of database memory and 12 GB of user data, under the Oracle Free Use Terms and Conditions. On this image the instance is set to cpu_count 2, a 1.5 GB SGA target and a 512 MB PGA target. The operating system needs memory on top of that, so choose a size with headroom above 2 GB. For larger workloads, move to a licensed Oracle Database edition.
Security notes
- Per-VM password: set by the first boot on each virtual machine, stored only in the root-only credentials file, and passed to the database on standard input, never on a command line.
- SSH: key authentication only (
passwordauthentication no). - Network: the listener (1521) and SSH (22) are the services to expose; firewalld allows
sshand1521/tcp. Keep both behind your network security group, restricted to your own addresses. Oracle's XDB HTTP and HTTPS ports (used by EM Express) are not enabled on this image (both report port 0). - SELinux is enforcing.
- Time zone: the virtual machine's clock is set to US Eastern time (
America/New_York). The credentials file records its time in UTC. To change it, run for examplesudo timedatectl set-timezone Europe/London.
Keeping the system up to date
sudo dnf -y upgrade
This updates Oracle Linux and the OpenJDK used by SQLcl and the database tools. The image does not run an update by itself on first boot, so run this after you deploy and on your normal schedule. Oracle Database Free itself is updated by Oracle as new Free releases; to move to a newer release, export your data and import it into a new virtual machine.
Back up your data with Data Pump (expdp and impdp, as the oracle user) or with Azure disk snapshots taken while the database is stopped.
Server Components
| Component | Value |
|---|---|
| Database | Oracle AI Database 26ai Free, release 23.26.3 |
| Oracle home | /opt/oracle/product/26ai/dbhomeFree |
| Container database | FREE |
| Pluggable database | FREEPDB1 |
| Listener | TCP 1521, all interfaces |
| Database service | oracle-free-26ai (/etc/init.d/oracle-free-26ai) |
| First boot service | oracle-free-firstboot (log /var/log/oracle-free-firstboot.log) |
| Credentials | /stage/scripts/oracle-database-credentials.log (root, 0600) |
| Operating system | Oracle Linux 8.10 |
Troubleshooting
- The credentials file is not there yet, or
oracle-free-firstbootis stillactivating: the first boot is still running. Wait a minute and check again, and readsudo cat /var/log/oracle-free-firstboot.log, which ends withfirstboot complete. ORA-01017: invalid credential or not authorized; logon denied: the user name or password is wrong for this virtual machine. Use the password from this virtual machine's own credentials file (Step 4), or the one you set in Step 9.- Cannot connect remotely: confirm your network security group allows TCP 1521 from your IP, and that
sudo ss -tlnp | grep 1521showstnslsnron0.0.0.0:1521. sqlplus: command not found: run it as theoracleuser (sudo su - oracle), whose profile puts the Oracle tools on the path.
Support
cloudimg's support team is on hand 24 hours a day by email (support@cloudimg.co.uk), with a guaranteed response within 24 hours. Email support@cloudimg.co.uk with your virtual machine details and a description of the issue.