本文概述了如何将现有的多租户数据库升级到Oracle19c。升级可能非常复杂,因此您必须始终阅读升级手册,并在考虑升级生产环境之前进行彻底测试。

请记住,19c本质上是12.2.0.3,因此可能的升级选项与升级到Oracle数据库12c中描述的选项类似。

  • 假设
  • 前置条件
  • 安装19c软件
  • 运行preupgrade.jar
  • 执行升级前操作
  • 升级数据库
  • 执行升级后操作
  • 最后的步骤

假设

本文的重点是升级多租户数据库。如果您的起点是一个非CDB数据库,那么您应该阅读以下文章。

本文假设您的源数据库是支持直接升级到19c的版本。这是整个列表,但请记住,多租户数据库仅从12.1.0.1开始存在。

11.2.0.4, 12.1.0.2, 12.2.0.1, 18

在这个例子中,我们正在进行从12.2到19c的升级。12.1版本的过程非常相似,但升级前和升级后的修复操作可能略有不同。

在开始之前备份所有内容非常重要!其中一些步骤具有破坏性,如果出现问题,您别无选择,只能从备份中恢复并重新启动。

请记住,本文不能代替阅读升级文档。根据安装的选项,每次升级都可能有所不同。

前置条件

通过运行19c预安装软件包,确保您具备所有操作系统先决条件。在OracleLinux上,您可以通过安装预安装软件包来完成此操作。更新其余的软件包可能也是有意义的。

yum install -y oracle-database-preinstall-19c
yum update -y

安装19c软件

您可以在这里更详细地阅读有关安装过程的信息 here,但对于本例,我将简要介绍。以下命令将执行19c软件的静默安装。

export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/dbhome_1
export SOFTWARE_DIR=/u01/software
export ORA_INVENTORY=/u01/app/oraInventory

mkdir -p ${ORACLE_HOME}
cd $ORACLE_HOME

/bin/unzip -oq ${SOFTWARE_DIR}/LINUX.X64_193000_db_home.zip

./runInstaller -ignorePrereq -waitforcompletion -silent                        \
    -responseFile ${ORACLE_HOME}/install/response/db_install.rsp               \
    oracle.install.option=INSTALL_DB_SWONLY                                    \
    ORACLE_HOSTNAME=${ORACLE_HOSTNAME}                                         \
    UNIX_GROUP_NAME=oinstall                                                   \
    INVENTORY_LOCATION=${ORA_INVENTORY}                                        \
    SELECTED_LANGUAGES=en,en_GB                                                \
    ORACLE_HOME=${ORACLE_HOME}                                                 \
    ORACLE_BASE=${ORACLE_BASE}                                                 \
    oracle.install.db.InstallEdition=EE                                        \
    oracle.install.db.OSDBA_GROUP=dba                                          \
    oracle.install.db.OSBACKUPDBA_GROUP=dba                                    \
    oracle.install.db.OSDGDBA_GROUP=dba                                        \
    oracle.install.db.OSKMDBA_GROUP=dba                                        \
    oracle.install.db.OSRACDBA_GROUP=dba                                       \
    SECURITY_UPDATES_VIA_MYORACLESUPPORT=false                                 \
    DECLINE_SECURITY_UPDATES=true

运行提示的root脚本。

As a root user, execute the following script(s):
        1. /u01/app/oracle/product/19.0.0/dbhome_1/root.sh

在这里,您还应该安装最新的补丁,但为了保持简单易懂,我们将放弃这一步骤。

运行 preupgrade.jar

从MOS 884522.1下载最新的“preupgrade.jar”文件。如果您没有MOS访问权限,您可能会错过下一步。

在撰写本文时,最新的preupgrade.jar是19c附带的版本,因此无需下载更新的版本。当您进行升级时,值得检查一下这种情况是否发生了变化。

将最新的“preupgrade.jar”放入19c Oracle HOME目录中。

export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/dbhome_1
cd $ORACLE_HOME/rdbms/admin
unzip -o /u01/software/preupgrade_19_cbuild_??_lf.zip

确保您使用的是源端的Oracle home目录,并运行“preupgrade.jar”。

export ORACLE_SID=cdb1
export ORAENV_ASK=NO
. oraenv
export ORAENV_ASK=YES

export ORACLE_HOME=$ORACLE_BASE/product/12.2.0.1/db_1

$ORACLE_BASE/product/19.0.0/dbhome_1/jdk/bin/java -jar $ORACLE_BASE/product/19.0.0/dbhome_1/rdbms/admin/preupgrade.jar TERMINAL TEXT

以下是针对12.2数据库运行的示例的输出。有根容器、seed和任何用户定义的可插入数据库的输出。

$ $ORACLE_BASE/product/19.0.0/dbhome_1/jdk/bin/java -jar $ORACLE_BASE/product/19.0.0/dbhome_1/rdbms/admin/preupgrade.jar TERMINAL TEXT
Report generated by Oracle Database Pre-Upgrade Information Tool Version
19.0.0.0.0 Build: 1 on 2019-02-27T18:57:00

Upgrade-To version: 19.0.0.0.0

=======================================
Status of the database prior to upgrade
=======================================
      Database Name:  CDB1
     Container Name:  CDB$ROOT
       Container ID:  1
            Version:  12.2.0.1.0
     DB Patch Level:  No Patch Bundle applied
         Compatible:  12.2.0
          Blocksize:  8192
           Platform:  Linux x86 64-bit
      Timezone File:  26
  Database log mode:  NOARCHIVELOG
           Readonly:  FALSE
            Edition:  EE

  Oracle Component                       Upgrade Action    Current Status
  ----------------                       --------------    --------------
  Oracle Server                          [to be upgraded]  VALID
  JServer JAVA Virtual Machine           [to be upgraded]  VALID
  Oracle XDK for Java                    [to be upgraded]  VALID
  Real Application Clusters              [to be upgraded]  OPTION OFF
  Oracle Workspace Manager               [to be upgraded]  VALID
  OLAP Analytic Workspace                [to be upgraded]  VALID
  Oracle Label Security                  [to be upgraded]  VALID
  Oracle Database Vault                  [to be upgraded]  VALID
  Oracle Text                            [to be upgraded]  VALID
  Oracle XML Database                    [to be upgraded]  VALID
  Oracle Java Packages                   [to be upgraded]  VALID
  Oracle Multimedia                      [to be upgraded]  VALID
  Oracle Spatial                         [to be upgraded]  VALID
  Oracle OLAP API                        [to be upgraded]  VALID

==============
BEFORE UPGRADE
==============

  REQUIRED ACTIONS
  ================
  None

  RECOMMENDED ACTIONS
  ===================
  1.  (AUTOFIXUP) Gather stale data dictionary statistics prior to database
      upgrade in off-peak time using:

        EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;

      Dictionary statistics do not exist or are stale (not up-to-date).

      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.

      For information on managing optimizer statistics, refer to the 12.2.0.1
      Oracle Database SQL Tuning Guide.

  2.  (AUTOFIXUP) Gather statistics on fixed objects prior the upgrade.

      None of the fixed object tables have had stats collected.

      Gathering statistics on fixed objects, if none have been gathered yet, is
      recommended prior to upgrading.

      For information on managing optimizer statistics, refer to the 12.2.0.1
      Oracle Database SQL Tuning Guide.

  INFORMATION ONLY
  ================
  3.  To help you keep track of your tablespace allocations, the following
      AUTOEXTEND tablespaces are expected to successfully EXTEND during the
      upgrade process.

                                                 Min Size
      Tablespace                        Size     For Upgrade
      ----------                     ----------  -----------
      SYSAUX                             460 MB       500 MB
      SYSTEM                             800 MB       912 MB
      TEMP                                33 MB       150 MB
      UNDOTBS1                            65 MB       439 MB

      Minimum tablespace sizes for upgrade are estimates.

  4.  No action needed.

      Using default parallel upgrade options, this CDB with 2 PDBs will first
      upgrade the CDB$ROOT, and then upgrade at most 1 PDBs at a time using 2
      parallel processes per PDB.

      The number of PDBs upgraded in parallel and the number of parallel
      processes per PDB can be adjusted as described in Database Upgrade Guide.

  5.  Check the Oracle Backup and Recovery User's Guide for information on how
      to manage an RMAN recovery catalog schema.

      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.

      It is good practice to have the catalog schema the same or higher version
      than the RMAN client version you are using.

  ORACLE GENERATED FIXUP SCRIPT
  =============================
  All of the issues in database CDB1 container CDB$ROOT
  which are identified above as BEFORE UPGRADE "(AUTOFIXUP)" can be resolved by
  executing the following from within the container

    SQL>@/u01/app/oracle/cfgtoollogs/cdb1/preupgrade/preupgrade_fixups.sql

=============
AFTER UPGRADE
=============

  REQUIRED ACTIONS
  ================
  None

  RECOMMENDED ACTIONS
  ===================
  6.  Upgrade the database time zone file using the DBMS_DST package.

      The database is using time zone file version 26 and the target 19 release
      ships with time zone file version 32.

      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.

  7.  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.

      Some directory object path names may currently contain symbolic links.

      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.

  8.  (AUTOFIXUP) Gather dictionary statistics after the upgrade using the
      command:

        EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;

      Oracle recommends gathering dictionary statistics after upgrade.

      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.

  9.  Gather statistics on fixed objects after the upgrade and when there is a
      representative workload on the system using the command:

        EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;

      This recommendation is given for all preupgrade runs.

      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.

      For information on managing optimizer statistics, refer to the 12.2.0.1
      Oracle Database SQL Tuning Guide.

  ORACLE GENERATED FIXUP SCRIPT
  =============================
  All of the issues in database CDB1 container CDB$ROOT
  which are identified above as AFTER UPGRADE "(AUTOFIXUP)" can be resolved by
  executing the following from within the container

    SQL>@/u01/app/oracle/cfgtoollogs/cdb1/preupgrade/postupgrade_fixups.sql


Report generated by Oracle Database Pre-Upgrade Information Tool Version
19.0.0.0.0 Build: 1 on 2019-02-27T18:57:16

Upgrade-To version: 19.0.0.0.0

=======================================
Status of the database prior to upgrade
=======================================
      Database Name:  CDB1
     Container Name:  PDB$SEED
       Container ID:  2
            Version:  12.2.0.1.0
     DB Patch Level:  No Patch Bundle applied
         Compatible:  12.2.0
          Blocksize:  8192
           Platform:  Linux x86 64-bit
      Timezone File:  26
  Database log mode:  NOARCHIVELOG
           Readonly:  TRUE
            Edition:  EE

  Oracle Component                       Upgrade Action    Current Status
  ----------------                       --------------    --------------
  Oracle Server                          [to be upgraded]  VALID
  JServer JAVA Virtual Machine           [to be upgraded]  VALID
  Oracle XDK for Java                    [to be upgraded]  VALID
  Real Application Clusters              [to be upgraded]  OPTION OFF
  Oracle Workspace Manager               [to be upgraded]  VALID
  OLAP Analytic Workspace                [to be upgraded]  VALID
  Oracle Label Security                  [to be upgraded]  VALID
  Oracle Database Vault                  [to be upgraded]  VALID
  Oracle Text                            [to be upgraded]  VALID
  Oracle XML Database                    [to be upgraded]  VALID
  Oracle Java Packages                   [to be upgraded]  VALID
  Oracle Multimedia                      [to be upgraded]  VALID
  Oracle Spatial                         [to be upgraded]  VALID
  Oracle OLAP API                        [to be upgraded]  VALID

==============
BEFORE UPGRADE
==============

  REQUIRED ACTIONS
  ================
  None

  RECOMMENDED ACTIONS
  ===================
  1.  (AUTOFIXUP) Gather stale data dictionary statistics prior to database
      upgrade in off-peak time using:

        EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;

      Dictionary statistics do not exist or are stale (not up-to-date).

      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.

      For information on managing optimizer statistics, refer to the 12.2.0.1
      Oracle Database SQL Tuning Guide.

  2.  (AUTOFIXUP) Gather statistics on fixed objects prior the upgrade.

      None of the fixed object tables have had stats collected.

      Gathering statistics on fixed objects, if none have been gathered yet, is
      recommended prior to upgrading.

      For information on managing optimizer statistics, refer to the 12.2.0.1
      Oracle Database SQL Tuning Guide.

  INFORMATION ONLY
  ================
  3.  To help you keep track of your tablespace allocations, the following
      AUTOEXTEND tablespaces are expected to successfully EXTEND during the
      upgrade process.

                                                 Min Size
      Tablespace                        Size     For Upgrade
      ----------                     ----------  -----------
      SYSAUX                             330 MB       500 MB
      SYSTEM                             250 MB       360 MB
      TEMP                                64 MB       150 MB
      UNDOTBS1                           100 MB       439 MB

      Minimum tablespace sizes for upgrade are estimates.

  4.  No action needed.

      Using default parallel upgrade options, this CDB with 1 PDBs will first
      upgrade the CDB$ROOT, and then upgrade at most 1 PDBs at a time using 2
      parallel processes per PDB.

      The number of PDBs upgraded in parallel and the number of parallel
      processes per PDB can be adjusted as described in Database Upgrade Guide.

  5.  Check the Oracle Backup and Recovery User's Guide for information on how
      to manage an RMAN recovery catalog schema.

      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.

      It is good practice to have the catalog schema the same or higher version
      than the RMAN client version you are using.

  ORACLE GENERATED FIXUP SCRIPT
  =============================
  All of the issues in database CDB1 container PDB$SEED
  which are identified above as BEFORE UPGRADE "(AUTOFIXUP)" can be resolved by
  executing the following from within the container

    SQL>@/u01/app/oracle/cfgtoollogs/cdb1/preupgrade/preupgrade_fixups.sql

=============
AFTER UPGRADE
=============

  REQUIRED ACTIONS
  ================
  None

  RECOMMENDED ACTIONS
  ===================
  6.  Upgrade the database time zone file using the DBMS_DST package.

      The database is using time zone file version 26 and the target 19 release
      ships with time zone file version 32.

      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.

  7.  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.

      Some directory object path names may currently contain symbolic links.

      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.

  8.  (AUTOFIXUP) Gather dictionary statistics after the upgrade using the
      command:

        EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;

      Oracle recommends gathering dictionary statistics after upgrade.

      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.

  9.  Gather statistics on fixed objects after the upgrade and when there is a
      representative workload on the system using the command:

        EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;

      This recommendation is given for all preupgrade runs.

      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.

      For information on managing optimizer statistics, refer to the 12.2.0.1
      Oracle Database SQL Tuning Guide.

  ORACLE GENERATED FIXUP SCRIPT
  =============================
  All of the issues in database CDB1 container PDB$SEED
  which are identified above as AFTER UPGRADE "(AUTOFIXUP)" can be resolved by
  executing the following from within the container

    SQL>@/u01/app/oracle/cfgtoollogs/cdb1/preupgrade/postupgrade_fixups.sql


Report generated by Oracle Database Pre-Upgrade Information Tool Version
19.0.0.0.0 Build: 1 on 2019-02-27T18:57:29

Upgrade-To version: 19.0.0.0.0

=======================================
Status of the database prior to upgrade
=======================================
      Database Name:  CDB1
     Container Name:  PDB1
       Container ID:  3
            Version:  12.2.0.1.0
     DB Patch Level:  No Patch Bundle applied
         Compatible:  12.2.0
          Blocksize:  8192
           Platform:  Linux x86 64-bit
      Timezone File:  26
  Database log mode:  NOARCHIVELOG
           Readonly:  FALSE
            Edition:  EE

  Oracle Component                       Upgrade Action    Current Status
  ----------------                       --------------    --------------
  Oracle Server                          [to be upgraded]  VALID
  JServer JAVA Virtual Machine           [to be upgraded]  VALID
  Oracle XDK for Java                    [to be upgraded]  VALID
  Real Application Clusters              [to be upgraded]  OPTION OFF
  Oracle Workspace Manager               [to be upgraded]  VALID
  OLAP Analytic Workspace                [to be upgraded]  VALID
  Oracle Label Security                  [to be upgraded]  VALID
  Oracle Database Vault                  [to be upgraded]  VALID
  Oracle Text                            [to be upgraded]  VALID
  Oracle XML Database                    [to be upgraded]  VALID
  Oracle Java Packages                   [to be upgraded]  VALID
  Oracle Multimedia                      [to be upgraded]  VALID
  Oracle Spatial                         [to be upgraded]  VALID
  Oracle OLAP API                        [to be upgraded]  VALID

==============
BEFORE UPGRADE
==============

  REQUIRED ACTIONS
  ================
  None

  RECOMMENDED ACTIONS
  ===================
  1.  (AUTOFIXUP) Gather stale data dictionary statistics prior to database
      upgrade in off-peak time using:

        EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;

      Dictionary statistics do not exist or are stale (not up-to-date).

      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.

      For information on managing optimizer statistics, refer to the 12.2.0.1
      Oracle Database SQL Tuning Guide.

  2.  (AUTOFIXUP) Gather statistics on fixed objects prior the upgrade.

      None of the fixed object tables have had stats collected.

      Gathering statistics on fixed objects, if none have been gathered yet, is
      recommended prior to upgrading.

      For information on managing optimizer statistics, refer to the 12.2.0.1
      Oracle Database SQL Tuning Guide.

  INFORMATION ONLY
  ================
  3.  To help you keep track of your tablespace allocations, the following
      AUTOEXTEND tablespaces are expected to successfully EXTEND during the
      upgrade process.

                                                 Min Size
      Tablespace                        Size     For Upgrade
      ----------                     ----------  -----------
      SYSAUX                             680 MB       709 MB
      SYSTEM                             350 MB       464 MB
      TEMP                                64 MB       150 MB
      UNDOTBS1                           390 MB       441 MB

      Minimum tablespace sizes for upgrade are estimates.

  4.  No action needed.

      Using default parallel upgrade options, this CDB with 1 PDBs will first
      upgrade the CDB$ROOT, and then upgrade at most 1 PDBs at a time using 2
      parallel processes per PDB.

      The number of PDBs upgraded in parallel and the number of parallel
      processes per PDB can be adjusted as described in Database Upgrade Guide.

  5.  Check the Oracle Backup and Recovery User's Guide for information on how
      to manage an RMAN recovery catalog schema.

      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.

      It is good practice to have the catalog schema the same or higher version
      than the RMAN client version you are using.

  ORACLE GENERATED FIXUP SCRIPT
  =============================
  All of the issues in database CDB1 container PDB1
  which are identified above as BEFORE UPGRADE "(AUTOFIXUP)" can be resolved by
  executing the following from within the container

    SQL>@/u01/app/oracle/cfgtoollogs/cdb1/preupgrade/preupgrade_fixups.sql

=============
AFTER UPGRADE
=============

  REQUIRED ACTIONS
  ================
  None

  RECOMMENDED ACTIONS
  ===================
  6.  Upgrade the database time zone file using the DBMS_DST package.

      The database is using time zone file version 26 and the target 19 release
      ships with time zone file version 32.

      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.

  7.  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.

      Some directory object path names may currently contain symbolic links.

      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.

  8.  (AUTOFIXUP) Gather dictionary statistics after the upgrade using the
      command:

        EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;

      Oracle recommends gathering dictionary statistics after upgrade.

      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.

  9.  Gather statistics on fixed objects after the upgrade and when there is a
      representative workload on the system using the command:

        EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;

      This recommendation is given for all preupgrade runs.

      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.

      For information on managing optimizer statistics, refer to the 12.2.0.1
      Oracle Database SQL Tuning Guide.

  ORACLE GENERATED FIXUP SCRIPT
  =============================
  All of the issues in database CDB1 container PDB1
  which are identified above as AFTER UPGRADE "(AUTOFIXUP)" can be resolved by
  executing the following from within the container

    SQL>@/u01/app/oracle/cfgtoollogs/cdb1/preupgrade/postupgrade_fixups.sql


==================
PREUPGRADE SUMMARY
==================
  /u01/app/oracle/cfgtoollogs/cdb1/preupgrade/preupgrade.log
  /u01/app/oracle/cfgtoollogs/cdb1/preupgrade/preupgrade_fixups.sql
  /u01/app/oracle/cfgtoollogs/cdb1/preupgrade/postupgrade_fixups.sql

Execute fixup scripts across the entire CDB:

Before upgrade:

1. Execute preupgrade fixups with the below command
$ORACLE_HOME/perl/bin/perl -I$ORACLE_HOME/perl/lib -I$ORACLE_HOME/rdbms/admin $ORACLE_HOME/rdbms/admin/catcon.pl -l /u01/app/oracle/cfgtoollogs/cdb1/preupgrade/ -b preup_cdb1 /u01/app/oracle/cfgtoollogs/cdb1/preupgrade/preupgrade_fixups.sql

2. Review logs under /u01/app/oracle/cfgtoollogs/cdb1/preupgrade/

After the upgrade:

1. Execute postupgrade fixups with the below command
$ORACLE_HOME/perl/bin/perl -I$ORACLE_HOME/perl/lib -I$ORACLE_HOME/rdbms/admin $ORACLE_HOME/rdbms/admin/catcon.pl -l /u01/app/oracle/cfgtoollogs/cdb1/preupgrade/ -b postup_cdb1 /u01/app/oracle/cfgtoollogs/cdb1/preupgrade/postupgrade_fixups.sql

2. Review logs under /u01/app/oracle/cfgtoollogs/cdb1/preupgrade/

Preupgrade complete: 2019-02-27T18:57:34
$

执行升级前操作

“preupgrade.jar”的输出列出了许多升级前的建议。有些必须手动应用。其他的则包含在“preupgrade_fixups.sql”脚本中。在下面的示例中,我们将只运行“preupgrade_fixups.sql”脚本并重新编译无效对象。请记住,在多租户数据库中,我们必须在根、seed和所有用户定义的可插拔数据库上运行升级前操作。

$ORACLE_HOME/perl/bin/perl \
    -I$ORACLE_HOME/perl/lib \
    -I$ORACLE_HOME/rdbms/admin \
    $ORACLE_HOME/rdbms/admin/catcon.pl \
    -l /u01/app/oracle/cfgtoollogs/cdb1/preupgrade/ \
    -b preup_${ORACLE_SID} \
    /u01/app/oracle/cfgtoollogs/${ORACLE_SID}/preupgrade/preupgrade_fixups.sql

我们可以使用以下命令重新编译除seed数据库之外的所有容器中的无效对象。

$ORACLE_HOME/perl/bin/perl \
    -I$ORACLE_HOME/perl/lib \
    -I$ORACLE_HOME/rdbms/admin \
    $ORACLE_HOME/rdbms/admin/catcon.pl \
    -l /u01/app/oracle/cfgtoollogs/${ORACLE_SID}/preupgrade/ \
    -b preup_${ORACLE_SID}_recompile \
    -C 'PDB$SEED' \
    $ORACLE_HOME/rdbms/admin/utlrp.sql

升级数据库

升级前操作完成后,我们可以开始升级。关闭源数据库。

sqlplus / as sysdba <<EOF
shutdown immediate;
exit;
EOF

将配置文件从旧的ORACLE HOME复制到新的ORACLE HOME。您应该检查“listener.ora”文件的内容,看看是否有对ORACLE HOME的引用。如果有,请修改它们。

cp $ORACLE_HOME/network/admin/*.ora $ORACLE_BASE/product/19.0.0/dbhome_1/network/admin

# Add this to $ORACLE_BASE/product/19.0.0/dbhome_1/network/admin/sqlnet.ora
# Need to correct password versions and remove this.
cat >> $ORACLE_BASE/product/19.0.0/dbhome_1/network/admin/sqlnet.ora <<EOF
# This should be temporary while you deal with old passwords.
SQLNET.ALLOWED_LOGON_VERSION_SERVER=11
EOF

cp $ORACLE_HOME/dbs/orapw${ORACLE_SID} $ORACLE_BASE/product/19.0.0/dbhome_1/dbs/
cp $ORACLE_HOME/dbs/spfile${ORACLE_SID}.ora $ORACLE_BASE/product/19.0.0/dbhome_1/dbs/

切换到19c的监听

lsnrctl stop

export ORACLE_HOME=$ORACLE_BASE/product/19.0.0/dbhome_1
export PATH=${ORACLE_HOME}/bin:$PATH

lsnrctl start

使用19c Oracle home启动数据库,为升级做好准备。所有用户定义的PDB也必须在升级模式下打开,否则它们将不包括在升级中,并且以后需要手动升级。

sqlplus / as sysdba <<EOF
startup upgrade;
alter pluggable database all open upgrade force;
exit;
EOF

您可以使用以下任一命令运行升级。第二种实际上只是前者的简写。

# Regular upgrade command.
cd $ORACLE_HOME/rdbms/admin
$ORACLE_HOME/perl/bin/perl catctl.pl catupgrd.sql

# Shorthand command.
$ORACLE_HOME/bin/dbupgrade

以下是针对12.2多租户数据库运行的示例的输出。输出看起来相当长,因为升级是针对root、seed和用户定义的PDB运行的。

$ $ORACLE_HOME/bin/dbupgrade

Argument list for [/u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/catctl.pl]
For Oracle internal use only A = 0
Run in                       c = 0
Do not run in                C = 0
Input Directory              d = 0
Echo OFF                     e = 1
Simulate                     E = 0
Forced cleanup               F = 0
Log Id                       i = 0
Child Process                I = 0
Log Dir                      l = 0
Priority List Name           L = 0
Upgrade Mode active          M = 0
SQL Process Count            n = 0
SQL PDB Process Count        N = 0
Open Mode Normal             o = 0
Start Phase                  p = 0
End Phase                    P = 0
Reverse Order                r = 0
AutoUpgrade Resume           R = 0
Script                       s = 0
Serial Run                   S = 0
RO User Tablespaces          T = 0
Display Phases               y = 0
Debug catcon.pm              z = 0
Debug catctl.pl              Z = 0

catctl.pl VERSION: [19.0.0.0.0]
           STATUS: [Production]
            BUILD: [RDBMS_19.2.0.0.0_LINUX.X64_190204]


/u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/orahome = [/u01/app/oracle/product/19.0.0/dbhome_1]
/u01/app/oracle/product/19.0.0/dbhome_1/bin/orabasehome = [/u01/app/oracle/product/19.0.0/dbhome_1]
catctlGetOraBaseLogDir = [/u01/app/oracle/product/19.0.0/dbhome_1]

Analyzing file /u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/catupgrd.sql

Log file directory = [/tmp/cfgtoollogs/upgrade20190227190442]

catcon::set_log_file_base_path: ALL catcon-related output will be written to [/tmp/cfgtoollogs/upgrade20190227190442/catupgrd_catcon_9307.lst]

catcon::set_log_file_base_path: catcon: See [/tmp/cfgtoollogs/upgrade20190227190442/catupgrd*.log] files for output generated by scripts

catcon::set_log_file_base_path: catcon: See [/tmp/cfgtoollogs/upgrade20190227190442/catupgrd_*.lst] files for spool files, if any


Number of Cpus        = 2
Database Name         = cdb1
DataBase Version      = 12.2.0.1.0
catcon::set_log_file_base_path: ALL catcon-related output will be written to [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444/catupgrdcdbroot_catcon_9307.lst]

catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444/catupgrdcdbroot*.log] files for output generated by scripts

catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444/catupgrdcdbroot_*.lst] files for spool files, if any


Log file directory = [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444]

Generated PDB Inclusion:[PDB$SEED PDB1]
Components in [CDB$ROOT]
    Installed [APS CATALOG CATJAVA CATPROC CONTEXT DV JAVAVM OLS ORDIM OWM SDO XDB XML XOQ]
Not Installed [APEX EM MGW ODM RAC WK]
Parallel SQL Process Count (PDB)      = 2
Parallel SQL Process Count (CDB$ROOT) = 4
Concurrent PDB Upgrades               = 2

------------------------------------------------------
Phases [0-107]         Start Time:[2019_02_27 19:04:45]
Container Lists Inclusion:[CDB$ROOT] Exclusion:[NONE]
------------------------------------------------------
***********   Executing Change Scripts   ***********
Serial   Phase #:0    [CDB$ROOT] Files:1    Time: 23s
***************   Catalog Core SQL   ***************
Serial   Phase #:1    [CDB$ROOT] Files:5    Time: 32s
Restart  Phase #:2    [CDB$ROOT] Files:1    Time: 1s
***********   Catalog Tables and Views   ***********
Parallel Phase #:3    [CDB$ROOT] Files:19   Time: 15s
Restart  Phase #:4    [CDB$ROOT] Files:1    Time: 0s
*************   Catalog Final Scripts   ************
Serial   Phase #:5    [CDB$ROOT] Files:7    Time: 13s
*****************   Catproc Start   ****************
Serial   Phase #:6    [CDB$ROOT] Files:1    Time: 10s
*****************   Catproc Types   ****************
Serial   Phase #:7    [CDB$ROOT] Files:2    Time: 9s
Restart  Phase #:8    [CDB$ROOT] Files:1    Time: 0s
****************   Catproc Tables   ****************
Parallel Phase #:9    [CDB$ROOT] Files:67   Time: 22s
Restart  Phase #:10   [CDB$ROOT] Files:1    Time: 1s
*************   Catproc Package Specs   ************
Serial   Phase #:11   [CDB$ROOT] Files:1    Time: 52s
Restart  Phase #:12   [CDB$ROOT] Files:1    Time: 1s
**************   Catproc Procedures   **************
Parallel Phase #:13   [CDB$ROOT] Files:94   Time: 7s
Restart  Phase #:14   [CDB$ROOT] Files:1    Time: 0s
Parallel Phase #:15   [CDB$ROOT] Files:120  Time: 13s
Restart  Phase #:16   [CDB$ROOT] Files:1    Time: 0s
Serial   Phase #:17   [CDB$ROOT] Files:22   Time: 3s
Restart  Phase #:18   [CDB$ROOT] Files:1    Time: 0s
*****************   Catproc Views   ****************
Parallel Phase #:19   [CDB$ROOT] Files:32   Time: 16s
Restart  Phase #:20   [CDB$ROOT] Files:1    Time: 0s
Serial   Phase #:21   [CDB$ROOT] Files:3    Time: 12s
Restart  Phase #:22   [CDB$ROOT] Files:1    Time: 0s
Parallel Phase #:23   [CDB$ROOT] Files:25   Time: 136s
Restart  Phase #:24   [CDB$ROOT] Files:1    Time: 0s
Parallel Phase #:25   [CDB$ROOT] Files:12   Time: 83s
Restart  Phase #:26   [CDB$ROOT] Files:1    Time: 0s
Serial   Phase #:27   [CDB$ROOT] Files:1    Time: 0s
Serial   Phase #:28   [CDB$ROOT] Files:3    Time: 5s
Serial   Phase #:29   [CDB$ROOT] Files:1    Time: 0s
Restart  Phase #:30   [CDB$ROOT] Files:1    Time: 0s
***************   Catproc CDB Views   **************
Serial   Phase #:31   [CDB$ROOT] Files:1    Time: 0s
Restart  Phase #:32   [CDB$ROOT] Files:1    Time: 1s
Serial   Phase #:34   [CDB$ROOT] Files:1    Time: 0s
*****************   Catproc PLBs   *****************
Serial   Phase #:35   [CDB$ROOT] Files:293  Time: 19s
Serial   Phase #:36   [CDB$ROOT] Files:1    Time: 0s
Restart  Phase #:37   [CDB$ROOT] Files:1    Time: 1s
Serial   Phase #:38   [CDB$ROOT] Files:6    Time: 2s
Restart  Phase #:39   [CDB$ROOT] Files:1    Time: 0s
***************   Catproc DataPump   ***************
Serial   Phase #:40   [CDB$ROOT] Files:3    Time: 44s
Restart  Phase #:41   [CDB$ROOT] Files:1    Time: 1s
******************   Catproc SQL   *****************
Parallel Phase #:42   [CDB$ROOT] Files:13   Time: 85s
Restart  Phase #:43   [CDB$ROOT] Files:1    Time: 0s
Parallel Phase #:44   [CDB$ROOT] Files:11   Time: 7s
Restart  Phase #:45   [CDB$ROOT] Files:1    Time: 0s
Parallel Phase #:46   [CDB$ROOT] Files:3    Time: 2s
Restart  Phase #:47   [CDB$ROOT] Files:1    Time: 0s
*************   Final Catproc scripts   ************
Serial   Phase #:48   [CDB$ROOT] Files:1    Time: 7s
Restart  Phase #:49   [CDB$ROOT] Files:1    Time: 0s
**************   Final RDBMS scripts   *************
Serial   Phase #:50   [CDB$ROOT] Files:1    Time: 3s
************   Upgrade Component Start   ***********
Serial   Phase #:51   [CDB$ROOT] Files:1    Time: 0s
Restart  Phase #:52   [CDB$ROOT] Files:1    Time: 0s
**********   Upgrading Java and non-Java   *********
Serial   Phase #:53   [CDB$ROOT] Files:2    Time: 234s
*****************   Upgrading XDB   ****************
Restart  Phase #:54   [CDB$ROOT] Files:1    Time: 0s
Serial   Phase #:56   [CDB$ROOT] Files:3    Time: 5s
Serial   Phase #:57   [CDB$ROOT] Files:3    Time: 2s
Parallel Phase #:58   [CDB$ROOT] Files:10   Time: 2s
Parallel Phase #:59   [CDB$ROOT] Files:25   Time: 4s
Serial   Phase #:60   [CDB$ROOT] Files:4    Time: 6s
Serial   Phase #:61   [CDB$ROOT] Files:1    Time: 0s
Serial   Phase #:62   [CDB$ROOT] Files:32   Time: 2s
Serial   Phase #:63   [CDB$ROOT] Files:1    Time: 0s
Parallel Phase #:64   [CDB$ROOT] Files:6    Time: 6s
Serial   Phase #:65   [CDB$ROOT] Files:2    Time: 15s
Serial   Phase #:66   [CDB$ROOT] Files:3    Time: 21s
****************   Upgrading ORDIM   ***************
Restart  Phase #:67   [CDB$ROOT] Files:1    Time: 1s
Serial   Phase #:69   [CDB$ROOT] Files:1    Time: 1s
Parallel Phase #:70   [CDB$ROOT] Files:2    Time: 21s
Restart  Phase #:71   [CDB$ROOT] Files:1    Time: 1s
Parallel Phase #:72   [CDB$ROOT] Files:2    Time: 0s
Serial   Phase #:73   [CDB$ROOT] Files:2    Time: 1s
*****************   Upgrading SDO   ****************
Restart  Phase #:74   [CDB$ROOT] Files:1    Time: 0s
Serial   Phase #:76   [CDB$ROOT] Files:1    Time: 31s
Serial   Phase #:77   [CDB$ROOT] Files:2    Time: 3s
Restart  Phase #:78   [CDB$ROOT] Files:1    Time: 0s
Serial   Phase #:79   [CDB$ROOT] Files:1    Time: 35s
Restart  Phase #:80   [CDB$ROOT] Files:1    Time: 0s
Parallel Phase #:81   [CDB$ROOT] Files:3    Time: 39s
Restart  Phase #:82   [CDB$ROOT] Files:1    Time: 0s
Serial   Phase #:83   [CDB$ROOT] Files:1    Time: 4s
Restart  Phase #:84   [CDB$ROOT] Files:1    Time: 0s
Serial   Phase #:85   [CDB$ROOT] Files:1    Time: 9s
Restart  Phase #:86   [CDB$ROOT] Files:1    Time: 0s
Parallel Phase #:87   [CDB$ROOT] Files:4    Time: 60s
Restart  Phase #:88   [CDB$ROOT] Files:1    Time: 1s
Serial   Phase #:89   [CDB$ROOT] Files:1    Time: 0s
Restart  Phase #:90   [CDB$ROOT] Files:1    Time: 1s
Serial   Phase #:91   [CDB$ROOT] Files:2    Time: 6s
Restart  Phase #:92   [CDB$ROOT] Files:1    Time: 0s
Serial   Phase #:93   [CDB$ROOT] Files:1    Time: 3s
Restart  Phase #:94   [CDB$ROOT] Files:1    Time: 0s
*******   Upgrading ODM, WK, EXF, RUL, XOQ   *******
Serial   Phase #:95   [CDB$ROOT] Files:1    Time: 10s
Restart  Phase #:96   [CDB$ROOT] Files:1    Time: 0s
***********   Final Component scripts    ***********
Serial   Phase #:97   [CDB$ROOT] Files:1    Time: 2s
*************   Final Upgrade scripts   ************
Serial   Phase #:98   [CDB$ROOT] Files:1    Time: 9s
*******************   Migration   ******************
Serial   Phase #:99   [CDB$ROOT] Files:1    Time: 2s
***   End PDB Application Upgrade Pre-Shutdown   ***
Serial   Phase #:100  [CDB$ROOT] Files:1    Time: 21s
Serial   Phase #:101  [CDB$ROOT] Files:1    Time: 0s
Serial   Phase #:102  [CDB$ROOT] Files:1    Time: 36s
*****************   Post Upgrade   *****************
Serial   Phase #:103  [CDB$ROOT] Files:1    Time: 11s
****************   Summary report   ****************
Serial   Phase #:104  [CDB$ROOT] Files:1    Time: 1s
***   End PDB Application Upgrade Post-Shutdown   **
Serial   Phase #:105  [CDB$ROOT] Files:1    Time: 7s
Serial   Phase #:106  [CDB$ROOT] Files:1    Time: 0s
Serial   Phase #:107  [CDB$ROOT] Files:1     Time: 64s

------------------------------------------------------
Phases [0-107]         End Time:[2019_02_27 19:26:28]
Container Lists Inclusion:[CDB$ROOT] Exclusion:[NONE]
------------------------------------------------------

Start processing of PDBs (PDB$SEED)
[/u01/app/oracle/product/19.0.0/dbhome_1/perl/bin/perl /u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/catctl.pl -I -i pdb_seed -n 2 -c 'PDB$SEED' -l /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444 /u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/catupgrd.sql]

Start processing of PDBs (PDB1)
[/u01/app/oracle/product/19.0.0/dbhome_1/perl/bin/perl /u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/catctl.pl -I -i pdb1 -n 2 -c 'PDB1' -l /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444 /u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/catupgrd.sql]

Argument list for [/u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/catctl.pl]
For Oracle internal use only A = 0
Run in                       c = PDB1
Do not run in                C = 0
Input Directory              d = 0
Echo OFF                     e = 1
Simulate                     E = 0
Forced cleanup               F = 0
Log Id                       i = pdb1
Child Process                I = 1
Log Dir                      l = /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444
Priority List Name           L = 0
Upgrade Mode active          M = 0
SQL Process Count            n = 2
SQL PDB Process Count        N = 0
Open Mode Normal             o = 0
Start Phase                  p = 0
End Phase                    P = 0
Reverse Order                r = 0
AutoUpgrade Resume           R = 0
Script                       s = 0
Serial Run                   S = 0
RO User Tablespaces          T = 0
Display Phases               y = 0
Debug catcon.pm              z = 0
Debug catctl.pl              Z = 0

catctl.pl VERSION: [19.0.0.0.0]
           STATUS: [Production]
            BUILD: [RDBMS_19.2.0.0.0_LINUX.X64_190204]



Argument list for [/u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/catctl.pl]
For Oracle internal use only A = 0
Run in                       c = PDB$SEED
Do not run in                C = 0
Input Directory              d = 0
Echo OFF                     e = 1
Simulate                     E = 0
Forced cleanup               F = 0
Log Id                       i = pdb_seed
Child Process                I = 1
Log Dir                      l = /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444
Priority List Name           L = 0
Upgrade Mode active          M = 0
SQL Process Count            n = 2
SQL PDB Process Count        N = 0
Open Mode Normal             o = 0
Start Phase                  p = 0
End Phase                    P = 0
Reverse Order                r = 0
AutoUpgrade Resume           R = 0
Script                       s = 0
Serial Run                   S = 0
RO User Tablespaces          T = 0
Display Phases               y = 0
Debug catcon.pm              z = 0
Debug catctl.pl              Z = 0

catctl.pl VERSION: [19.0.0.0.0]
           STATUS: [Production]
            BUILD: [RDBMS_19.2.0.0.0_LINUX.X64_190204]


/u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/orahome = [/u01/app/oracle/product/19.0.0/dbhome_1]
/u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/orahome = [/u01/app/oracle/product/19.0.0/dbhome_1]
/u01/app/oracle/product/19.0.0/dbhome_1/bin/orabasehome = [/u01/app/oracle/product/19.0.0/dbhome_1]
catctlGetOraBaseLogDir = [/u01/app/oracle/product/19.0.0/dbhome_1]

Analyzing file /u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/catupgrd.sql

Log file directory = [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444]

/u01/app/oracle/product/19.0.0/dbhome_1/bin/orabasehome = [/u01/app/oracle/product/19.0.0/dbhome_1]
catctlGetOraBaseLogDir = [/u01/app/oracle/product/19.0.0/dbhome_1]

Analyzing file /u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/catupgrd.sql

Log file directory = [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444]

catcon::set_log_file_base_path: ALL catcon-related output will be written to [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444/catupgrdpdb_seed_catcon_17759.lst]

catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444/catupgrdpdb_seed*.log] files for output generated by scripts

catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444/catupgrdpdb_seed_*.lst] files for spool files, if any

catcon::set_log_file_base_path: ALL catcon-related output will be written to [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444/catupgrdpdb1_catcon_17761.lst]

catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444/catupgrdpdb1*.log] files for output generated by scripts

catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444/catupgrdpdb1_*.lst] files for spool files, if any


Number of Cpus        = 2

Number of Cpus        = 2
Database Name         = cdb1
Database Name         = cdb1
DataBase Version      = 19.0.0.0.0
DataBase Version      = 19.0.0.0.0
PDB$SEED Open Mode = [MIGRATE]
Generated PDB Inclusion:[PDB$SEED]
CDB$ROOT  Open Mode = [OPEN]
Components in [PDB$SEED]
    Installed [APS CATALOG CATJAVA CATPROC CONTEXT DV JAVAVM OLS ORDIM OWM SDO XDB XML XOQ]
Not Installed [APEX EM MGW ODM RAC WK]
PDB1 Open Mode = [MIGRATE]
Generated PDB Inclusion:[PDB1]
CDB$ROOT  Open Mode = [OPEN]
Components in [PDB1]
    Installed [APEX APS CATALOG CATJAVA CATPROC CONTEXT DV JAVAVM OLS ORDIM OWM SDO XDB XML XOQ]
Not Installed [EM MGW ODM RAC WK]

------------------------------------------------------
Phases [0-107]         Start Time:[2019_02_27 19:26:38]
Container Lists Inclusion:[PDB$SEED] Exclusion:[NONE]
------------------------------------------------------
***********   Executing Change Scripts   ***********
Serial   Phase #:0    [PDB$SEED] Files:1
------------------------------------------------------
Phases [0-107]         Start Time:[2019_02_27 19:26:38]
Container Lists Inclusion:[PDB1] Exclusion:[NONE]
------------------------------------------------------
***********   Executing Change Scripts   ***********
Serial   Phase #:0    [PDB1] Files:1    Time: 25s
***************   Catalog Core SQL   ***************
Serial   Phase #:1    [PDB$SEED] Files:5    Time: 27s
***************   Catalog Core SQL   ***************
Serial   Phase #:1    [PDB1] Files:5    Time: 80s
Restart  Phase #:2    [PDB$SEED] Files:1    Time: 0s
***********   Catalog Tables and Views   ***********
Parallel Phase #:3    [PDB$SEED] Files:19    Time: 78s
Restart  Phase #:2    [PDB1] Files:1    Time: 0s
***********   Catalog Tables and Views   ***********
Parallel Phase #:3    [PDB1] Files:19   Time: 24s
Restart  Phase #:4    [PDB$SEED] Files:1   Time: 24s
Restart  Phase #:4    [PDB1] Files:1    Time: 0s
*************   Catalog Final Scripts   ************
Serial   Phase #:5    [PDB1] Files:7    Time: 0s
*************   Catalog Final Scripts   ************
Serial   Phase #:5    [PDB$SEED] Files:7    Time: 18s
*****************   Catproc Start   ****************
Serial   Phase #:6    [PDB1] Files:1    Time: 18s
*****************   Catproc Start   ****************
Serial   Phase #:6    [PDB$SEED] Files:1    Time: 9s
*****************   Catproc Types   ****************
Serial   Phase #:7    [PDB1] Files:2    Time: 9s
*****************   Catproc Types   ****************
Serial   Phase #:7    [PDB$SEED] Files:2    Time: 7s
Restart  Phase #:8    [PDB$SEED] Files:1    Time: 0s
****************   Catproc Tables   ****************
Parallel Phase #:9    [PDB$SEED] Files:67    Time: 7s
Restart  Phase #:8    [PDB1] Files:1    Time: 0s
****************   Catproc Tables   ****************
Parallel Phase #:9    [PDB1] Files:67   Time: 39s
Restart  Phase #:10   [PDB1] Files:1    Time: 0s
*************   Catproc Package Specs   ************
Serial   Phase #:11   [PDB1] Files:1   Time: 39s
Restart  Phase #:10   [PDB$SEED] Files:1    Time: 1s
*************   Catproc Package Specs   ************
Serial   Phase #:11   [PDB$SEED] Files:1    Time: 54s
Restart  Phase #:12   [PDB1] Files:1    Time: 0s
**************   Catproc Procedures   **************
Parallel Phase #:13   [PDB1] Files:94    Time: 54s
Restart  Phase #:12   [PDB$SEED] Files:1    Time: 0s
**************   Catproc Procedures   **************
Parallel Phase #:13   [PDB$SEED] Files:94   Time: 9s
Restart  Phase #:14   [PDB1] Files:1    Time: 0s
Parallel Phase #:15   [PDB1] Files:120   Time: 9s
Restart  Phase #:14   [PDB$SEED] Files:1    Time: 0s
Parallel Phase #:15   [PDB$SEED] Files:120  Time: 13s
Restart  Phase #:16   [PDB1] Files:1  Time: 12s
Restart  Phase #:16   [PDB$SEED] Files:1    Time: 0s
Serial   Phase #:17   [PDB$SEED] Files:22    Time: 0s
Serial   Phase #:17   [PDB1] Files:22   Time: 2s
Restart  Phase #:18   [PDB$SEED] Files:1   Time: 2s
Restart  Phase #:18   [PDB1] Files:1    Time: 0s
*****************   Catproc Views   ****************
Parallel Phase #:19   [PDB$SEED] Files:32    Time: 0s
*****************   Catproc Views   ****************
Parallel Phase #:19   [PDB1] Files:32   Time: 24s
Restart  Phase #:20   [PDB1] Files:1   Time: 24s
Restart  Phase #:20   [PDB$SEED] Files:1    Time: 0s
Serial   Phase #:21   [PDB1] Files:3    Time: 0s
Serial   Phase #:21   [PDB$SEED] Files:3    Time: 10s
Restart  Phase #:22   [PDB$SEED] Files:1    Time: 0s
Parallel Phase #:23   [PDB$SEED] Files:25    Time: 10s
Restart  Phase #:22   [PDB1] Files:1    Time: 1s
Parallel Phase #:23   [PDB1] Files:25   Time: 355s
Restart  Phase #:24   [PDB1] Files:1    Time: 0s
Parallel Phase #:25   [PDB1] Files:12   Time: 360s
Restart  Phase #:24   [PDB$SEED] Files:1    Time: 0s
Parallel Phase #:25   [PDB$SEED] Files:12   Time: 114s
Restart  Phase #:26   [PDB1] Files:1    Time: 1s
Serial   Phase #:27   [PDB1] Files:1    Time: 0s
Serial   Phase #:28   [PDB1] Files:3   Time: 122s
Restart  Phase #:26   [PDB$SEED] Files:1    Time: 0s
Serial   Phase #:27   [PDB$SEED] Files:1    Time: 0s
Serial   Phase #:28   [PDB$SEED] Files:3    Time: 13s
Serial   Phase #:29   [PDB1] Files:1    Time: 0s
Restart  Phase #:30   [PDB1] Files:1    Time: 0s
***************   Catproc CDB Views   **************
Serial   Phase #:31   [PDB1] Files:1    Time: 2s
Serial   Phase #:29   [PDB$SEED] Files:1    Time: 0s
Restart  Phase #:30   [PDB$SEED] Files:1    Time: 0s
***************   Catproc CDB Views   **************
Serial   Phase #:31   [PDB$SEED] Files:1    Time: 0s
Restart  Phase #:32   [PDB1] Files:1    Time: 1s
Serial   Phase #:34   [PDB1] Files:1    Time: 0s
*****************   Catproc PLBs   *****************
Serial   Phase #:35   [PDB1] Files:293    Time: 1s
Restart  Phase #:32   [PDB$SEED] Files:1    Time: 0s
Serial   Phase #:34   [PDB$SEED] Files:1    Time: 0s
*****************   Catproc PLBs   *****************
Serial   Phase #:35   [PDB$SEED] Files:293  Time: 77s
Serial   Phase #:36   [PDB$SEED] Files:1    Time: 0s
Restart  Phase #:37   [PDB$SEED] Files:1  Time: 77s
Serial   Phase #:36   [PDB1] Files:1    Time: 0s
Restart  Phase #:37   [PDB1] Files:1    Time: 0s
Serial   Phase #:38   [PDB$SEED] Files:6    Time: 0s
Serial   Phase #:38   [PDB1] Files:6    Time: 3s
Restart  Phase #:39   [PDB1] Files:1    Time: 3s
Restart  Phase #:39   [PDB$SEED] Files:1    Time: 1s
***************   Catproc DataPump   ***************
Serial   Phase #:40   [PDB1] Files:3    Time: 1s
***************   Catproc DataPump   ***************
Serial   Phase #:40   [PDB$SEED] Files:3    Time: 35s
Restart  Phase #:41   [PDB1] Files:1    Time: 35s
Restart  Phase #:41   [PDB$SEED] Files:1    Time: 0s
******************   Catproc SQL   *****************
Parallel Phase #:42   [PDB1] Files:13    Time: 1s
******************   Catproc SQL   *****************
Parallel Phase #:42   [PDB$SEED] Files:13   Time: 124s
Restart  Phase #:43   [PDB1] Files:1    Time: 1s
Parallel Phase #:44   [PDB1] Files:11   Time: 129s
Restart  Phase #:43   [PDB$SEED] Files:1   Time: 5s
Restart  Phase #:45   [PDB1] Files:1    Time: 0s
Parallel Phase #:44   [PDB$SEED] Files:11    Time: 0s
Parallel Phase #:46   [PDB1] Files:3    Time: 3s
Restart  Phase #:47   [PDB1] Files:1    Time: 0s
*************   Final Catproc scripts   ************
Serial   Phase #:48   [PDB1] Files:1   Time: 6s
Restart  Phase #:45   [PDB$SEED] Files:1    Time: 0s
Parallel Phase #:46   [PDB$SEED] Files:3    Time: 2s
Restart  Phase #:47   [PDB$SEED] Files:1    Time: 0s
*************   Final Catproc scripts   ************
Serial   Phase #:48   [PDB$SEED] Files:1    Time: 8s
Restart  Phase #:49   [PDB1] Files:1    Time: 1s
**************   Final RDBMS scripts   *************
Serial   Phase #:50   [PDB1] Files:1    Time: 2s
************   Upgrade Component Start   ***********
Serial   Phase #:51   [PDB1] Files:1    Time: 1s
Restart  Phase #:52   [PDB1] Files:1    Time: 0s
**********   Upgrading Java and non-Java   *********
Serial   Phase #:53   [PDB1] Files:2    Time: 9s
Restart  Phase #:49   [PDB$SEED] Files:1    Time: 0s
**************   Final RDBMS scripts   *************
Serial   Phase #:50   [PDB$SEED] Files:1    Time: 3s
************   Upgrade Component Start   ***********
Serial   Phase #:51   [PDB$SEED] Files:1    Time: 0s
Restart  Phase #:52   [PDB$SEED] Files:1    Time: 0s
**********   Upgrading Java and non-Java   *********
Serial   Phase #:53   [PDB$SEED] Files:2    Time: 185s
*****************   Upgrading XDB   ****************
Restart  Phase #:54   [PDB$SEED] Files:1    Time: 0s
Serial   Phase #:56   [PDB$SEED] Files:3    Time: 191s
*****************   Upgrading XDB   ****************
Restart  Phase #:54   [PDB1] Files:1    Time: 0s
Serial   Phase #:56   [PDB1] Files:3    Time: 4s
Serial   Phase #:57   [PDB$SEED] Files:3    Time: 5s
Serial   Phase #:57   [PDB1] Files:3    Time: 2s
Parallel Phase #:58   [PDB$SEED] Files:10    Time: 1s
Parallel Phase #:58   [PDB1] Files:10   Time: 2s
Parallel Phase #:59   [PDB$SEED] Files:25   Time: 2s
Parallel Phase #:59   [PDB1] Files:25   Time: 5s
Serial   Phase #:60   [PDB$SEED] Files:4   Time: 4s
Serial   Phase #:60   [PDB1] Files:4    Time: 7s
Serial   Phase #:61   [PDB$SEED] Files:1    Time: 0s
Serial   Phase #:62   [PDB$SEED] Files:32    Time: 8s
Serial   Phase #:61   [PDB1] Files:1    Time: 0s
Serial   Phase #:62   [PDB1] Files:32   Time: 6s
Serial   Phase #:63   [PDB$SEED] Files:1    Time: 0s
Parallel Phase #:64   [PDB$SEED] Files:6   Time: 5s
Serial   Phase #:63   [PDB1] Files:1    Time: 0s
Parallel Phase #:64   [PDB1] Files:6    Time: 6s
Serial   Phase #:65   [PDB$SEED] Files:2    Time: 6s
Serial   Phase #:65   [PDB1] Files:2    Time: 17s
Serial   Phase #:66   [PDB$SEED] Files:3    Time: 17s
Serial   Phase #:66   [PDB1] Files:3    Time: 19s
****************   Upgrading ORDIM   ***************
Restart  Phase #:67   [PDB$SEED] Files:1    Time: 1s
Serial   Phase #:69   [PDB$SEED] Files:1    Time: 20s
****************   Upgrading ORDIM   ***************
Restart  Phase #:67   [PDB1] Files:1    Time: 0s
Serial   Phase #:69   [PDB1] Files:1    Time: 0s
Parallel Phase #:70   [PDB$SEED] Files:2    Time: 1s
Parallel Phase #:70   [PDB1] Files:2    Time: 9s
Restart  Phase #:71   [PDB1] Files:1    Time: 10s
Restart  Phase #:71   [PDB$SEED] Files:1    Time: 1s
Parallel Phase #:72   [PDB$SEED] Files:2    Time: 1s
Parallel Phase #:72   [PDB1] Files:2    Time: 0s
Serial   Phase #:73   [PDB$SEED] Files:2    Time: 0s
Serial   Phase #:73   [PDB1] Files:2    Time: 1s
*****************   Upgrading SDO   ****************
Restart  Phase #:74   [PDB1] Files:1    Time: 1s
*****************   Upgrading SDO   ****************
Restart  Phase #:74   [PDB$SEED] Files:1    Time: 0s
Serial   Phase #:76   [PDB1] Files:1    Time: 0s
Serial   Phase #:76   [PDB$SEED] Files:1    Time: 30s
Serial   Phase #:77   [PDB1] Files:2    Time: 31s
Serial   Phase #:77   [PDB$SEED] Files:2    Time: 2s
Restart  Phase #:78   [PDB1] Files:1    Time: 0s
Serial   Phase #:79   [PDB1] Files:1    Time: 1s
Restart  Phase #:78   [PDB$SEED] Files:1    Time: 1s
Serial   Phase #:79   [PDB$SEED] Files:1    Time: 3s
Restart  Phase #:80   [PDB1] Files:1    Time: 1s
Parallel Phase #:81   [PDB1] Files:3    Time: 3s
Restart  Phase #:80   [PDB$SEED] Files:1    Time: 0s
Parallel Phase #:81   [PDB$SEED] Files:3    Time: 51s
Restart  Phase #:82   [PDB$SEED] Files:1    Time: 51s
Restart  Phase #:82   [PDB1] Files:1    Time: 1s
Serial   Phase #:83   [PDB$SEED] Files:1    Time: 1s
Serial   Phase #:83   [PDB1] Files:1    Time: 3s
Restart  Phase #:84   [PDB$SEED] Files:1    Time: 3s
Restart  Phase #:84   [PDB1] Files:1    Time: 0s
Serial   Phase #:85   [PDB$SEED] Files:1    Time: 0s
Serial   Phase #:85   [PDB1] Files:1    Time: 6s
Restart  Phase #:86   [PDB$SEED] Files:1    Time: 0s
Parallel Phase #:87   [PDB$SEED] Files:4    Time: 8s
Restart  Phase #:86   [PDB1] Files:1    Time: 0s
Parallel Phase #:87   [PDB1] Files:4    Time: 73s
Restart  Phase #:88   [PDB$SEED] Files:1    Time: 71s
Restart  Phase #:88   [PDB1] Files:1    Time: 0s
Serial   Phase #:89   [PDB$SEED] Files:1    Time: 0s
Serial   Phase #:89   [PDB1] Files:1    Time: 0s
Restart  Phase #:90   [PDB$SEED] Files:1    Time: 0s
Restart  Phase #:90   [PDB1] Files:1    Time: 1s
Serial   Phase #:91   [PDB$SEED] Files:2    Time: 1s
Serial   Phase #:91   [PDB1] Files:2    Time: 13s
Restart  Phase #:92   [PDB$SEED] Files:1    Time: 13s
Restart  Phase #:92   [PDB1] Files:1    Time: 0s
Serial   Phase #:93   [PDB$SEED] Files:1    Time: 0s
Serial   Phase #:93   [PDB1] Files:1    Time: 1s
Restart  Phase #:94   [PDB$SEED] Files:1    Time: 1s
Restart  Phase #:94   [PDB1] Files:1    Time: 0s
*******   Upgrading ODM, WK, EXF, RUL, XOQ   *******
Serial   Phase #:95   [PDB$SEED] Files:1    Time: 0s
*******   Upgrading ODM, WK, EXF, RUL, XOQ   *******
Serial   Phase #:95   [PDB1] Files:1    Time: 9s
Restart  Phase #:96   [PDB1] Files:1    Time: 0s
***********   Final Component scripts    ***********
Serial   Phase #:97   [PDB1] Files:1    Time: 9s
Restart  Phase #:96   [PDB$SEED] Files:1    Time: 1s
***********   Final Component scripts    ***********
Serial   Phase #:97   [PDB$SEED] Files:1    Time: 1s
*************   Final Upgrade scripts   ************
Serial   Phase #:98   [PDB$SEED] Files:1    Time: 2s
*************   Final Upgrade scripts   ************
Serial   Phase #:98   [PDB1] Files:1    Time: 10s
*******************   Migration   ******************
Serial   Phase #:99   [PDB1] Files:1    Time: 1s
***   End PDB Application Upgrade Pre-Shutdown   ***
Serial   Phase #:100  [PDB1] Files:1    Time: 0s
Serial   Phase #:101  [PDB1] Files:1    Time: 11s
*******************   Migration   ******************
Serial   Phase #:99   [PDB$SEED] Files:1    Time: 1s
***   End PDB Application Upgrade Pre-Shutdown   ***
Serial   Phase #:100  [PDB$SEED] Files:1    Time: 0s
Serial   Phase #:101  [PDB$SEED] Files:1    Time: 2s
Serial   Phase #:102  [PDB1] Files:1    Time: 2s
Serial   Phase #:102  [PDB$SEED] Files:1    Time: 2s
*****************   Post Upgrade   *****************
Serial   Phase #:103  [PDB1] Files:1    Time: 1s
*****************   Post Upgrade   *****************
Serial   Phase #:103  [PDB$SEED] Files:1    Time: 12s
****************   Summary report   ****************
Serial   Phase #:104  [PDB1] Files:1    Time: 1s
***   End PDB Application Upgrade Post-Shutdown   **
Serial   Phase #:105  [PDB1] Files:1    Time: 1s
Serial   Phase #:106  [PDB1] Files:1    Time: 1s
Serial   Phase #:107  [PDB1] Files:1     Time: 0s

------------------------------------------------------
Phases [0-107]         End Time:[2019_02_27 19:52:35]
Container Lists Inclusion:[PDB1] Exclusion:[NONE]
------------------------------------------------------

Grand Total Time: 1560s [PDB1]

 LOG FILES: (/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444/catupgrdpdb1*.log)

Upgrade Summary Report Located in:
/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444/upg_summary.log
   Time: 263s
****************   Summary report   ****************
Serial   Phase #:104  [PDB$SEED] Files:1    Time: 0s
***   End PDB Application Upgrade Post-Shutdown   **
Serial   Phase #:105  [PDB$SEED] Files:1    Time: 1s
Serial   Phase #:106  [PDB$SEED] Files:1    Time: 1s
Serial   Phase #:107  [PDB$SEED] Files:1     Time: 0s

------------------------------------------------------
Phases [0-107]         End Time:[2019_02_27 19:56:45]
Container Lists Inclusion:[PDB$SEED] Exclusion:[NONE]
------------------------------------------------------

Grand Total Time: 1811s [PDB$SEED]

 LOG FILES: (/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444/catupgrdpdb_seed*.log)

Upgrade Summary Report Located in:
/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444/upg_summary.log

     Time: 1303s For CDB$ROOT
     Time: 1823s For PDB(s)

Grand Total Time: 3126s

 LOG FILES: (/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444/catupgrdcdbroot*.log)

Upgrade Summary Report Located in:
/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/cdb1/upgrade20190227190444/upg_summary.log

Grand Total Upgrade Time:    [0d:0h:52m:6s]
$

检查“upg_summary.log”文件,如果有任何问题,请检查相关的“catupgrad*.log”文件。在这一点上,我做了一个关闭和启动,以确保一切都在正确的模式下运行。在执行升级后步骤之前,还要确保用户定义的PDB处于打开状态。

sqlplus / as sysdba <<EOF
shutdown immediate;
startup;

column name format A30
select name, open_mode from v\$pdbs;

exit;
EOF

执行升级后操作

“preupgrade.jar”的输出列出了许多升级后的建议。有些必须手动应用。其他的则包含在“postupgrade_fixups.sql”脚本中。在下面的示例中,我们将只运行“postupgrade_fixups.sql”脚本。请记住,在多租户数据库中,我们必须在根、种子和所有用户定义的可插拔数据库上运行升级后操作。

$ORACLE_HOME/perl/bin/perl \
    -I$ORACLE_HOME/perl/lib \
    -I$ORACLE_HOME/rdbms/admin \
    $ORACLE_HOME/rdbms/admin/catcon.pl \
    -l /u01/app/oracle/cfgtoollogs/${ORACLE_SID}/preupgrade/ \
    -b postup_cdb1 \
    /u01/app/oracle/cfgtoollogs/${ORACLE_SID}/preupgrade/postupgrade_fixups.sql

假设您在此过程中没有遇到任何问题,那么您的数据库已经升级并准备就绪。

最后的步骤

编辑“/etc/oratab”文件,更正Oracle home路径。

From:
cdb1:/u01/app/oracle/product/12.2.0.1/db_1:Y
To:
cdb1:/u01/app/oracle/product/19.0.0/dbhome_1:Y

您需要考虑如何使用COMPATIBLE参数。我喜欢尽快重置它。

sqlplus / as sysdba <<EOF
alter system set compatible='19.0.0' scope=spfile;
shutdown immediate;
startup;
EXIT;
EOF

如果未启用本地undo,则需要启用它。您可以在此处阅读有关本地undo的详细信息here

sqlplus / as sysdba <<EOF
shutdown immediate;
startup upgrade;

alter database local undo on;

shutdown immediate;
startup;
EXIT;
EOF

如果您正在使用APEX或ORDS,您可能需要验证它们(validate APEXvalidate ORDS)。

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐