暂无图片
暂无图片
9
暂无图片
暂无图片
暂无图片

使用AutoUpgrade升级单实例Oracle 11G到Oracle 19C

1908

目录

一、前言

  今天向大家价绍下如何使用AutoUpgrade工具将单实例Oracle 11G升级到Oracle 19C的详细步骤。随着技术的不断发展,数据库升级已成为保持系统运行稳定性和安全性的必要措施之一。Oracle数据库是业界广泛使用的高性能、可靠性强的关系型数据库管理系统。随着Oracle的版本不断迭代,每个新版本都带来了更多的功能和性能改进,同时也修复了一些旧版本中存在的问题和漏洞。因此,将数据库升级到最新的Oracle 19C版本,将使您能够充分利用新功能,提高系统性能,并获得更好的运维体验。
 
  本文通过使用AutoUpgrade工具进行升级,该工具可以自动化执行大部分升级任务,减少了手动操作的复杂性和潜在的错误。在开始升级之前,请务必备份您的数据库以及相关数据,以防意外情况发生。另外,强烈建议在生产环境之外的测试环境中进行初始的升级尝试,以确保对整个升级过程有充分的了解并熟悉相关操作。最后,希望本技术文档能够帮助到您,并使您能够成功完成Oracle 11G到Oracle 19C的升级过程。祝顺利完成升级!

二、升级前兼容性检查

1、检查Oracle数据库的兼容级别

SQL> show parameter compatible; NAME TYPE VALUE ----------------------------------------------------------------------------------- compatible string 11.2.0.4.0

2、COMPATIBLE初始化参数值

如果源Oracle上的compatible参数设置的值太低,无法升级到Oracle Database 19c,此时必须在源 Oracle Database 版本上设置至少满足Oracle Database 19c升级支持的最小值(11.2.0)。
例如:如果源Oracle Database版本是 Oracle Database release是11.2.0.4,但 compatible 参数是设置为10.0.0,则必须将compatible参数设置为至少支持升级的最小值(11.2.0),然后再升级。
SQL> alter system set compatible=‘11.2.0’ scope=spfile;
注意:更改参数后,必须重新启动数据库!

Oracle数据库版本 默认值 最小值
Oracle Database 19C 19.0.0 11.2.0
Oracle Database 12CR2 12.2.0 11.2.0
Oracle Database 12CR1 12.0.0 11.0.0
Oracle Database 11GR2 11.2.0 10.0.0

三、升级前准备

1、数据库备份

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON; RUN { ALLOCATE CHANNEL d1 TYPE DISK; BACKUP DATABASE FORMAT '/soft/rmanbak/hellodb_%U'; BACKUP CURRENT CONTROLFILE FORMAT '/soft/rmanbak/hellodb_ctl'; }

2、安装新版本Oracle数据库软件

2.1、创建目录并授权

为新版本的 Oracle 数据库选择一个位置,该位置与当前版本的 Oracle 主目录分开。

[root@hellodba ~]# mkdir -p /u01/app/oracle [root@hellodba ~]# mkdir -p /u01/app/oraInventory [root@hellodba ~]# mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1 [root@hellodba ~]# chown -R oracle:oinstall /u01 [root@hellodba ~]# chmod -R 775 /u01

2.2、添加用户组

[root@hellodba ~]# /usr/sbin/groupadd -g 504 backupdba [root@hellodba ~]# /usr/sbin/groupadd -g 505 dgdba [root@hellodba ~]# /usr/sbin/groupadd -g 506 kmdba [root@hellodba ~]# /usr/sbin/usermod -g oinstall -G dba,backupdba,dgdba,kmdba,oper oracle

2.3、修改环境变量

[oracle@hellodba ~]$ cp ~/.bash_profile ~/.bash_profile_bak [oracle@hellodba ~]$ vi ~/.bash_profile umask=022 export PS1 export TMP=/tmp export LANG=en_US.UTF8 export TMPDIR=$TMP export ORACLE_UNQNAME=hellodb export ORACLE_SID=hellodb; export ORACLE_BASE=/u01/app/oracle; export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/dbhome_1; export ORACLE_TERM=xterm; export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_LANG=AMERICAN_AMERICA.UTF8; export PATH=.:$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin; export THREADS_FLAG=native; [oracle@hellodba ~]$ source ~/.bash_profile

2.4、上传Oracle数据库安装软件到服务器并解压

通过oracle用户上传Oracle数据库安装软件到服务器 /soft 目录并解压至$ORACLE_HOME

[root@hellodba ~]# su - oracle [oracle@hellodba ~]$ cd $ORACLE_HOME [oracle@hellodba dbhome_1]$ unzip /soft/LINUX.X64_193000_db_home.zip

2.5、编辑db_install.rsp响应文件

[oracle@hellodba ~]$ cd $ORACLE_HOME/install/response [oracle@hellodba ~]$ echo '' > db_install.rsp [oracle@hellodba soft]$ vi db_install.rsp #软件版本信息 oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v19.0.0 #安装选项-仅安装数据库软件 oracle.install.option=INSTALL_DB_SWONLY #oracle用户用于安装软件的组名 UNIX_GROUP_NAME=oinstall #oracle产品清单目录 INVENTORY_LOCATION=/u01/app/oraInventory #oracle安装目录 ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1 #oracle基础目录 ORACLE_BASE=/u01/app/oracle #安装版本类型:企业版 oracle.install.db.InstallEdition=EE #指定组信息 oracle.install.db.OSDBA_GROUP=dba oracle.install.db.OSOPER_GROUP=oper oracle.install.db.OSBACKUPDBA_GROUP=backupdba oracle.install.db.OSKMDBA_GROUP=kmdba oracle.install.db.OSRACDBA_GROUP=dba oracle.install.db.OSDGDBA_GROUP=dgdba

2.6、安装数据库软件

[root@hellodba ~]# su - oracle [oracle@hellodba ~]$ cd $ORACLE_HOME [oracle@hellodba dbhome_1]$ ./runInstaller -silent -noconfig -responseFile /u01/app/oracle/product/19.0.0/dbhome_1/install/response/db_install.rsp Launching Oracle Database Setup Wizard... The response file for this session can be found at: /u01/app/oracle/product/19.0.0/dbhome_1/install/response/db_2023-12-24_07-15-48PM.rsp You can find the log of this install session at: /u01/oracle/oraInventory/logs/InstallActions2023-12-24_07-15-48PM/installActions2023-12-24_07-15-48PM.log As a root user, execute the following script(s): 1. /u01/app/oracle/product/19.0.0/dbhome_1/root.sh Execute /u01/app/oracle/product/19.0.0/dbhome_1/root.sh on the following nodes: [hellodba] Successfully Setup Software.

2.7、执行配置脚本

[root@hellodba ~]# /u01/app/oracle/product/19.0.0/dbhome_1/root.sh Check /u01/app/oracle/product/19.0.0/dbhome_1/install/root_hellodba_2023-12-24_19-17-26-946744005.log for the output of root script

3、升级前信息检查

3.1、创建autoupgrade配置文件

[oracle@hellodba ~]$ cd /soft [oracle@hellodba soft]$ java -jar /u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/autoupgrade.jar -create_sample_file config Created sample configuration file /soft/sample_config.cfg [oracle@hellodba soft]$ vi sample_config.cfg #日志路径 global.autoupg_log_dir=/tmp/autoupgrade_log #升级完成之后收集数据字典统计信息 global.dictionary_stats_after=yes #升级之前收集数据字典统计信息 global.dictionary_stats_before=yes #升级之前收集固定表统计信息 global.fixed_stats_before=yes #创建闪回点 global.restoration=yes #升级完成之后不删除闪回点,人工确认 global.drop_grp_after_upgrade=no #升级数据库的数据库名 upg1.dbname=hellodb #升级的开始时间 upg1.start_time=NOW #源端DB ORACLE_HOME upg1.source_home=/u01/app/oracle/product/11.2.0/dbhome_1 #源端DB ORACLE_HOME upg1.target_home=/u01/app/oracle/product/19.0.0/dbhome_1 #升级数据库的ORACLE_SID upg1.sid=hellodb #日志目录 upg1.log_dir=/tmp/autoupgrade_log/hellodba #升级节点的hostname upg1.upgrade_node=hellodba #升级之后执行对象编译 dbold.run_utlrp=yes #升级之后,升级时区 dbold.timezone_upg=yes #升级的目标版本19c upg1.target_version=19

3.2、analyze

该命令会生成一个报告,用于检查源数据库是否满足升级条件,并给出相关修改建议。

[oracle@hellodba ~]$ java -jar /u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/autoupgrade.jar -config /soft/sample_config.cfg -mode analyze Autoupgrade tool launched with default options +--------------------------------+ | Starting AutoUpgrade execution | +--------------------------------+ 1 databases will be analyzed Enter some command, type 'help' or 'exit' to quit upg> Job 100 for HELLODB FINISHED

3.3、查看日志

[root@hellodba ~]# cat /tmp/autoupgrade_log/hellodba/100/prechecks/hellodb_preupgrade.log [dbname] [HELLODB] ========================================== [container] [HELLODB] ========================================== [checkname] AMD_EXISTS [stage] PRECHECKS [fixup_available] YES [runfix] YES [severity] WARNING [rule] Starting with Oracle Database 12c, the OLAP Catalog (OLAP AMD) is desupported and will be automatically marked as OPTION OFF during the database upgrade if present. Oracle recommends removing OLAP Catalog (OLAP AMD) before database upgrade. This step can be manually performed before the upgrade to reduce downtime. [broken rule] The OLAP Catalog component, AMD, exists in the database. [action] Remove OLAP Catalog by running the 11.2.0.4.0 SQL script $ORACLE_HOME/olap/admin/catnoamd.sql script. ---------------------------------------------------- [checkname] AWR_DBIDS_PRESENT [stage] POSTCHECKS [fixup_available] YES [runfix] YES [severity] WARNING [rule] Inactve AWR DBIDs should be updated after the upgrade completes. [broken rule] Inactive DBIDs were found in your Automatic Workload Repository (AWR). [action] To update the inactive DBIDs in AWR, run the script awrupd12.sql as SYSDBA. ---------------------------------------------------- [checkname] DICTIONARY_STATS [stage] PRECHECKS [fixup_available] YES [runfix] YES [severity] RECOMMEND [rule] Dictionary statistics help the Oracle optimizer find efficient SQL execution plans and are essential for proper upgrade timing. Oracle recommends gathering dictionary statistics in the last 24 hours before database upgrade.<br><br>For information on managing optimizer statistics, refer to the 11.2.0.4 Oracle Database Performance Tuning Guide. [broken rule] Dictionary statistics do not exist or are stale (not up-to-date). [action] Gather stale data dictionary statistics prior to database upgrade in off-peak time using:<br><br> EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS; ---------------------------------------------------- [checkname] EM_PRESENT [stage] PRECHECKS [fixup_available] YES [runfix] YES [severity] WARNING [rule] Starting with Oracle Database 12c, the local Enterprise Manager Database Control does not exist anymore. The repository will be removed from your database during the upgrade. This step can be manually performed before the upgrade to reduce downtime. [broken rule] The database has an Enterprise Manager Database Control repository. [action] Remove the EM repository.<br><br>- Copy the $ORACLE_HOME/rdbms/admin/emremove.sql script from the target 19 ORACLE_HOME into the source 11.2.0.4.0 ORACLE_HOME.<br><br>Step 1: If database control is configured, stop EM Database Control, using the following command<br><br> $> emctl stop dbconsole<br><br>Step 2: Connect to the database using the SYS account AS SYSDBA<br><br> SET ECHO ON;<br> SET SERVEROUTPUT ON;<br> @emremove.sql<br><br>Without the set echo and serveroutput commands, you will not be able to follow the progress of the script. ---------------------------------------------------- [checkname] EXF_RUL_EXISTS [stage] PRECHECKS [fixup_available] YES [runfix] YES [severity] INFO [rule] Starting with Oracle Database release 12.1, the Expression Filter (EXF) and Database Rules Manager (RUL) features are desupported, and are removed during the upgrade process. This step can be manually performed before the upgrade to reduce downtime. [broken rule] Expression Filter (EXF) or Rules Manager (RUL) exist in the database. [action] Run $ORACLE_HOME/rdbms/admin/catnoexf.sql located in the new Oracle Database Oracle home to remove both EXF and RUL. ---------------------------------------------------- [checkname] TRGOWNER_NO_ADMNDBTRG [stage] PRECHECKS [fixup_available] YES [runfix] YES [severity] RECOMMEND [rule] The creation of database triggers must be done by users granted with ADMINISTER DATABASE TRIGGER privilege. Privilege must have been granted directly. [broken rule] There is one or more database triggers whose owner does not have the right privilege on the database. [action] Directly grant ADMINISTER DATABASE TRIGGER privilege to the owner of the trigger or drop and re-create the trigger with a user that was granted directly with such. You can list those triggers using: SELECT OWNER, TRIGGER_NAME FROM DBA_TRIGGERS WHERE TRIM(BASE_OBJECT_TYPE)='DATABASE' AND OWNER NOT IN (SELECT GRANTEE FROM DBA_SYS_PRIVS WHERE PRIVILEGE='ADMINISTER DATABASE TRIGGER'). ---------------------------------------------------- [checkname] POST_DICTIONARY [stage] POSTCHECKS [fixup_available] YES [runfix] YES [severity] RECOMMEND [rule] Dictionary statistics provide essential information to the Oracle optimizer to help it find efficient SQL execution plans. After a database upgrade, statistics need to be re-gathered as there can now be tables that have significantly changed during the upgrade or new tables that do not have statistics gathered yet. [broken rule] Oracle recommends gathering dictionary statistics after upgrade. [action] Gather dictionary statistics after the upgrade using the command:<br><br> EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS; ---------------------------------------------------- [checkname] POST_FIXED_OBJECTS [stage] POSTCHECKS [fixup_available] YES [runfix] YES [severity] RECOMMEND [rule] Fixed object statistics provide essential information to the Oracle optimizer to help it find efficient SQL execution plans. Those statistics are specific to the Oracle Database release that generates them, and can be stale upon database upgrade.<br><br>For information on managing optimizer statistics, refer to the 11.2.0.4 Oracle Database Performance Tuning Guide. [broken rule] This recommendation is given for all preupgrade runs. [action] Gather statistics on fixed objects after the upgrade and when there is a representative workload on the system using the command:<br><br> EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS; ---------------------------------------------------- [checkname] PRE_FIXED_OBJECTS [stage] PRECHECKS [fixup_available] YES [runfix] YES [severity] RECOMMEND [rule] Gathering statistics on fixed objects, if none have been gathered yet, is recommended prior to upgrading.<br><br>For information on managing optimizer statistics, refer to the 11.2.0.4 Oracle Database Performance Tuning Guide. [broken rule] None of the fixed object tables have had stats collected. [action] Gather statistics on fixed objects prior the upgrade. ---------------------------------------------------- [checkname] OLD_TIME_ZONES_EXIST [stage] POSTCHECKS [fixup_available] YES [runfix] YES [severity] WARNING [rule] Oracle recommends upgrading to the desired (latest) version of the time zone file. For more information, refer to "Upgrading the Time Zone File and Timestamp with Time Zone Data" in the 19 Oracle Database Globalization Support Guide. [broken rule] The database is using time zone file version 14 and the target 19 release ships with time zone file version 32. [action] Upgrade the database time zone file using the DBMS_DST package. ---------------------------------------------------- [checkname] MANDATORY_UPGRADE_CHANGES [stage] PRECHECKS [fixup_available] YES [runfix] YES [severity] INFO [rule] Mandatory changes are required to perform the upgrade. These changes are implemented in the during_ and after_upgrade_pfile_dbname.ora files. [broken rule] [Parameter] |parallel_min_servers='0'| |cluster_database='FALSE'| |job_queue_processes='0'| |parallel_max_servers='0'| [action] Mandatory changes are applied automatically in the during_upgrade_pfile_dbname.ora file. Some of these changes maybe present in the after_upgrade_pfile_dbname.ora file. The during_upgrade_pfile_dbname.ora is used to start the database in upgrade mode. The after_upgrade_pfile_dbname.ora is used to start the database once the upgrade has completed successfully. ---------------------------------------------------- [checkname] RMAN_RECOVERY_VERSION [stage] PRECHECKS [fixup_available] NO [runfix] N/A [severity] INFO [rule] It is good practice to have the catalog schema the same or higher version than the RMAN client version you are using. [broken rule] If you are using a version of the recovery catalog schema that is older than that required by the RMAN client version, then you must upgrade the catalog schema. [action] Check the Oracle Backup and Recovery User's Guide for information on how to manage an RMAN recovery catalog schema. ---------------------------------------------------- [checkname] TABLESPACES_INFO [stage] PRECHECKS [fixup_available] NO [runfix] N/A [severity] INFO [rule] Minimum tablespace sizes for upgrade are estimates. [broken rule] [Tablespace Name|In Use|Allocated|Autoextend Size available|Available|Required size for Upgrade|To Increase|Minimum Required for Upgrade|Add allocated for Upgrade|Filename in Tablespace|Autoextend on|Is TempDB|Is Locally Managed|contents|tbs action] |SYSTEM|739|750|32786416|32767|447734|0|1177|427|/u01/app/oracle/oradata/hellodb/system01.dbf|true|false|true|PERMANENT|None| |TEMP|0|29|33524720|32767|153600|0|150|121|/u01/app/oracle/oradata/hellodb/temp01.dbf|true|true|true|TEMPORARY|None| |UNDOTBS1|13|75|33477616|32767|474518|0|401|326|/u01/app/oracle/oradata/hellodb/undotbs01.dbf|true|false|true|UNDO|None| |SYSAUX|496|530|33011696|32767|264883|0|756|226|/u01/app/oracle/oradata/hellodb/sysaux01.dbf|true|false|true|PERMANENT|None| [action] To help you keep track of your tablespace allocations, the following AUTOEXTEND tablespaces are expected to successfully EXTEND during the upgrade process. ---------------------------------------------------- [checkname] DIR_SYMLINKS [stage] POSTCHECKS [fixup_available] NO [runfix] N/A [severity] WARNING [rule] Starting in Release 18c, symbolic links are not allowed in directory object path names used with BFILE data types, the UTL_FILE package, or external tables. [broken rule] Some directory object path names may currently contain symbolic links. [action] To identify directory objects with symbolic links in the path name, run $ORACLE_HOME/rdbms/admin/utldirsymlink.sql AS SYSDBA after upgrade. Recreate any directory objects listed, using path names that contain no symbolic links. ----------------------------------------------------

3.4、修复不满足的升级条件

3.4.1、删除源库OLAP目录

SQL> @$ORACLE_HOME/olap/admin/catnoamd.sql

3.4.2、删除EM仓库

[oracle@hellodba ~]$ cp /u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/emremove.sql /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin [oracle@hellodba ~]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/rdbms/admin [oracle@hellodba admin]$ sqlplus / as sysdba SQL> @emremove.sql

3.4.3、收集字典统计信息

SQL> EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;

3.4.4、清空数据库回收站

SQL> PURGE DBA_RECYCLEBIN;

四、升级Oracle数据库

1、deploy升级数据库

该命令正式开始升级

[oracle@hellodba ~]$ java -jar /u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/autoupgrade.jar -config /soft/sample_config.cfg -mode deploy Autoupgrade tool launched with default options +--------------------------------+ | Starting AutoUpgrade execution | +--------------------------------+ 1 databases will be processed Enter some command, type 'help' or 'exit' to quit
upg> status ---------------- Config ------------------- User configuration file [/soft/config.txt] General logs location [/tmp/autoupgrade_log/cfgtoollogs/upgrade/auto] Mode [DEPLOY] DB upg fatal errors ORA-00600,ORA-07445 DB Post upgrade abort time [60] minutes DB upg abort time [1440] minutes DB restore abort time [120] minutes DB drop GRP abort time [3] minutes ------------------- Jobs ------------------- Total databases in configuration file [1] Total Non-CDB being processed [1] Total CDB being processed [0] Jobs finished successfully [0] Jobs finished/aborted [0] jobs in progress [1] ------------ Resources ---------------- Threads in use [27] JVM used memory [60] MB CPU in use [13%] Processes in use [21] upg> lsj +----+-------+---------+---------+-------+--------------+--------+--------+-------------+ |JOB#|DB NAME| STAGE|OPERATION| STATUS| START TIME|END TIME| UPDATED| MESSAGE| +----+-------+---------+---------+-------+--------------+--------+--------+-------------+ | 101|HELLODB|PREFIXUPS|EXECUTING|RUNNING|23/12/26 14:37| N/A|14:37:38|Remaining 0/4| +----+-------+---------+---------+-------+--------------+--------+--------+-------------+ upg> status -job 101 Progress ----------------------------------- Start time: 23/12/26 14:37 Elapsed (min): 4 End time: N/A Last update: 2023-12-26T14:41:14.728 Stage: DBUPGRADE Operation: EXECUTING Status: RUNNING Pending stages: 4 Job Logs Locations ----------------------------------- Logs Base: /tmp/autoupgrade_log/hellodba Job logs: /tmp/autoupgrade_log/hellodba/101 Stage logs: /tmp/autoupgrade_log/hellodba/101/dbupgrade TimeZone: /tmp/autoupgrade_log/hellodba/temp Additional information ----------------------------------- Details: [Upgrading] is [19%] completed for [hellodb] +---------+-------------+ |CONTAINER| PERCENTAGE| +---------+-------------+ | HELLODB|UPGRADE [19%]| +---------+-------------+ Error Details: None

通过网页监控升级进度,等待升级完成。

[oracle@hellodba ~]$ cd /tmp/autoupgrade_log/cfgtoollogs/upgrade/auto [oracle@hellodba auto]$ python -m SimpleHTTPServer 8000 // 浏览器访问 http://192.168.0.55:8000/state.html

image.png
image.png
image.png
image.png
image.png
image.png

2、查看升级日志

[root@hellodba ~]# cat /tmp/autoupgrade_log/hellodba/101/dbupgrade_20231228_user.log 2023-12-28 10:30:04.539 INFO Analyzing HELLODB, 80 checks will run using 4 threads 2023-12-28 10:30:10.907 INFO Guarantee Restore Point (GRP) successfully removed [HELLODB][AUTOUPGRADE_221145114461854_HELLODB] 2023-12-28 10:30:11.009 INFO Guarantee Restore Point (GRP) successfully created [HELLODB][AUTOUPGRADE_221145114461854_HELLODB] 2023-12-28 10:30:11.024 INFO Using /tmp/autoupgrade_log/hellodba/101/prechecks/hellodb_checklist.cfg as reference to determine the fixups which will be executed 2023-12-28 10:30:38.643 INFO Analyzing HELLODB, 80 checks will run using 4 threads 2023-12-28 10:31:04.322 INFO Total Number of upgrade phases is 108 2023-12-28 10:31:04.325 INFO Begin Upgrade on Database [hellodb] 2023-12-28 10:31:10.347 INFO [Upgrading] is [0%] completed for [hellodb] +---------+------------+ |CONTAINER| PERCENTAGE| +---------+------------+ | HELLODB|UPGRADE [0%]| +---------+------------+ 2023-12-28 10:34:11.474 INFO [Upgrading] is [18%] completed for [hellodb] +---------+-------------+ |CONTAINER| PERCENTAGE| +---------+-------------+ | HELLODB|UPGRADE [18%]| +---------+-------------+ 2023-12-28 10:37:12.557 INFO [Upgrading] is [37%] completed for [hellodb] +---------+-------------+ |CONTAINER| PERCENTAGE| +---------+-------------+ | HELLODB|UPGRADE [37%]| +---------+-------------+ 2023-12-28 10:40:13.622 INFO [Upgrading] is [49%] completed for [hellodb] +---------+-------------+ |CONTAINER| PERCENTAGE| +---------+-------------+ | HELLODB|UPGRADE [49%]| +---------+-------------+ 2023-12-28 10:43:14.672 INFO [Upgrading] is [61%] completed for [hellodb] +---------+-------------+ |CONTAINER| PERCENTAGE| +---------+-------------+ | HELLODB|UPGRADE [61%]| +---------+-------------+ 2023-12-28 10:46:15.738 INFO [Upgrading] is [84%] completed for [hellodb] +---------+-------------+ |CONTAINER| PERCENTAGE| +---------+-------------+ | HELLODB|UPGRADE [84%]| +---------+-------------+ 2023-12-28 10:49:22.802 INFO [Upgrading] is [95%] completed for [hellodb] +---------+-------------+ |CONTAINER| PERCENTAGE| +---------+-------------+ | HELLODB|UPGRADE [95%]| +---------+-------------+ 2023-12-28 10:50:42.103 INFO SUCCESSFULLY UPGRADED [hellodb] 2023-12-28 10:50:42.103 INFO End Upgrade on Database [hellodb] 2023-12-28 10:50:53.156 INFO Begin Compiling Invalid Objects on Database [hellodb] 2023-12-28 10:52:25.286 INFO [Compiling] is [0%] completed for [hellodb] objects remaining is [3058] +---------+------------+ |CONTAINER| PERCENTAGE| +---------+------------+ | HELLODB|COMPILE [0%]| +---------+------------+ 2023-12-28 10:55:13.312 INFO End Compiling Invalid Objects on Database [hellodb] 2023-12-28 10:55:13.312 INFO SUCCESSFULLY COMPILED [hellodb] 2023-12-28 10:55:15.365 INFO [Upgrading] is [100%] completed for [hellodb] +---------+-------------------------------+ |CONTAINER| PERCENTAGE| +---------+-------------------------------+ | HELLODB|SUCCESSFULLY UPGRADED [hellodb]| +---------+-------------------------------+ 2023-12-28 10:55:15.372 INFO Error opening file [/u01/app/oracle/product/19.0.0/dbhome_1/dbs/inithellodb.ora] for reading. 2023-12-28 10:55:16.404 INFO Creating spfile completed with success 2023-12-28 10:55:16.405 INFO SUCCESSFULLY UPGRADED [hellodb] 2023-12-28 10:55:16.437 INFO hellodb Return status is SUCCESS 2023-12-28 10:56:53.635 INFO Analyzing HELLODB, 6 checks will run using 4 threads 2023-12-28 10:56:55.743 INFO Using /tmp/autoupgrade_log/hellodba/101/postchecks/hellodb_checklist.cfg as reference to determine the fixups which will be executed 2023-12-28 11:01:19.781 INFO Analyzing HELLODB, 6 checks will run using 4 threads
[oracle@hellodba auto]$ cat /tmp/autoupgrade_log/hellodba/101/dbupgrade/upg_summary.log Oracle Database Release 19 Post-Upgrade Status Tool 12-28-2023 10:49:3 Database Name: HELLODB Component Current Full Elapsed Time Name Status Version HH:MM:SS Oracle Server UPGRADED 19.3.0.0.0 00:07:11 JServer JAVA Virtual Machine UPGRADED 19.3.0.0.0 00:01:38 Oracle XDK UPGRADED 19.3.0.0.0 00:00:18 Oracle Database Java Packages UPGRADED 19.3.0.0.0 00:00:06 OLAP Analytic Workspace UPGRADED 19.3.0.0.0 00:00:05 Oracle Text UPGRADED 19.3.0.0.0 00:00:19 Oracle Workspace Manager UPGRADED 19.3.0.0.0 00:00:25 Oracle Real Application Clusters OPTION OFF 19.3.0.0.0 00:00:00 Oracle XML Database UPGRADED 19.3.0.0.0 00:01:32 Oracle Multimedia UPGRADED 19.3.0.0.0 00:00:30 Spatial UPGRADED 19.3.0.0.0 00:02:21 Oracle OLAP API UPGRADED 19.3.0.0.0 00:00:05 Datapatch 00:01:36 Final Actions 00:02:02 Post Upgrade 00:00:12 Total Upgrade Time: 00:17:29 Database time zone version is 14. It is older than current release time zone version 32. Time zone upgrade is needed using the DBMS_DST package. Grand Total Upgrade Time: [0d:0h:24m:26s]

五、升级后的工作

1、删除 restore point

SQL> select name from v$restore_point; NAME ------------------------------------------ AUTOUPGRADE_221145114461854_HELLODB SQL> drop restore point AUTOUPGRADE_221145114461854_HELLODB;

2、设置 COMPATIBLE 初始化参数

SQL> show parameter compatible; NAME TYPE VALUE ---------------------------------------------------------------------------------- compatible string 11.2.0.4.0 noncdb_compatible boolean FALSE SQL> alter system set compatible = '19.0.0' scope=spfile; SQL> shutdown immediate; SQL> startup SQL> show parameter compatible; NAME TYPE VALUE ---------------------------------------------------------------------------------- compatible string 19.0.0 noncdb_compatible boolean FALSE

3、重置密码

SQL> SELECT USERNAME,ACCOUNT_STATUS FROM DBA_USERS WHERE USERNAME IN ('SYS','SYSTEM'); USERNAME ACCOUNT_STATUS --------------------------------------------------------------------------------------- SYSTEM EXPIRED & LOCKED SYS LOCKED SQL> UPDATE USER$ SET ASTATUS=0 WHERE NAME='SYS'; SQL> UPDATE USER$ SET ASTATUS=0 WHERE NAME='SYSTEM'; SQL> COMMIT; SQL> alter system flush shared_pool; SQL> SELECT USERNAME,ACCOUNT_STATUS FROM DBA_USERS WHERE USERNAME IN ('SYS','SYSTEM'); USERNAME ACCOUNT_STATUS --------------------------------------------------------------------------------------- SYSTEM OPEN SYS OPEN SQL> alter user system identified by Hello#123DBA; SQL> alter user sys identified by Hello#123DBA;

4、生成新的密码文件

[oracle@hellodba ~]$ cd $ORACLE_HOME/dbs [oracle@hellodba dbs]$ mv orapwhellodb orapwhellodb_bak [oracle@hellodba dbs]$ orapwd file=orapwhellodb entries=5 Enter password for SYS: Hello#123DBA

5、DB_DOMAIN调整

SQL> show parameter db_domain; NAME TYPE VALUE ----------------------------------------------------------------------------- db_domain string NULL SQL> alter system reset db_domain scope=spfile;(重启生效)

6、清理源库相关文件

[oracle@hellodba ~]$ rm -rf /u01/app/oracle/product/11.2.0/dbhome_1

7、连接测试

[oracle@hellodba ~]$ sqlplus sys/Hello#123DBA@hellodb as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Fri Dec 29 16:16:15 2023 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Last Successful login time: Fri Dec 29 2023 16:16:08 +08:00 Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.3.0.0.0

六、总结

  到此通过AutoUpgrade工具将单实例Oracle 11G升级到Oracle 19C就完成了。AutoUpgrade工具可以自动执行升级任务,减少手动操作的复杂性和潜在错误。它能够自动执行必要的检查、分析和转换操作,大大简化了升级过程。在升级前,务必备份所有重要的数据,升级数据库是一项重大操作,可能会影响到现有的应用程序和业务流程。在进行升级之前,请先评估应用程序和相关环境的兼容性,并与开发团队和业务方进行充分的沟通和协调。建议先在测试环境中进行测试和验证,以确保升级过程的顺利进行,且不会对业务造成负面影响。

七、写在后面

  由于本人有限的能力和知识储备,可能存在错误或疏漏之处,如有错误敬请批评指正!

 
 
公众号:Hello DBA
 
扫码_搜索联合传播样式标准色版.png

最后修改时间:2024-01-03 15:26:19
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
2人已赞赏
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

文章被以下合辑收录

评论