Ensure your Ubuntu system meets the minimum requirements for the target Oracle Database version (e.g., CPU architecture, memory, disk space). Refer to the official Oracle documentation for version-specific specs.
Run the following commands to install essential packages for Oracle installation:
sudo apt update
sudo apt install alien libaio1 unixodbc unzip wget -y
Perform a full backup using RMAN (Recovery Manager) to ensure data safety:
rman target /
RUN {
ALLOCATE CHANNEL c1 DEVICE TYPE DISK;
BACKUP DATABASE PLUS ARCHIVELOG FORMAT '/u01/backup/%U';
RELEASE CHANNEL c1;
}
Also, back up critical configuration files (e.g., listener.ora, tnsnames.ora) from $ORACLE_HOME/network/admin.
Confirm your current Oracle version supports a direct upgrade to the target version. For example:
COMPATIBLE parameter:SELECT name, value FROM v$parameter WHERE name = 'compatible';
Refer to Oracle’s Compatibility Matrix for detailed requirements.
Adjust Ubuntu kernel parameters to meet Oracle’s requirements. Edit /etc/sysctl.conf and add:
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
Apply changes with sudo sysctl -p.
Edit /etc/security/limits.conf to increase resource limits for the oracle user:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
Get the Oracle Database installation package from the official website. For Ubuntu, you’ll typically download a .zip or .tar.gz file (RPM packages may require conversion using alien).
Unzip the downloaded file to a temporary directory:
unzip linux.x64_21c_database.zip -d /u01/app/oracle/product/21.0.0/dbhome_1
Edit the oracle user’s .bash_profile to include Oracle environment variables:
export ORACLE_HOME=/u01/app/oracle/product/21.0.0/dbhome_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
Source the file to apply changes:
source ~/.bash_profile
Execute the Oracle Universal Installer (OUI) in silent mode to install the software:
sudo /u01/app/oracle/product/21.0.0/dbhome_1/runInstaller -silent -responseFile /u01/app/oracle/product/21.0.0/dbhome_1/response/db_install.rsp \
ORACLE_HOME=/u01/app/oracle/product/21.0.0/dbhome_1 \
ORACLE_BASE=/u01/app/oracle \
oracle.install.option=INSTALL_DB_SWONLY \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=/u01/app/oraInventory \
SELECTED_LANGUAGES=en \
ORACLE_HOME_NAME=OraDB21Home1
Complete the installation and run the root scripts when prompted:
sudo /u01/app/oraInventory/orainstRoot.sh
sudo /u01/app/oracle/product/21.0.0/dbhome_1/root.sh
Switch to the oracle user and start the database in UPGRADE mode:
sqlplus / as sysdba
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP UPGRADE;
Execute the pre-upgrade script to fix compatibility issues:
cd $ORACLE_HOME/rdbms/admin
sqlplus / as sysdba @preupgrade_fixups.sql
For a GUI-based upgrade, run the Database Upgrade Assistant (DBUA):
dbua
Follow the on-screen instructions to complete the upgrade. DBUA automates most steps and provides progress tracking.
If using DBUA is not feasible, run the upgrade script manually:
sqlplus / as sysdba @catupgrd.sql
This script upgrades the data dictionary and other database components. After completion, run:
sqlplus / as sysdba @utlrp.sql
to recompile invalid objects.
After a successful upgrade, modify the COMPATIBLE parameter to the target version (e.g., 21.0.0) to enable new features:
ALTER SYSTEM SET COMPATIBLE = '21.0.0' SCOPE=SPFILE;
SHUTDOWN IMMEDIATE;
STARTUP;
@utlrp.sql
$ORACLE_BASE/diag/rdbms/<SID>/<SID>/trace/alert_<SID>.log).SELECT version FROM v$instance;
Perform a full backup of the upgraded database to protect against data loss:
rman target /
RUN {
ALLOCATE CHANNEL c1 DEVICE TYPE DISK;
BACKUP DATABASE PLUS ARCHIVELOG FORMAT '/u01/backup/%U';
RELEASE CHANNEL c1;
}
Connect to the database using your applications and run test queries to ensure compatibility. Update connection strings if the ORACLE_SID or ORACLE_HOME has changed.
Use Oracle Enterprise Manager (OEM) or AWR reports to monitor performance. Compare pre- and post-upgrade metrics to identify bottlenecks.
Remove temporary files and old Oracle Home directories to free up disk space.
flashback database (if enabled) to revert to the pre-upgrade state.libaio) and rerun the upgrade.By following these steps, you can successfully upgrade Oracle Database on Ubuntu while minimizing risks and ensuring data integrity. Always refer to the official Oracle documentation for version-specific details.