Oracle 21c自动升级(第2部分)

发布于:2021-02-19 00:00:30

0

128

0

Oracle Oracle 19c Oracle 21c 数据库 ORCLCDB

本说明描述了通过新的自动升级实用程序使用拔掉/插入方法将Oracle 19c可插入数据库(PDB)升级到Oracle 21c的步骤。

源容器数据库:ORCLCDB(19c)

目标容器数据库:DB21C(21c)

###################################################################################################
19c Pluggable Database ORCLPDB1 is hosted in 19c Container Database ORCLCDB
###################################################################################################

[oracle@db21c ~]$ . oraenv
ORACLE_SID = [db21c] ? ORCLCDB
The Oracle base has been set to /opt/oracle
[oracle@db21c ~]$ sqlplus sys as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Dec 16 02:49:24 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> show pdbs

   CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
        2 PDB$SEED                       READ ONLY  NO
        3 ORCLPDB1                       READ WRITE NO


###################################################################################################
Current Pluggable Databases located in 21c Container database DB21C

Note: ORCL was earlier an Oracle 19c Non-CDB which has been upgraded and plugged into DB21C CDB
###################################################################################################

[oracle@db21c admin]$ sqlplus sys as sysdba

SQL*Plus: Release 21.0.0.0.0 - Production on Wed Dec 16 04:46:51 2020
Version 21.1.0.0.0

Copyright (c) 1982, 2020, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 21c EE High Perf Release 21.0.0.0.0 - Production
Version 21.1.0.0.0

SQL> show pdbs

   CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
        2 PDB$SEED                       READ ONLY  NO
        3 PDB21C                         READ WRITE NO
        4 ORCL                           READ WRITE NO


###################################################################################################
Created the AutoUpgrade configuration file config.txt

Note: In this case the original 19c datafile locations are being preserved.

Use parameter target_pdb_copy_option along with file_name_convert clause to create datafiles
in a new location as part of the upgrade.
###################################################################################################

ORCLCDB.source_home=/opt/oracle/product/19c/dbhome_1
ORCLCDB.target_home=/u01/app/oracle/product/21.0.0.0/dbhome_1
ORCLCDB.target_version=21.1.0
ORCLCDB.sid=ORCLCDB
ORCLCDB.pdbs=ORCLPDB1
ORCLCDB.log_dir=/u01/app/oracle/upgrade-jobs
ORCLCDB.restoration=yes
ORCLCDB.target_cdb=db21c


###################################################################################################
Run AutoUpgrade  in ANALYZE mode
###################################################################################################

[oracle@db21c 100]$ . oraenv
ORACLE_SID = [db21c] ? db21c
The Oracle base has been set to /u01/app/oracle
[oracle@db21c 100]$ cd $ORACLE_HOME/rdbms/admin
[oracle@db21c admin]$ java -jar autoupgrade.jar -config /home/oracle/config.txt -mode analyze -console
AutoUpgrade tool launched with default options
Processing config file ...
+--------------------------------+
| Starting AutoUpgrade execution |
+--------------------------------+
1 databases will be analyzed
Type 'help' to list console commands
upg> lsj
+----+-------+---------+---------+-------+--------------+--------+----------------------------+
|Job#|DB_NAME|    STAGE|OPERATION| STATUS|    START_TIME| UPDATED|                     MESSAGE|
+----+-------+---------+---------+-------+--------------+--------+----------------------------+
| 101|ORCLCDB|PRECHECKS|PREPARING|RUNNING|20/12/16 03:19|03:19:53|Loading database information|
+----+-------+---------+---------+-------+--------------+--------+----------------------------+
Total jobs 1



upg> lsj
+----+-------+---------+---------+-------+--------------+--------+---------------+
|Job#|DB_NAME|    STAGE|OPERATION| STATUS|    START_TIME| UPDATED|        MESSAGE|
+----+-------+---------+---------+-------+--------------+--------+---------------+
| 101|ORCLCDB|PRECHECKS|PREPARING|RUNNING|20/12/16 03:19|03:21:12|Remaining 64/64|
+----+-------+---------+---------+-------+--------------+--------+---------------+
Total jobs 1


upg> Job 101 completed
------------------- Final Summary --------------------
Number of databases            [ 1 ]

Jobs finished successfully     [1]
Jobs failed                    [0]
Jobs pending                   [0]
------------- JOBS FINISHED SUCCESSFULLY -------------
Job 101 for ORCLCDB


###################################################################################################
Run AutoUpgrade  in DEPLOY mode

Note the various stages - PRECHECKS, PREFIXUPS and then DBUPGRADE
###################################################################################################

[oracle@db21c admin]$ java -jar autoupgrade.jar -config /home/oracle/config.txt -mode deploy -console
AutoUpgrade tool launched with default options
Processing config file ...
+--------------------------------+
| Starting AutoUpgrade execution |
+--------------------------------+
1 databases will be processed
Type 'help' to list console commands
upg> lsj
+----+-------+---------+---------+-------+--------------+--------+----------------------------+
|Job#|DB_NAME|    STAGE|OPERATION| STATUS|    START_TIME| UPDATED|                     MESSAGE|
+----+-------+---------+---------+-------+--------------+--------+----------------------------+
| 102|ORCLCDB|PRECHECKS|PREPARING|RUNNING|20/12/16 03:26|03:26:15|Loading database information|
+----+-------+---------+---------+-------+--------------+--------+----------------------------+
Total jobs 1



upg> /
+----+-------+---------+---------+-------+--------------+--------+---------------+
|Job#|DB_NAME|    STAGE|OPERATION| STATUS|    START_TIME| UPDATED|        MESSAGE|
+----+-------+---------+---------+-------+--------------+--------+---------------+
| 102|ORCLCDB|PRECHECKS|PREPARING|RUNNING|20/12/16 03:26|03:27:33|Remaining 61/64|
+----+-------+---------+---------+-------+--------------+--------+---------------+
Total jobs 1


upg> /
+----+-------+---------+---------+-------+--------------+--------+--------------+
|Job#|DB_NAME|    STAGE|OPERATION| STATUS|    START_TIME| UPDATED|       MESSAGE|
+----+-------+---------+---------+-------+--------------+--------+--------------+
| 102|ORCLCDB|PRECHECKS|PREPARING|RUNNING|20/12/16 03:26|03:27:58|Remaining 6/64|
+----+-------+---------+---------+-------+--------------+--------+--------------+
Total jobs 1


upg> /
+----+-------+---------+---------+-------+--------------+--------+-------------+
|Job#|DB_NAME|    STAGE|OPERATION| STATUS|    START_TIME| UPDATED|      MESSAGE|
+----+-------+---------+---------+-------+--------------+--------+-------------+
| 102|ORCLCDB|PREFIXUPS|EXECUTING|RUNNING|20/12/16 03:26|03:28:20|Remaining 2/2|
+----+-------+---------+---------+-------+--------------+--------+-------------+
Total jobs 1


upg> /
+----+-------+---------+---------+-------+--------------+--------+-------------------+
|Job#|DB_NAME|    STAGE|OPERATION| STATUS|    START_TIME| UPDATED|            MESSAGE|
+----+-------+---------+---------+-------+--------------+--------+-------------------+
| 102|ORCLCDB|DBUPGRADE|EXECUTING|RUNNING|20/12/16 03:26|03:35:45|0%Upgraded ORCLPDB1|
+----+-------+---------+---------+-------+--------------+--------+-------------------+
Total jobs 1


upg> /
+----+-------+---------+---------+-------+--------------+--------+--------------------+
|Job#|DB_NAME|    STAGE|OPERATION| STATUS|    START_TIME| UPDATED|             MESSAGE|
+----+-------+---------+---------+-------+--------------+--------+--------------------+
| 102|ORCLCDB|DBUPGRADE|EXECUTING|RUNNING|20/12/16 03:26|03:45:01|22%Upgraded ORCLPDB1|
+----+-------+---------+---------+-------+--------------+--------+--------------------+
Total jobs 1


upg>  /
+----+-------+---------+---------+-------+--------------+--------+--------------------+
|Job#|DB_NAME|    STAGE|OPERATION| STATUS|    START_TIME| UPDATED|             MESSAGE|
+----+-------+---------+---------+-------+--------------+--------+--------------------+
| 102|ORCLCDB|DBUPGRADE|EXECUTING|RUNNING|20/12/16 03:26|04:15:46|97%Upgraded ORCLPDB1|
+----+-------+---------+---------+-------+--------------+--------+--------------------+
Total jobs 1

upg>  /
+----+-------+---------+---------+-------+--------------+--------+--------------------+
|Job#|DB_NAME|    STAGE|OPERATION| STATUS|    START_TIME| UPDATED|             MESSAGE|
+----+-------+---------+---------+-------+--------------+--------+--------------------+
| 102|ORCLCDB|DBUPGRADE|EXECUTING|RUNNING|20/12/16 03:26|04:15:46|97%Upgraded ORCLPDB1|
+----+-------+---------+---------+-------+--------------+--------+--------------------+
Total jobs 1


###################################################################################################
View the Upgrade Summary log
###################################################################################################

Oracle Database Release 21 Post-Upgrade Status Tool    12-16-2020 04:16:0
Container Database: DB21C
[CON_ID: 5 => ORCLPDB1]

Component                               Current         Full     Elapsed Time
Name                                    Status          Version  HH:MM:SS

Oracle Server                          UPGRADED      21.1.0.0.0  00:18:17
JServer JAVA Virtual Machine           UPGRADED      21.1.0.0.0  00:05:34
Oracle XDK                             UPGRADED      21.1.0.0.0  00:01:56
Oracle Database Java Packages          UPGRADED      21.1.0.0.0  00:00:13
OLAP Analytic Workspace                UPGRADED      21.1.0.0.0  00:00:39
Oracle Label Security                  UPGRADED      21.1.0.0.0  00:00:13
Oracle Database Vault                  UPGRADED      21.1.0.0.0  00:01:38
Oracle Text                            UPGRADED      21.1.0.0.0  00:00:53
Oracle Workspace Manager               UPGRADED      21.1.0.0.0  00:01:25
Oracle Real Application Clusters       UPGRADED      21.1.0.0.0  00:00:00
Oracle XML Database                    UPGRADED      21.1.0.0.0  00:01:59
Oracle Multimedia                      UPGRADED      21.1.0.0.0  00:00:45
Spatial                                UPGRADED      21.1.0.0.0  00:08:08
Oracle OLAP API                        UPGRADED      21.1.0.0.0  00:00:14
Final Actions                                                    00:00:06
Post Upgrade                                                     00:00:29

Total Upgrade Time: 00:37:57 [CON_ID: 5 => ORCLPDB1]

Database time zone version is 32. It is older than current release time
zone version 35. Time zone upgrade is needed using the DBMS_DST package.

###################################################################################################
Post Upgrade Stage Commences
###################################################################################################

upg>  /
+----+-------+----------+---------+-------+--------------+--------+-------------+
|Job#|DB_NAME|     STAGE|OPERATION| STATUS|    START_TIME| UPDATED|      MESSAGE|
+----+-------+----------+---------+-------+--------------+--------+-------------+
| 102|ORCLCDB|POSTFIXUPS|EXECUTING|RUNNING|20/12/16 03:26|04:21:27|Remaining 5/5|
+----+-------+----------+---------+-------+--------------+--------+-------------+
Total jobs 1

upg>  /
+----+-------+----------+---------+-------+--------------+--------+-------------+
|Job#|DB_NAME|     STAGE|OPERATION| STATUS|    START_TIME| UPDATED|      MESSAGE|
+----+-------+----------+---------+-------+--------------+--------+-------------+
| 102|ORCLCDB|POSTFIXUPS|EXECUTING|RUNNING|20/12/16 03:26|04:30:47|Remaining 3/5|
+----+-------+----------+---------+-------+--------------+--------+-------------+

upg> Job 102 completed
------------------- Final Summary --------------------
Number of databases            [ 1 ]

Jobs finished successfully     [1]
Jobs failed                    [0]
Jobs pending                   [0]
------------- JOBS FINISHED SUCCESSFULLY -------------
Job 102 for ORCLCDB



###################################################################################################
PDB ORCLPDB1 has been upgraded and plugged into the 21c Container Database
###################################################################################################

[oracle@db21c admin]$ sqlplus sys as sysdba

SQL*Plus: Release 21.0.0.0.0 - Production on Wed Dec 16 04:46:51 2020
Version 21.1.0.0.0

Copyright (c) 1982, 2020, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 21c EE High Perf Release 21.0.0.0.0 - Production
Version 21.1.0.0.0

SQL> show pdbs

   CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
        2 PDB$SEED                       READ ONLY  NO
        3 PDB21C                         READ WRITE NO
        4 ORCL                           READ WRITE NO
        5 ORCLPDB1                       READ WRITE NO


###################################################################################################
Verify that the PDB ORCLPDB1 has been unplugged from 19c Container Database
###################################################################################################

[oracle@db21c admin]$ . oraenv
ORACLE_SID = [db21c] ? ORCLCDB
The Oracle base has been changed from /u01/app/oracle to /opt/oracle
[oracle@db21c admin]$ sqlplus sys as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed Dec 16 04:47:48 2020
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Enter password:

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> show pdbs

   CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
        2 PDB$SEED                       READ ONLY  NO
SQL>