Ubuntu上Oracle数据库升级步骤是什么
导读:Pre-Upgrade Preparation Before starting the upgrade, ensure the following tasks are completed to avoid issues: Backup t...
Pre-Upgrade Preparation
Before starting the upgrade, ensure the following tasks are completed to avoid issues:
- Backup the Database: Use RMAN to create a full backup (data files, control files, archive logs, and parameter files). For example:
Also back up the entire ORACLE_HOME directory as a fallback.rman target / RUN { ALLOCATE CHANNEL c1 TYPE DISK; BACKUP AS COMPRESSED BACKUPSET DATABASE PLUS ARCHIVELOG; RELEASE CHANNEL c1; }
- Check System Requirements: Verify Ubuntu meets the new Oracle version’s requirements (e.g., kernel parameters like
fs.file-max
,kernel.sem
; user limits in/etc/security/limits.conf
; installed dependencies such aslibaio1
,unixodbc
). - Download New Oracle Software: Get the Oracle Database package from the official website. If converting from RPM (common for Oracle), use
alien
to convert to DEB format for Ubuntu:sudo alien -dv oracle-package.rpm
- Prepare Environment Variables: Edit
~/.bash_profile
to include Oracle-specific variables (adjust paths as needed):
Runexport ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1 export ORACLE_SID=hellodb export PATH=$ORACLE_HOME/bin:$PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH export NLS_LANG='AMERICAN_AMERICA.AL32UTF8'
source ~/.bash_profile
to apply changes.
Install New Oracle Software
- Extract and Install: Unzip the downloaded package and run the silent installer (if using GUI, execute
./runInstaller
from the unzipped directory). For silent install, use a response file (e.g.,response_file.rsp
) with parameters likeORACLE_HOME
,ORACLE_SID
, andUNIX_GROUP_NAME
. Example silent command:./runInstaller -silent -responseFile /path/to/response_file.rsp
- Complete Post-Installation Tasks: After installation, run the root scripts generated by the installer (e.g.,
/u01/app/oraInventory/orainstRoot.sh
,/u01/app/oracle/product/12.2.0/dbhome_1/root.sh
) to set permissions and configure system files.
Run the Upgrade
- Option 1: Use DBUA (Graphical Tool): Start DBUA from the terminal:
Follow the interactive wizard to select the database to upgrade, review pre-upgrade checks, and initiate the process. DBUA automates tasks like fixing configuration issues and updating data dictionary tables.dbua
- Option 2: Manual Upgrade (Command Line): Connect to the database as SYSDBA and run the upgrade script. For example, to upgrade from 11g to 12c:
Thesqlplus / as sysdba SHUTDOWN IMMEDIATE; STARTUP UPGRADE; @?/rdbms/admin/catalog.sql; @?/rdbms/admin/catproc.sql; @?/rdbms/admin/utlrp.sql; -- Recompile invalid objects SHUTDOWN IMMEDIATE; STARTUP;
STARTUP UPGRADE
command starts the database in upgrade mode, and the scripts update the data dictionary and PL/SQL components.
Post-Upgrade Verification
- Check Version: Confirm the upgrade succeeded by querying
v$version
:sqlplus / as sysdba SELECT * FROM v$version;
- Validate Functionality: Run basic queries (e.g.,
SELECT COUNT(*) FROM employees;
) and test critical applications to ensure compatibility. - Recompile Invalid Objects: Recompile any remaining invalid PL/SQL objects using
utlrp.sql
(run as SYSDBA) to avoid runtime errors.
Post-Upgrade Cleanup
- Update Applications: Modify application connection strings to point to the new Oracle instance (e.g., update JDBC URLs, tnsnames.ora entries).
- Archive Old Files: Backup and remove old Oracle Home directories (e.g.,
/u01/app/oracle/product/11.2.0/dbhome_1
) to free up space. - Monitor Performance: Use tools like AWR or Enterprise Manager to track performance and address any regressions (e.g., SQL plan changes).
声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!
若转载请注明出处: Ubuntu上Oracle数据库升级步骤是什么
本文地址: https://pptw.com/jishu/731229.html