【資料庫升級】Oracle指令碼升級12c CDB to 19c CDB

恩強Boy發表於2020-12-30

一、 環境說明

source DB version: 11.2.0.1 CDB (單機)

source CDB name: orcl

PDB name: pdb$seed,pdb1,pdb2,pdb3

target DB version: 19c CDB

OS: Redhat Linux 7.6

12c_ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1

19c_ORACLE_HOME=/u01/app/oracle/product/19.0.0/dbhome_1

19c 資料庫軟體已經在本地完成安裝

二、 升級路線

想要升級到19c 資料庫,最小版本要求

升級CDB 19c ,最小版本要求

升級前準備

一、  源端環境需求和檢查

- 在升級之前,確保 Oracle 提供的所有資料庫元件、物件在源資料庫中都是有效的;

- 在升級之前, Oracle 強烈建議將資料庫版本打上最新的補丁( PSU/RU );

- 確保在升級前,源庫有一個有效的備份或者建立有效還原點。

- 升級前禁用在 DDL 語句之前 / 之後執行的自定義觸發器,升級後再啟用;

- 在升級前,檢查資料庫伺服器升級 / 降級的相容性;

- 在升級期間開啟歸檔。 Oracle 建議開啟歸檔日誌,用於 DBU 在升級過程建立和更新日誌;

- 如果是 Oracle RAC ,如果您使用 DBUA 升級資料庫,則必須將 cluster_database 引數設定為 TRUE ;如果您使用指令碼升級,必須將 cluster_database 引數設定為 false, 等待完成升級後再設定為 true;

- 在升級之前確保執行預升級工具 preupgrade.jar

- 檢查並遵循預升級日誌中給出的建議;

- 在升級前源庫應停止物化檢視;

- 禁用 jobs/crontab 定時任務;

- 升級後要安裝最新的 RU

二、  目標端環境需求和檢查

- 確保你的作業系統 / 平臺格式滿足 19c 的要求

- 在升級操作前要完成安裝 19c 資料庫軟體

- MOS 上下載並安裝最新的 RU RUR

三、  預升級

執行以下命令:

(命令格式如下)

$ $12c _ ORACLE_HOME /jdk/bin/java -jar   $ 19c _ ORACLE_HOME /rdbms/admin/preupgrade.jar [FILE|TERMINAL] [TEXT|XML] [DIR output_dir]

引數說明:

[FILE|TERMINAL] : 指定生成檔案是到檔案還是終端,預設為 FILE

[TEXT|XML] : 指定日誌應用格式,預設為 TEXT

[DIR]: 日誌在 <output_dir> 下建立。如果不指定輸出目錄 dir 選項,那麼將會在以下預設目錄之一建立日誌:

如果你定義了ORACLE_BASE, 日誌會被建立在 $ORACLE_BASE/cfgtoollogs/<dbname>/preupgrade/ ,否則會建立在

$ORACLE_HOME/cfgtoollogs/db_name/preupgrade/

例:

源端ORACLE_HOME:/u01/app/oracle/product/12.2.0/db_1

目標端ORACLE_HOME:/u01/app/oracle/product/19.0.0/dbhome_1

執行以下命令

$ export ORACLE_SID=orcl

$ echo ORACLE_BASE=/u01/app/oracle

$ echo ORACLE_HOME=/u01/app/oracle/product/12.2.0/db_1

$ $ORACLE_HOME/jdk/bin/java -jar  /u01/app/oracle/product/19.0.0/dbhome_1 /rdbms/admin/preupgrade.jar FILE  TEXT

輸出總結如下:

==================

PREUPGRADE SUMMARY

==================

/u01/app/oracle/cfgtoollogs/orcl/preupgrade/preupgrade.log

/u01/app/oracle/cfgtoollogs/orcl/preupgrade/preupgrade_fixups.sql

/u01/app/oracle/cfgtoollogs/orcl/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/orcl/preupgrade/ -b preup_orcl /u01/app/oracle/cfgtoollogs/orcl/preupgrade/preupgrade_fixups.sql

2. Review logs under /u01/app/oracle/cfgtoollogs/orcl/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/orcl/preupgrade/ -b postup_orcl /u01/app/oracle/cfgtoollogs/orcl/preupgrade/postupgrade_fixups.sql

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

Preupgrade complete: 2020-12-28T14:23:15

根據上面的輸出,在升級時候要遵守 preupgrade.log 裡面的建議。整個升級過程都在嚴格遵守 preupgrade.log 的建議。

在升級前執行 preupgrade_fixups.sql 指令碼,在升級後執行 postupgrade_fixups.sql 指令碼。

preupgrade.log 報告如下,需要根據報告的建議進行修改

==============

BEFORE UPGRADE

==============

1.  收集資料字典統計資訊

執行以下儲存過程:

SQL> exec DBMS_STATS.GATHER_DICTIONARY_STATS;

資料字典統計資訊可以幫助Oracle 優化器找到有效的 SQL 執行計劃。 Oracle 建議在升級資料庫之前的 24 小時內完成收集字典統計資訊。

2.  擴充套件列出的表空間,或者設定為自動擴充套件

                                                 Min Size

Tablespace                        Size     For Upgrade

----------                     ----------  -----------

SYSAUX                             610 MB       625 MB

SYSTEM                             810 MB       926 MB

TEMP                               131 MB       150 MB

UNDOTBS1                            70 MB       439 MB

3.  檢查歸檔日誌目錄是否還有14G 空間可用,用於升級過程產生的歸檔日誌。

4.  不需要做任何操作

使用預設並行升級選項。首先先升級CDB$ROOT ,然後一次最多升級 2 PDB ,每個 PDB 使用 2 個並行程式。

並行升級PDB 的數量個每個並行程式數量可以參考 Database Upgrade Guide

5.  升級RMAN 恢復目錄

如果您使用recovery catalog 模式的版本比 RMAN 客戶端的所需的版本更低,需要手動升級 RMAN recovery catalog

6.  執行修復指令碼preupgrade_fixups.sql

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

四、  檢查無效的物件、元件

(檢查資料庫註冊資訊)

SQL> set pagesize500

SQL> set linesize 100

SQL> select substr(comp_name,1,40) comp_name, status,   substr(version,1,10) version from dba_registry   order by comp_name;

COMP_NAME                                   STATUS      VERSION

---------------------------------------- ----------- ----------

JServer JAVA Virtual Machine              VALID       11.2.0.4.0

OLAP Analytic Workspace                     VALID       11.2.0.4.0

OLAP Catalog                                VALID       11.2.0.4.0

OWB                                         VALID       11.2.0.4.0

Oracle Application Express                 VALID       3.2.1.00.1

Oracle Database Catalog Views             VALID       11.2.0.4.0

Oracle Database Java Packages             VALID       11.2.0.4.0

Oracle Database Packages and Types        VALID       11.2.0.4.0

Oracle Enterprise Manager                   VALID       11.2.0.4.0

Oracle Expression Filter                   VALID       11.2.0.4.0

Oracle Multimedia                           VALID       11.2.0.4.0

Oracle OLAP API                             VALID       11.2.0.4.0

Oracle Rules Manager                        VALID       11.2.0.4.0

Oracle Text                                 VALID       11.2.0.4.0

Oracle Workspace Manager                    VALID       11.2.0.4.0

Oracle XDK                                  VALID       11.2.0.4.0

Oracle XML Database                         VALID       11.2.0.4.0

Spatial                                     VALID       11.2.0.4.0

(檢查無效物件)

SQL> select substr(object_name,1,40)   object_name,substr(owner,1,15) , owner,object_type from dba_objects   where status='INVALID' order by   owner,   object_type;

SQL> select owner,object_type,count(*) from dba_objects where status='INVALID' group by owner,object_type order by owner,object_type ;

或者執行下面儲存過程,也可以檢查無效的物件

SQL> SET SERVEROUTPUT ON;

SQL> EXECUTE DBMS_PREUP.INVALID_OBJECTS;

如果發現無效的物件和資料庫元件,需要對無效物件進行編譯,執行以下SQL

$ sqlplus / as sysdba

SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql

五、  確保在升級前物化檢視重新整理完成

Oracle 升級前,必須等待所有物化檢視完成重新整理。可以執行此儲存過程進行查詢,以確定是否所有的物化檢視是否重新整理完成。

SQL> SELECT o.name FROM sys.obj$ o, sys.user$ u, sys.sum$ s WHERE o.type# = 42 AND bitand(s.mflags, 8) =8;

六、  在升級前確保沒有進行備份和恢復任務

執行以下SQL

SQL> SELECT * FROM v$backup WHERE status != 'NOT ACTIVE';

SQL>   SELECT * FROM v$recover_file;

七、  在升級前清理回收站

SQL> PURGE DBA_RECYCLEBIN;

也可以通過DBUA 清理回收站

八、  密碼大小寫敏感

Oracle 12c(12.2) 版本開始,預設的基於密碼的認證協議配置不使用不區分大小寫的 10G 密碼版本。預設情況下, SQLNET.ALLOWED_LOGON_VERSION_SERVER=12 。為了提高安全性, Oracle 建議啟用區分大小寫的基於密碼的身份驗證,這是預設的設定。在升級前, Oracle 建議我們確定對基於預設密碼的認證協議配置的改變會不會影響到我們,需要做以下檢查

- 確定你的賬戶密碼使用只使用 10G 不區分大小寫的密碼驗證版本

- 確保沒有將 SEC_CASE_SENSITIVE_LOGON 設定為 false 。設定為 FALSE 可以防止使用區分大小寫的密碼版本( 11g&12c )進行認證。

九、  在升級前確保有一個可用的備份

資料庫升級是一個比較危險的動作。如果條件允許,建議建立一個RMAN 備份,建立一個閃回還原點,建立一個邏輯備份,或者使用 Data Guard 環境,在備庫進行升級。

十、  升級前刪除沒有必要的隱藏引數

查詢隱藏引數SQL 如下

SQL> SELECT name, value from SYS.V$PARAMETER WHERE name LIKE '\_%' ESCAPE '\' order by name;

升級資料庫

1.  如果是Oracle RAC ,升級前將 cluster_database 設定為 false

2.  關閉db 和監聽

$ lsnrctl stop

$ sqlplus / as sysdba

SQL> shutdown immediate

3.  複製監聽檔案

將配置檔案從12c ORACLE_HOME 複製到 19c ORACLE_HOME 目錄下

$ cd /u01/app/oracle/product/12.2.0/db_1/network/admin/

$ cp *.ora /u01/app/oracle/product/19.0.0/dbhome_1/network/admin

4.  傳輸密碼檔案和引數檔案到19c ORACLE_HOME 目錄下

$ cd /u01/app/oracle/product/11.2.0/db_1/dbs

$ cp spfileorcl.ora orapworcl /u01/app/oracle/product/19.0.0/dbhome_1/dbs/

5.  修改環境變數

ORACLE_HOME 指向 19c 目錄

6.  檢查監聽檔案路徑,修改成19c 路徑,開啟監聽

$ lsnrctl start

$ lsnrctl status

7.  升級模式開啟CDB

$ sqlplus / as sysdba

SQL> startup upgrade

SQL> alter pluggable database all open upgrade;

8.  執行升級指令碼

(後者是前者的簡寫)

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


#Shorthand command.
$ORACLE_HOME/bin/dbupgrade

 

輸出日誌如下:

(包括CDB/PDB$SEED/PDBs 的日誌,所以比較長)

Argument list for [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.3.0.0.0DBRU_LINUX.X64_190417]

/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/upgrade20201230093925]

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

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

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

 

Number of Cpus        = 4

Database Name         = orcl

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/orcl/upgrade20201230093941/catupgrdcdbroot_catcon_11132.lst]

catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941/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/orcl/upgrade20201230093941/catupgrdcdbroot_*.lst] files for spool files, if any

Log file directory = [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941]

Parallel SQL Process Count (PDB)      = 2

Parallel SQL Process Count (CDB$ROOT) = 4

Concurrent PDB Upgrades               = 2

Generated PDB Inclusion:[PDB$SEED PDB1 PDB2 PDB3]

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]

------------------------------------------------------

Phases [0-107]         Start Time:[2020_12_30 09:40:13]

Container Lists Inclusion:[CDB$ROOT] Exclusion:[NONE]

------------------------------------------------------

***********   Executing Change Scripts   ***********

Serial   Phase #:0    [CDB$ROOT] Files:1    Time: 56s

***************   Catalog Core SQL   ***************

Serial   Phase #:1    [CDB$ROOT] Files:5    Time: 188s

Restart  Phase #:2    [CDB$ROOT] Files:1    Time: 3s

***********   Catalog Tables and Views   ***********

Parallel Phase #:3    [CDB$ROOT] Files:19   Time: 142s

Restart  Phase #:4    [CDB$ROOT] Files:1    Time: 2s

*************   Catalog Final Scripts   ************

Serial   Phase #:5    [CDB$ROOT] Files:7    Time: 100s

*****************   Catproc Start   ****************

Serial   Phase #:6    [CDB$ROOT] Files:1    Time: 47s

*****************   Catproc Types   ****************

Serial   Phase #:7    [CDB$ROOT] Files:2    Time: 43s

Restart  Phase #:8    [CDB$ROOT] Files:1    Time: 3s

****************   Catproc Tables   ****************

Parallel Phase #:9    [CDB$ROOT] Files:67   Time: 100s

Restart  Phase #:10   [CDB$ROOT] Files:1    Time: 4s

*

------ 此處省略多行 ------

------------------------------------------------------

Phases [0-107]         End Time:[2020_12_30 10:46:18]

Container Lists Inclusion:[CDB$ROOT] Exclusion:[NONE]

------------------------------------------------------

------ 開始 PDB1 PDB$SEED 升級 ------

Start processing of PDBs (PDB$SEED)

[/u01/app/oracle/product/19.0.0/dbhome_1/perl/bin/perl catctl.pl -I -i pdb_seed -n 2 -c 'PDB$SEED' -l /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941 catupgrd.sql]

Start processing of PDBs (PDB1)

[/u01/app/oracle/product/19.0.0/dbhome_1/perl/bin/perl catctl.pl -I -i pdb1 -n 2 -c 'PDB1' -l /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941 catupgrd.sql]

Argument list for [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/orcl/upgrade20201230093941

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.3.0.0.0DBRU_LINUX.X64_190417]

Argument list for [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/orcl/upgrade20201230093941

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.3.0.0.0DBRU_LINUX.X64_190417]

/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/orcl/upgrade20201230093941]

/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/orcl/upgrade20201230093941]

catcon::set_log_file_base_path: ALL catcon-related output will be written to [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941/catupgrdpdb_seed_catcon_32214.lst]

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

catcon::set_log_file_base_path: ALL catcon-related output will be written to [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941/catupgrdpdb1_catcon_32217.lst]

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

catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941/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/orcl/upgrade20201230093941/catupgrdpdb1_*.lst] files for spool files, if any

Number of Cpus        = 4

Number of Cpus        = 4

Database Name         = orcl

Database Name         = orcl

DataBase Version      = 19.0.0.0.0

DataBase Version      = 19.0.0.0.0

PDB1 Open Mode = [MIGRATE]

PDB$SEED Open Mode = [MIGRATE]

Generated PDB Inclusion:[PDB1]

Generated PDB Inclusion:[PDB$SEED]

CDB$ROOT  Open Mode = [OPEN]

CDB$ROOT  Open Mode = [OPEN]

Components in [PDB1]

    Installed [APS CATALOG CATJAVA CATPROC CONTEXT DV JAVAVM OLS ORDIM OWM SDO XDB XML XOQ]

Not Installed [APEX EM MGW ODM RAC WK]

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]

------------------------------------------------------

Phases [0-107]         Start Time:[2020_12_30 10:47:02]

Container Lists Inclusion:[PDB1] Exclusion:[NONE]

------------------------------------------------------

------------------------------------------------------

Phases [0-107]         Start Time:[2020_12_30 10:47:02]

Container Lists Inclusion:[PDB$SEED] Exclusion:[NONE]

------------------------------------------------------

***********   Executing Change Scripts   ***********

Serial   Phase #:0    [PDB1] Files:1 ***********   Executing Change Scripts   ***********

Serial   Phase #:0    [PDB$SEED] Files:1    Time: 65s

***************   Catalog Core SQL   ***************

Serial   Phase #:1    [PDB$SEED] Files:5    Time: 66s

***************   Catalog Core SQL   ***************

Serial   Phase #:1    [PDB1] Files:5    Time: 168s

Restart  Phase #:2    [PDB$SEED] Files:1    Time: 167s

Restart  Phase #:2    [PDB1] Files:1    Time: 1s

***********   Catalog Tables and Views   ***********

Parallel Phase #:3    [PDB$SEED] Files:19    Time: 1s

***********   Catalog Tables and Views   ***********

Parallel Phase #:3    [PDB1] Files:19   Time: 127s

Restart  Phase #:4    [PDB$SEED] Files:1   Time: 127s

Restart  Phase #:4    [PDB1] Files:1    Time: 2s

*************   Catalog Final Scripts   ************

Serial   Phase #:5    [PDB$SEED] Files:7    Time: 2s

*************   Catalog Final Scripts   ************

Serial   Phase #:5    [PDB1] Files:7    Time: 105s

*

------ 此處省略多行 ------

------------------------------------------------------

Phases [0-107]         End Time:[2020_12_30 11:51:28]

Container Lists Inclusion:[PDB1] Exclusion:[NONE]

------------------------------------------------------


Grand Total Time: 3867s [PDB1]

Grand Total Time: 3867s [PDB1]

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

Upgrade Summary Report Located in:

/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941/upg_summary.log

------ 開始 PDB2 PDB3 升級 ------

Start processing of PDBs (PDB2)

[/u01/app/oracle/product/19.0.0/dbhome_1/perl/bin/perl catctl.pl -I -i pdb2 -n 2 -c 'PDB2' -l /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941 catupgrd.sql]

Argument list for [catctl.pl]

For Oracle internal use only A = 0

Run in                       c = PDB2

Do not run in                C = 0

Input Directory              d = 0

Echo OFF                     e = 1

Simulate                     E = 0

Forced cleanup               F = 0

Log Id                       i = pdb2

Child Process                I = 1

Log Dir                      l = /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941

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.3.0.0.0DBRU_LINUX.X64_190417]

/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/orcl/upgrade20201230093941]

catcon::set_log_file_base_path: ALL catcon-related output will be written to [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941/catupgrdpdb2_catcon_12507.lst]

catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941/catupgrdpdb2*.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/orcl/upgrade20201230093941/catupgrdpdb2_*.lst] files for spool files, if any

Number of Cpus        = 4

Database Name         = orcl

DataBase Version      = 19.0.0.0.0

PDB2 Open Mode = [MIGRATE]

Generated PDB Inclusion:[PDB2]

CDB$ROOT  Open Mode = [OPEN]

Components in [PDB2]

    Installed [APS CATALOG CATJAVA CATPROC CONTEXT DV JAVAVM OLS ORDIM OWM SDO XDB XML XOQ]

Not Installed [APEX EM MGW ODM RAC WK]

 

------------------------------------------------------

Phases [0-107]         Start Time:[2020_12_30 11:52:12]

Container Lists Inclusion:[PDB2] Exclusion:[NONE]

------------------------------------------------------

***********   Executing Change Scripts   ***********

Serial   Phase #:0    [PDB2] Files:1    Time: 55s

***************   Catalog Core SQL   ***************

Serial   Phase #:1    [PDB2] Files:5    Time: 112s

Restart  Phase #:2    [PDB2] Files:1    Time: 2s

***********   Catalog Tables and Views   ***********

Parallel Phase #:3    [PDB2] Files:19    Time: 313s

****************   Summary report   ****************

Serial   Phase #:104  [PDB$SEED] Files:1    Time: 7s

***   End PDB Application Upgrade Post-Shutdown   **

Serial   Phase #:105  [PDB$SEED] Files:1    Time: 6s

Serial   Phase #:106  [PDB$SEED] Files:1   Time: 66s

Restart  Phase #:4    [PDB2] Files:1    Time: 2s

*************   Catalog Final Scripts   ************

Serial   Phase #:5    [PDB2] Files:7    Time: 77s

*****************   Catproc Start   ****************

Serial   Phase #:6    [PDB2] Files:1    Time: 83s

Serial   Phase #:107  [PDB$SEED] Files:1     Time: 0s

------------------------------------------------------

Phases [0-107]         End Time:[2020_12_30 11:57:29]

Container Lists Inclusion:[PDB$SEED] Exclusion:[NONE]

------------------------------------------------------

Grand Total Time: 4234s [PDB$SEED]

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

Upgrade Summary Report Located in:

/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941/upg_summary.log

Start processing of PDBs (PDB3)

[/u01/app/oracle/product/19.0.0/dbhome_1/perl/bin/perl catctl.pl -I -i pdb3 -n 2 -c 'PDB3' -l /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941 catupgrd.sql]

Argument list for [catctl.pl]

For Oracle internal use only A = 0

Run in                       c = PDB3

Do not run in                C = 0

Input Directory              d = 0

Echo OFF                     e = 1

Simulate                     E = 0

Forced cleanup               F = 0

Log Id                       i = pdb3

Child Process                I = 1

Log Dir                      l = /u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941

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.3.0.0.0DBRU_LINUX.X64_190417]

/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/orcl/upgrade20201230093941]

catcon::set_log_file_base_path: ALL catcon-related output will be written to [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941/catupgrdpdb3_catcon_28878.lst]

catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941/catupgrdpdb3*.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/orcl/upgrade20201230093941/catupgrdpdb3_*.lst] files for spool files, if any

Number of Cpus        = 4

Database Name         = orcl

DataBase Version      = 19.0.0.0.0

PDB3 Open Mode = [MIGRATE]

Generated PDB Inclusion:[PDB3]

CDB$ROOT  Open Mode = [OPEN]

Components in [PDB3]

    Installed [APS CATALOG CATJAVA CATPROC CONTEXT DV JAVAVM OLS ORDIM OWM SDO XDB XML XOQ]

Not Installed [APEX EM MGW ODM RAC WK]

   Time: 47s

*****************   Catproc Types   ****************

Serial   Phase #:7    [PDB2] Files:2

------------------------------------------------------

Phases [0-107]         Start Time:[2020_12_30 11:58:22]

Container Lists Inclusion:[PDB3] Exclusion:[NONE]

------------------------------------------------------

***********   Executing Change Scripts   ***********

Serial   Phase #:0    [PDB3] Files:1    Time: 55s

Restart  Phase #:8    [PDB2] Files:1    Time: 2s

****************   Catproc Tables   ****************

Parallel Phase #:9    [PDB2] Files:67    Time: 79s

***************   Catalog Core SQL   ***************

Serial   Phase #:1    [PDB3] Files:5   Time: 94s

Restart  Phase #:10   [PDB2] Files:1    Time: 2s

*************   Catproc Package Specs   ************

Serial   Phase #:11   [PDB2] Files:1    Time: 217s

Restart  Phase #:2    [PDB3] Files:1    Time: 1s

***********   Catalog Tables and Views   ***********

Parallel Phase #:3    [PDB3] Files:19    Time: 271s

Restart  Phase #:12   [PDB2] Files:1    Time: 2s

**************   Catproc Procedures   **************

Parallel Phase #:13   [PDB2] Files:94   Time: 122s

Restart  Phase #:4    [PDB3] Files:1    Time: 1s

*************   Catalog Final Scripts   ************

Serial   Phase #:5    [PDB3] Files:7   Time: 25s

Restart  Phase #:14   [PDB2] Files:1    Time: 2s

Parallel Phase #:15   [PDB2] Files:120  Time: 44s

Restart  Phase #:16   [PDB2] Files:1    Time: 2s

Serial   Phase #:17   [PDB2] Files:22   Time: 13s

Restart  Phase #:18   [PDB2] Files:1    Time: 1s

*

------ 此處省略多行 ------

------------------------------------------------------

Phases [0-107]         End Time:[2020_12_30 12:42:58]

Container Lists Inclusion:[PDB2] Exclusion:[NONE]

------------------------------------------------------

   Time: 21s

Restart  Phase #:86   [PDB3] Files:1

Grand Total Time: 3047s [PDB2]

 LOG FILES: (/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941/catupgrdpdb2*.log)

Upgrade Summary Report Located in:

/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941/upg_summary.log

   Time: 1s

Parallel Phase #:87   [PDB3] Files:4    Time: 86s

Restart  Phase #:88   [PDB3] Files:1    Time: 1s

Serial   Phase #:89   [PDB3] Files:1    Time: 9s

Restart  Phase #:90   [PDB3] Files:1    Time: 1s

Serial   Phase #:91   [PDB3] Files:2    Time: 21s

Restart  Phase #:92   [PDB3] Files:1    Time: 2s

Serial   Phase #:93   [PDB3] Files:1    Time: 6s

Restart  Phase #:94   [PDB3] Files:1    Time: 2s

*******   Upgrading ODM, WK, EXF, RUL, XOQ   *******

Serial   Phase #:95   [PDB3] Files:1    Time: 24s

Restart  Phase #:96   [PDB3] Files:1    Time: 2s

***********   Final Component scripts    ***********

Serial   Phase #:97   [PDB3] Files:1    Time: 8s

*************   Final Upgrade scripts   ************

Serial   Phase #:98   [PDB3] Files:1    Time: 194s

*******************   Migration   ******************

Serial   Phase #:99   [PDB3] Files:1    Time: 6s

***   End PDB Application Upgrade Pre-Shutdown   ***

Serial   Phase #:100  [PDB3] Files:1    Time: 7s

Serial   Phase #:101  [PDB3] Files:1    Time: 73s

Serial   Phase #:102  [PDB3] Files:1    Time: 7s

*****************   Post Upgrade   *****************

Serial   Phase #:103  [PDB3] Files:1    Time: 20s

****************   Summary report   ****************

Serial   Phase #:104  [PDB3] Files:1    Time: 7s

***   End PDB Application Upgrade Post-Shutdown   **

Serial   Phase #:105  [PDB3] Files:1    Time: 6s

Serial   Phase #:106  [PDB3] Files:1    Time: 19s

Serial   Phase #:107  [PDB3] Files:1     Time: 0s

------------------------------------------------------

Phases [0-107]         End Time:[2020_12_30 12:51:22]

Container Lists Inclusion:[PDB3] Exclusion:[NONE]

------------------------------------------------------

Grand Total Time: 3181s [PDB3]

 LOG FILES: (/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941/catupgrdpdb3*.log)

Upgrade Summary Report Located in:

/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941/upg_summary.log

     Time: 3964s For CDB$ROOT

     Time: 7508s For PDB(s)

Grand Total Time: 11472s

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

Upgrade Summary Report Located in:

/u01/app/oracle/product/19.0.0/dbhome_1/cfgtoollogs/orcl/upgrade20201230093941/upg_summary.log

Grand Total Upgrade Time:    [0d:3h:11m:12s]

 

升級完成後,CDB open 狀態, PDB mounted 狀態,需要將 PDB 啟動。

$ sqlplus / as sysdba

SQL> alter pluggable database all open;

升級後操作

升級後操作還是要參考 preupgrade.log 日誌,部分要手工操作,其他的執行生成的 postupgrade_fixups.sql 指令碼即可。

1.  編譯無效物件,針對CDB PDBs

$ cd $ORACLE_HOME/rdbms/admin/

$ $ORACLE_HOME/perl/bin/perl catcon.pl -n 1 -e -b utlrp -d '''.''' utlrp.sql

catcon::set_log_file_base_path: ALL catcon-related output will be written to [/u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/utlrp_catcon_27855.lst]

catcon::set_log_file_base_path: catcon: See [ /u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/utlrp*.log ] files for output generated by scripts

catcon::set_log_file_base_path: catcon: See [/u01/app/oracle/product/19.0.0/dbhome_1/rdbms/admin/utlrp_*.lst] files for spool files, if any

2.  收集資料字典統計資訊

執行以下儲存過程

SQL> EXECUTE DBMS_STATS.GATHER_DICTIONARY_STATS;

3.  收集固定物件統計資訊

執行以下儲存過程

SQL> EXECUTE DBMS_STATS.GATHER_FIXED_OBJECTS_STATS;

4.  執行preupgrade.log 日誌中 postupgrade_fixups.sql 指令碼

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

5.  如果是RAC 環境,需要設定 cluster_database true

 

---- end ----

 

 

 


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31529886/viewspace-2746591/,如需轉載,請註明出處,否則將追究法律責任。

相關文章