oracle数据库脚本自动升级,【数据库升级】Oracle脚本升级12c CDB to 19c CDB

一、

环境说明

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

数据库,最小版本要求

oracle数据库脚本自动升级,【数据库升级】Oracle脚本升级12c CDB to 19c CDB_第1张图片

升级CDB

19c

,最小版本要求

90a884813e7a2bf2250f4f12432e3e8a.png

升级前准备

一、

源端环境需求和检查

-

在升级之前,确保

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]:

日志在

下创建。如果不指定输出目录

dir

选项,那么将会在以下默认目录之一创建日志:

如果你定义了ORACLE_BASE,

日志会被创建在

$ORACLE_BASE/cfgtoollogs//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 ----

你可能感兴趣的:(oracle数据库脚本自动升级)