How to Upgrade Oracle Database on Linux
Upgrading Oracle Database on Linux requires meticulous planning to avoid data loss or downtime. Below is a structured, step-by-step guide covering pre-upgrade checks, execution, and post-upgrade validation.
Preparation is critical to a successful upgrade. Follow these steps to minimize risks:
listener.ora, tnsnames.ora, init.ora, spfile). Verify backup integrity with RESTORE VERIFY ONLY.libaio, libaio-devel).yum install libaio libaio-devel gcc glibc for Oracle 19c on CentOS).ORACLE_BASE (e.g., /u01/app/oracle), ORACLE_HOME (e.g., /u01/app/oracle/product/19.0.0/dbhome_1), and ORACLE_SID (e.g., orcl) in the Oracle user’s shell profile (.bash_profile or .bashrc). Source the profile to apply changes.utlu112i.sql script (for 11g to 12c) or equivalent for your upgrade path to check for issues. This script identifies incompatible parameters, missing patches, and objects that need modification. Address all warnings/errors before proceeding.Stop all Oracle-related services to prevent data corruption during the upgrade:
lsnrctl stop as the Oracle user to stop the Oracle Net listener.SYSDBA using SQL*Plus (sqlplus / as sysdba) and execute SHUTDOWN IMMEDIATE. Wait for the database to shut down completely.Choose one of two methods to upgrade the Oracle software:
cd /u01/app/oracle/product/19.0.0/dbhome_1/../dbua.sqlplus / as sysdba.STARTUP UPGRADE;.@?/rdbms/admin/catupgrd.sql. This script updates data dictionary tables to the new version.@?/rdbms/admin/utlrp.sql. This ensures all stored procedures, functions, and triggers work with the new version.Verify the upgrade was successful and the database is functional:
SYSDBA and run SELECT * FROM v$version;. The output should show the target Oracle version.$ORACLE_BASE/diag/rdbms/<db_name>/<instance_name>/trace/alert_<instance_name>.log for errors or warnings during the upgrade.SELECT COMP_NAME, VERSION, STATUS FROM dba_registry;. All components should have a STATUS of VALID.Complete these tasks to finalize the upgrade and optimize the database:
EXEC dbms_stats.gather_schema_stats(user); (for individual schemas) or EXEC dbms_stats.gather_database_stats; (for the entire database).@?/rdbms/admin/utlrp.sql again to recompile any remaining invalid PL/SQL objects.MEMORY_TARGET, SGA_TARGET) in the spfile or pfile to optimize performance for the new version.emca to upgrade the management repository to the new version.By following these steps, you can ensure a smooth and successful Oracle Database upgrade on Linux.