Installing Oracle Database 23ai Free on Oracle Linux 9: A Complete Guide
Aaron Rose
Software Engineer & Technology Writer
Prerequisites and System Preparation
Before diving into the installation, ensure your Oracle Linux 9 system meets the requirements and is properly configured.
Note on Operating System Support: While Oracle Linux 10 is available, Oracle Database 23ai Free is officially supported on Oracle Linux 8 and 9. This guide uses Oracle Linux 9 for the most stable and tested installation experience.
Hardware Requirements
- RAM: 1GB minimum, 2GB recommended (Oracle DB Free uses up to 2GB)
- Recommended for home lab: 8GB+ RAM (for OS and other services)
- Storage: 10GB minimum free space for database files
- Architecture: x86_64 (64-bit)
Initial System Update
Start with a fully updated system:
sudo dnf update -y
sudo reboot
Install Required Packages
Oracle Database requires several system packages that may not be installed by default:
sudo dnf install -y oracle-database-preinstall-23ai
This meta-package automatically installs all required dependencies and configures kernel parameters, system limits, and creates the oracle user. It's the easiest and recommended way to ensure your system is properly prepared.
Download Oracle Database 23ai Free
Get the Installation Package
Navigate to Oracle's official download page or use wget if you have the direct link:
cd /tmp
wget https://download.oracle.com/otn-pub/otn_software/db-free/oracle-database-free-23ai-1.0-1.el9.x86_64.rpm
Note: You may need to accept Oracle's license agreement through their web interface first. If the direct download doesn't work, visit Oracle Database Free Downloads and download the RPM package manually.
Verify the Download
Check the integrity of your downloaded file:
ls -lh oracle-database-free-23ai-*.rpm
The file should be approximately 1.2GB in size.
Installation Process
Install the RPM Package
sudo dnf localinstall -y oracle-database-free-23ai-*.rpm
This installation creates:
- Oracle software in
/opt/oracle/product/23ai/dbhomeFree
- Oracle user and group
- Systemd service configuration
- Basic directory structure
Configure the Database
After the RPM installation completes, you need to run the database configuration script:
sudo /etc/init.d/oracle-free-23ai configure
This process will:
- Create the FREEPDB1 pluggable database (Oracle Database 23ai Free uses enforced multitenant architecture)
- Set up basic security
- Configure automatic startup
- Generate random passwords
Important: Save the passwords displayed during configuration! You'll need them to connect to your database.
Post-Installation Configuration
Environment Setup
Create an environment script for the oracle user:
sudo su - oracle
cat > ~/.bash_profile << 'EOF'
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/23ai/dbhomeFree
export ORACLE_SID=FREE
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
EOF
source ~/.bash_profile
Enable Automatic Startup
Ensure the database starts automatically with the system:
sudo systemctl enable oracle-free-23ai
sudo systemctl start oracle-free-23ai
Verify Installation
Check that the database is running:
sudo systemctl status oracle-free-23ai
Connect to the database as the oracle user:
sudo su - oracle
sqlplus / as sysdba
If successful, you should see the SQL*Plus prompt. Run a quick test:
SELECT banner FROM v$version;
EXIT;
Security Configuration
Change Default Passwords
The installation creates several default accounts. Change their passwords immediately:
sudo su - oracle
sqlplus / as sysdba
-- Change SYS password
ALTER USER SYS IDENTIFIED BY YourNewSysPassword;
-- Change SYSTEM password
ALTER USER SYSTEM IDENTIFIED BY YourNewSystemPassword;
-- Change PDBADMIN password (if using pluggable database)
ALTER SESSION SET CONTAINER = FREEPDB1;
ALTER USER PDBADMIN IDENTIFIED BY YourNewPdbAdminPassword;
-- Return to root container
ALTER SESSION SET CONTAINER = CDB$ROOT;
EXIT;
Configure Firewall (Security Warning)
⚠️ Security Warning: Opening database ports to external networks poses significant security risks. Only configure remote access if absolutely necessary and never expose your database directly to the public internet.
For local-only access (recommended for home labs):
# No firewall changes needed - database accessible only from localhost
For trusted network access only:
# Replace X.X.X.X/24 with your specific trusted network range
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="X.X.X.X/24" port protocol="tcp" port="1521" accept'
sudo firewall-cmd --reload
Never use this for production or internet-facing systems:
# DANGEROUS - Only for isolated test environments
sudo firewall-cmd --permanent --add-port=1521/tcp
sudo firewall-cmd --reload
Network Configuration
By default, Oracle Database listens on localhost only. To enable connections from trusted network addresses, configure the listener:
sudo su - oracle
cd $ORACLE_HOME/network/admin
For trusted network access, edit or create listener.ora
:
cat > listener.ora << 'EOF'
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = your.server.ip.address)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
DEFAULT_SERVICE_LISTENER = FREEPDB1
EOF
Security Note: Replace your.server.ip.address
with your actual server IP. Never use 0.0.0.0
which would accept connections from any network interface and poses serious security risks.
Restart the listener:
lsnrctl stop
lsnrctl start
Creating Your First Application User
Rather than using administrative accounts for development, create a dedicated application user:
sudo su - oracle
sqlplus / as sysdba
-- Connect to the pluggable database (if applicable)
ALTER SESSION SET CONTAINER = FREEPDB1;
-- Create a new user
CREATE USER appdev IDENTIFIED BY YourAppPassword;
-- Grant necessary privileges
GRANT CONNECT, RESOURCE TO appdev;
GRANT CREATE VIEW TO appdev;
GRANT UNLIMITED TABLESPACE TO appdev;
-- Verify the user can connect
EXIT;
Test the new user connection:
sqlplus appdev/YourAppPassword@localhost:1521/FREEPDB1
Essential Management Commands
Database Startup and Shutdown
Start the database:
sudo systemctl start oracle-free-23ai
Stop the database:
sudo systemctl stop oracle-free-23ai
Check database status:
sudo systemctl status oracle-free-23ai
Manual Database Control
If you need more granular control:
sudo su - oracle
# Start database manually
sqlplus / as sysdba
STARTUP;
EXIT;
# Stop database manually
sqlplus / as sysdba
SHUTDOWN IMMEDIATE;
EXIT;
Listener Management
sudo su - oracle
# Check listener status
lsnrctl status
# Start listener
lsnrctl start
# Stop listener
lsnrctl stop
Monitoring and Maintenance
Check Database Size and Usage
Monitor your database to ensure you stay within the 12GB limit:
-- Connect as sysdba
SELECT
ROUND(SUM(bytes)/1024/1024/1024, 2) AS "Size (GB)"
FROM dba_data_files;
-- Check tablespace usage
SELECT
tablespace_name,
ROUND(bytes/1024/1024, 2) AS "Size (MB)",
ROUND(maxbytes/1024/1024, 2) AS "Max Size (MB)"
FROM dba_data_files
ORDER BY bytes DESC;
Basic Performance Monitoring
-- Check current sessions
SELECT username, status, count(*)
FROM v$session
WHERE username IS NOT NULL
GROUP BY username, status;
-- Monitor memory usage
SELECT
name,
ROUND(value/1024/1024, 2) AS "Value (MB)"
FROM v$parameter
WHERE name LIKE '%memory%'
AND value > 0;
Troubleshooting Common Issues
Database Won't Start
Check the alert log for errors:
sudo su - oracle
tail -f $ORACLE_BASE/diag/rdbms/free/FREE/trace/alert_FREE.log
Common issues:
- Insufficient memory: Ensure you have enough RAM available
- Port conflicts: Another service might be using port 1521
- Permission problems: Verify oracle user owns database files
Connection Issues
Verify the listener is running:
sudo su - oracle
lsnrctl status
Check if the database is accepting connections:
sudo su - oracle
sqlplus / as sysdba
SELECT status FROM v$instance;
Performance Concerns
Oracle Database 23ai Free is self-limiting, but monitor system resources:
# Check memory usage
free -h
# Monitor CPU usage
top -u oracle
# Check disk I/O
iostat -x 1
Development Workflow Tips
SQL Developer Connection
For a graphical interface, download Oracle SQL Developer and connect using:
- Hostname: localhost (or your mini PC's IP address for trusted network access)
- Port: 1521
- Service Name: FREEPDB1 (for the pluggable database)
- Username: appdev (or your created user)
- Password: Your user's password
Backup Strategy for Development
While Oracle Database 23ai Free doesn't include Enterprise Manager, you can still implement basic backups. First, create the necessary directory object:
sudo su - oracle
# Create backup directory
mkdir -p /opt/oracle/backup
# Connect to database and create directory object
sqlplus / as sysdba
-- Create directory object for backups
CREATE DIRECTORY DATA_PUMP_DIR AS '/opt/oracle/backup';
-- Grant permissions to your application user (replace 'appdev' with your actual username)
GRANT READ, WRITE ON DIRECTORY DATA_PUMP_DIR TO appdev;
EXIT;
Now you can perform exports:
# Simple export backup
expdp appdev/YourAppPassword@localhost:1521/FREEPDB1 \
directory=DATA_PUMP_DIR \
dumpfile=appdev_backup.dmp \
logfile=appdev_backup.log
Resource Monitoring Script
Create a simple monitoring script to track your usage against the limits:
sudo su - oracle
cat > ~/check_limits.sh << 'EOF'
#!/bin/bash
echo "=== Oracle Database 23ai Free Usage ==="
echo "Date: $(date)"
echo ""
sqlplus -s / as sysdba << SQL
SET PAGESIZE 0
SET FEEDBACK OFF
SET HEADING OFF
SELECT 'CPU Usage: ' ||
ROUND((SELECT value FROM v\$resource_limit WHERE resource_name = 'processes') /
(SELECT max_utilization FROM v\$resource_limit WHERE resource_name = 'processes') * 100, 2) || '%'
FROM dual;
SELECT 'Memory Limit: 2GB (enforced by software)'
FROM dual;
SELECT 'Storage Used: ' ||
ROUND(SUM(bytes)/1024/1024/1024, 2) || 'GB / 12GB limit'
FROM dba_data_files;
EXIT;
SQL
EOF
chmod +x ~/check_limits.sh
Run it periodically:
./check_limits.sh
Next Steps
With Oracle Database 23ai Free successfully installed on Oracle Linux 9, you're ready to start building real applications. The combination provides an excellent foundation for:
- Learning Oracle SQL and PL/SQL development
- Testing applications that will eventually run on Oracle Database
- Exploring Oracle's advanced features like JSON support, machine learning, and analytics
- Practicing database administration tasks
In our next article, we'll explore practical development projects that showcase Oracle Database 23ai Free's capabilities while staying within its resource limits, including building a sample web application with modern development practices.
Summary
You now have a complete Oracle Database 23ai Free installation running on Oracle Linux 9. This setup provides enterprise-grade database capabilities for development and learning, all running efficiently on affordable x86 mini PC hardware. The installation is production-quality in terms of features and stability, making it an excellent platform for serious database development work within the free tier limitations.
Aaron Rose is a software engineer and technology writer at tech-reader.blog.
Comments
Post a Comment