手动升级 --从 12.1.x.x 到 18.x.x.x 的完整核对清单 (文档 ID 2504935.1)


Oracle 18c - 手动升级 Oracle 多租户架构数据库从 12.1.x.x 到 18.x.x.x 的完整核对清单 (文档 ID 2504935.1)


文档内容

用途
适用范围
详细信息
介绍
并行升级 Oracle Multitenant
顺序升级Oracle Multitenant
手工升级 Multitenant Container Oracle Database (CDB)
步骤 1: 对源 CDB/PDB 数据库的建议
步骤 2: 目标环境的需求和建议
步骤 3: 升级前步骤
步骤 4: 升级步骤
步骤 5: 升级后步骤
以指定优先级使用 Parallel Upgrade Utility 升级PDB

使用优先级列表,包含列表和排除列表升级PDB
包含列表的示例
排除列表的示例
使用了CATCTL_LISTONLY的排除列表
并行升级 Pluggable Databases (PDBs) 
并行升级PDB的步骤
并行升级多租户数据库

适用于:

Oracle Database Cloud Exadata Service - 版本 N/A 和更高版本
Oracle Database Cloud Schema Service - 版本 N/A 和更高版本
Oracle Database Backup Service - 版本 N/A 和更高版本
Oracle Database Cloud Service - 版本 N/A 和更高版本
Oracle Database - Enterprise Edition - 版本 12.1.0.1 到 18.3.0.0.0 [发行版 12.1 到 18]
本文档所含信息适用于所有平台

用途

本文档可用于升级 12cR1, 12cR2 多租户数据库到更高版本18.x.x.x的指南与核对清单。

适用范围

 Database Administrators, Support

详细信息

介绍

多租户架构数据库可以并行升级,也可以串行升级。

从Oracle Database 12c第1版(12.1)开始,Oracle提供了多租户架构,可以在容器数据库(CDB)中创建和管理可插拔数据库(PDB)。您可以使用Oracle数据库升级助手(DBUA)或手工使用 Parallel Upgrade Utility 升级多租户架构系统。

升级多租户架构Oracle数据库有两种方法:

  • 并行升级。 使用这种技术,先升级CDB,然后并行升级PDB。
  • 顺序升级。 使用这种技术,先安装新版本的CDB,然后从之前版本的CDB中拔出PDB并插入到新版本的CDB中,之后升级每个PDB。 

并行升级 Oracle Multitenant

在并行升级的技术下,先使用Parallel Upgrade Utility (catctl.pl)升级CDB$ROOT,使用参数来设置并行处理的并行度

-n参数定义运行升级的并行进程数,最多8个。

-M参数确定CDB$ROOT在整个升级过程中是保持UPGRADE模式,还是在CDB升级完成后可用于访问。如果未使用-M参数升级,则在完成CDB$ROOT升级后,只要每个PDB完成升级,PDB就可以被访问。如果使用-M参数升级,则CDB$ROOT将保持UPGRADE模式,并且在完成所有PDB的升级之前,PDB不可用。

顺序升级Oracle Multitenant

在顺序升级的技术下,先安装新版本的CDB,然后在之前版本的CDB中执行 preupgrade 脚本来准备升级一个或者多个PDB。关闭并拔出这些PDB,之后插入到新版本的CDB中,然后按顺序完成每个PDB的升级。

手工升级  Multitenant Container Oracle Database (CDB)

步骤 1: 对源 CDB/PDB 数据库的建议
  • 升级数据库之前,确保源库中 Oracle 提供的所有数据库组件/对象都是有效的。  通过执行dbupgdiag.sql验证数据库运行状况(请参阅note 556610.1以下载此脚本)。
    • 如果报告出任何无效对象,运行 $ORACLE_HOME/rdbms/admin/utlrp.sql(多次)以使数据库中的无效对象变为有效。

$ cd $ORACLE_HOME/rdbms/admin

$ sqlplus "/ as sysdba"

SQL> alter session set container=<PDB_Name>

SQL> @utlrp.sql

  • 对源库做冷备份或热备份
  • 禁用自定义的 before/after DDL 类型的触发器,升级完成后再启用它们。

检查 PDB 的状态。应该是处于读写模式打开的状态。

下面的命令可以用来确认 Multitenant Option 是启用的。

例如:

 

SQL> select name, open_mode,cdb,i.con_id, version from V$database,v$instance i;

NAME OPEN_MODE CDB CON_ID VERSION
--------- -------------------- --- ---------- -----------------
DB18C READ WRITE YES 0 18.0.0.0.0

SQL> select CON_ID, NAME, OPEN_MODE from V$PDBS;

CON_ID NAME OPEN_MODE

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

2 PDB$SEED READ ONLY

3 PDB1 READ WRITE

  • 在升级前执行Preupgrade脚本并检查 preupgrade 的日志
  • 验证物化视图刷新在升级之前已经完成。
  • 在升级 oracle 数据库之前,您必须要等所有的物化视图都已经完成了刷新。

步骤 2: 目标环境的需求和建议
  • 验证您的平台/操作系统是支持18.1的。
  • 安装的18.1.0.0并确保安装没有错误。
  • 安装最新的 RU / RUR (如果有的话)。
  • 从源库 Oracle home 拷贝spfile 或者 pfile到目标数据库的新 Oracle home 下。查看文档 "Patches to apply before upgrading Oracle GI and DB to 18c (Doc ID 2414935.1)" 中给出的补丁建议
    • 从pfile中删除任何不必要的隐藏/下划线参数以及被废弃掉的参数
    • 可以升级到 18.1 的 COMPATIBLE 参数最小需要是 “11.2.0”,确认数据库 COMPATIBLE 参数已被设置为 11.2.0 或者更高
  • 查看文档 "Patches to apply before upgrading Oracle GI and DB to 18c (Doc ID 2414935.1)" 中给出的补丁建议

步骤 3: 升级前步骤

1. 打开所有的 PDB

SQL> alter pluggable database all open;

2. 使用下面的格式运行 Pre-Upgrade Information Tool (preupgrade.jar):

java -jar $New_release_Oracle_home/rdbms/admin/preupgrade.jar [TERMINAL|FILE|DIR outputdir] [TEXT|XML] [-c InclusionListOfPDBs] [-C ExclusionListOfPDBs]

对列表使用空格分隔。 在Linux和UNIX上,通过将列表放在单引号内来定义列表:'。 在Windows系统上,通过将列表放在双引号内来定义列表:"。

Linux 和 UNIX:

java -jar $ORACLE_HOME_18.1/rdbms/admin/preupgrade.jar -c 'pdb1 pdb2 pdb3 pdb4 pdb5 pdb6 pdb7 pdb8 pdb9 pdb10 pdb11 pdb12 pdb13 pdb14 pdb15 pdb16 pdb17 pdb18 pdb19 pdb20 pdb21 pdb22 pdb23 pdb24 pdb25'

Windows:

java -jar %ORACLE_HOME_18.1%/rdbms/admin/preupgrade.jar -c "pdb1 pdb2 pdb3 pdb4 pdb5 pdb6 pdb7 pdb8 pdb9 pdb10 pdb11 pdb12 pdb13 pdb14 pdb15 pdb16 pdb17 pdb18 pdb19 pdb20 pdb21 pdb22 pdb23 pdb24 pdb25"

注意: 必须使用 Java 1.5 或者更高版本来运行 Pre-Upgrade Information 工具
         如果没有参数传递给preupgrade.jar,则它将针对所有容器数据库(CDB和PDB)运行。

3. 检查生成的任何修复脚本和日志文件。

如果定义了 ORACLE_BASE,那么修复文件将放在

Linux 和 UNIX:

$ORACLE_BASE/cfgtoollogs/db_unique_name/preupgrade

Windows:

%ORACLE_BASE%\cfgtoollogs\db_unique_name\preupgrade

如果没有定义 ORACLE_BASE,那么修复文件将放在

Linux 和 UNIX:

$ORACLE_HOME/cfgtoollogs/db_unique_name/preupgrade

Windows:

%ORACLE_HOME\cfgtoollogs\db_unique_name\preupgrade

4. 执行 preupgrade_fixups 脚本或者单独的PDB脚本

注意: PDB$SEED对应的 fixup 脚本是 preupgrade_fixups_pdb_seed.sql

5. 对于Oracle RAC数据库,将CLUSTER_DATABASE设置为false

ALTER SYSTEM SET cluster_database=FALSE SCOPE=spfile;

6. 在旧的Oracle home上关闭数据库

比如:这里 db_unique_name 是数据库的名字

$ srvctl stop database -d db_unique_name

7. 从源库 Oracle home 拷贝spfile 或者 pfile到目标数据库的新 Oracle home 下。

步骤 4: 升级步骤

8. 使用 SQL*Plus 连接到数据库

sqlplus / as sysdba

9. 把 CDB$ROOT 置于升级模式

STARTUP UPGRADE

10. 把所有 PDBs 置于升级模式

ALTER PLUGGABLE DATABASE ALL OPEN UPGRADE;

11. 检查所有的PDB,确认它们是正确的状态

SHOW PDBS

所有的 PDBs 的状态都应该是  MIGRATE.


12. 退出 SQL*Plus并切换目录到新的 Oracle home $ORACLE_HOME/rdbms/admin:

SQL> EXIT
$ ORACLE_HOME/bin

13. 使用 Parallel Upgrade Utility(catctl.pl,使用shell命令dbupgrade)开始升级,其中-d指定目录的位置

dbupgrade -d $ORACLE_HOME/rdbms/admin

 如果未指定任何参数,则Parallel Upgrade Utility将以相当于CPU数量除以2的数量并行升级PDB。在具有64个CPU的服务器上,会并行升级32个PDB,每个PDB使用两个SQL processors。CDB$ROOT在升级期间保持 NORMAL 模式。

14. 检查日志 upg_summary.log 确保升级是成功的

步骤 5: 升级后步骤

15. 打开所有的 PDBs 

ALTER PLUGGABLE DATABASE ALL OPEN;

16. 退出 SQL*Plus并切换目录到新的 Oracle home $ORACLE_HOME/rdbms/admin:

SQL> EXIT
cd $ORACLE_HOME/rdbms/admin

17. 运行新版本数据库中提供的 catcon.pl 脚本以及 postupgrade_fixups.sql 脚本。

下面的例子是运行 catcon.pl 的命令,使用 -n 参数为每个 PDB 指定一个并行处理器,使用 -d 参数指定要运行的 preupgrade 脚本所在路径,使用-l参数指定日志文件的存放位置,使用 -b 标志指定 postupgrade_fixups.sql 脚本的日志文件前缀:

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -d $ORACLE_HOME/cfgtoollogs/cdbupgr/preupgrade -l /home/oracle/upgrdDBA -b postupgrade_fixups postupgrade_fixups.sql

18. 执行 postupgrade_fixups.sql.

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

19. 执行 utlu122s.sql 来确认没有升级错误问题

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

会产生日志 utlu122s0.log 

20. 对于Oracle RAC数据库修改CLUSTER_DATABASE 参数为TRUE,并启动数据库 

ALTER SYSTEM SET CLUSTER_DATABASE=TRUE SCOPE=SPFILE;
srvctl start database -db db_unique_name

以指定优先级使用 Parallel Upgrade Utility 升级PDB

在Oracle Database 12.2及更高版本中,您可以使用优先级列表升级PDB,以便在其他PDB之前升级一组PDB,并且我们可以修改该升级优先级。此列表允许根据优先级对PDB进行分组升级。 优先级列表是一个文本文件,其中包含定义升级优先级顺序的逗号分隔列表。使用 Parallel Upgrade Utility (dbupgrade, dbupgrade.cmd, or catctl.pl) 的 -L 参数来指定优先级列表。

优先级列表的格式

Number, Pdb
    numeral,pdb1,pdb2,pdb3
    numeral,pdb4
    numeral,pdb5,pdb6,pdb7,pdb8
    .
    .
    .


注意:  

  • 使用纯文本编辑器来创建优先级列表,比如Linux 和 UNIX上的 vi或者Windows上的Notepad。
  • 这里的数字代表了PDB的具体优先级

运行 Parallel Upgrade Utility 时,适用以下处理规则:

    CDB$ROOT 和 PDB$SEED 拥有最高优先级(即使在优先级列表中指定了其它优先级)
    优先级列表中的PDB都是按照指定的优先级升级的
    没有在优先级列表中的PDB最后升级


使用优先级列表运行 Parallel Upgrade utility 的语法

dbupgrade -L priority_list_name


升级完成后,将在CDB中维护PDB优先级状态。如果我们将数据库升级到下一版本,它将使用相同的优先级。 要改变这一点,我们必须执行

SQL> alter session set container = CDB$ROOT
SQL> alter pluggable database PDBName upgrade priorityPDBPriorityNumber


使用优先级列表,包含列表和排除列表升级PDB

以下术语代表的升级列表处理的类型:

    优先级列表:以逗号分隔的列表,用于指定列表中PDB的升级优先级。
    包含列表:指定要升级的PDB的逗号分隔列表。 这些列表中的PDB在优先级列表中列出的PDB之后升级。
    排除列表:以逗号分隔的列表,用于指定您不希望升级的PDB。

 

包含列表的示例

并使用以下优先级列表

1,CDB$ROOT
1,PDB$SEED
1,CDB1_PDB2,CDB1_PDB4
2.CDB1_PDB5

catctl -L priority.lst -c 'CDB1_PDB2 CDB1_PDB4 CDB1_PDB5' catupgrd.sql

升级顺序按以下顺序执行:

    CDB1_PDB2, CDB1_PDB4
    CDB1_PDB5

Parallel Upgrade Utility 仅处理包含列表中的PDB,并按优先级列表的顺序处理。

排除列表的示例

并使用以下优先级列表

1,CDB$ROOT
1,PDB$SEED
1,CDB1_PDB1,CDB1_PDB2
2,CDB1_PDB3,CDB1_PDB4
3,CDB1_PDB5

catctl -L priority.lst -C 'CDB$ROOT' catupgrd.sql

由于排除了CDB$ROOT,优先级处理会发生变化。 升级顺序按以下顺序执行:

    PDB$SEED, CDB_PDB1
    CDB_PDB2, CDB_PDB3
    CDB1_PDB4, CDB1_PDB5

使用了CATCTL_LISTONLY的排除列表

并使用以下优先级列表

1,CDB$ROOT
1,PDB$SEED
1,CDB1_PDB1,CDB1_PDB2
2,CDB1_PDB3
3,CDB1_PDB5

catctl -L priority.lst -C 'CATCTL_LISTONLY' catupgrd.sql


使用CATCTL_LISTONLY选项,不在优先级列表中的PDB将从升级中排除。在排除列表中指定关键字CATCTL_LISTONLY会将优先级列表转换为包含优先级列表。 仅处理列表中的PDB。

并行升级 Pluggable Databases (PDBs) 

使用并行技术,您可以升级CDB,然后立即使用parallel SQL processors升级PDB。

容器数据库(CDB)可以包含零个,一个或多个可插拔数据库(PDB)。 默认情况下,Parallel Upgrade Utility(catctl.pl)在同一升级窗口中升级CDB及其所有PDB。 Parallel Upgrade Utility 使用CPU的数量来确定同时升级的最大PDB数。 并行升级的PDB数量是通过将并行SQL进程计数(-n选项)除以并行PDB SQL进程计数(-N选项)来确定的。

dbupgrade [-M] -n [-N]

    -M 参数确定CDB$ROOT在整个升级过程中是保持UPGRADE模式,还是在CDB升级完成后可用于访问。

        如果使用-M参数升级,则CDB$ROOT将保持UPGRADE模式,并且在完成所有PDB的升级之前,PDB不可用。

        如果未使用-M参数升级,则在完成CDB$ROOT升级后,只要每个PDB完成升级,PDB就可以被访问。

    -n 参数定义运行升级的并行进程数,最多8个。

    如果未指定-n的值,则-n的缺省值为CPU_COUNT值。

    如果为-n指定了值,则该值用于确定并行SQL进程的数量。 最大值是无限的。 最小值为4。

    -N 指定升级PDB时要使用的SQL处理器数。 最大值为8,最小值为1,如果未指定-N的值,则默认值为2。

    同时运行的最大PDB升级是-n的值除以-N的值。

并行升级PDB的步骤

1. 确认已备份数据库
2. 运行 pre-upgrade 工具,解决所有发现的问题,确保没有失效的对象/组件
3. 执行Parallel Upgrade Utility:

    a. 周期1: CDB$ROOT 被升级到最新的版本
    b. 周期2到周期x: PDB$SEED 和 PDBs 被并行升级,由-n指定的参数确定升级的周期数。
4. 执行post-upgrade步骤

并行升级多租户数据库

使用此技术一次性升级CDB$ROOT, PDB$SEED和所有的PDB。Oracle推荐使用这种升级方式,它提供了直接的升级并可以减少停机次数。取决于服务器可用的CPU个数,它可以并行升级PDB。

1. 确保已有合适的备份策略
2. 打开所有的 PDB


比如:

SQL> alter pluggable database all open;


3. 使用下面的格式运行 Pre-Upgrade Information Tool (preupgrade.jar):


java -jar $New_release_Oracle_home/rdbms/admin/preupgrade.jar [TERMINAL|FILE|DIR outputdir] [TEXT|XML] [-c InclusionListOfPDBs] [-C ExclusionListOfPDBs]

Linux 和 UNIX:

java -jar $ORACLE_HOME_18.1/rdbms/admin/preupgrade.jar -c 'pdb1 pdb2 pdb3 pdb4 pdb5 pdb6 pdb7 pdb8 pdb9 pdb10 pdb11 pdb12 pdb13 pdb14 pdb15 pdb16 pdb17 pdb18 pdb19 pdb20 pdb21 pdb22 pdb23 pdb24 pdb25'

Windows:

java -jar %ORACLE_HOME_18.1%/rdbms/admin/preupgrade.jar -c "pdb1 pdb2 pdb3 pdb4 pdb5 pdb6 pdb7 pdb8 pdb9 pdb10 pdb11 pdb12 pdb13 pdb14 pdb15 pdb16 pdb17 pdb18 pdb19 pdb20 pdb21 pdb22 pdb23 pdb24 pdb25"


4. 阅读生成的任何修复脚本和日志文件。

如果定义了 ORACLE_BASE,那么修复文件将放在

Linux 和 UNIX:

    $ORACLE_BASE/cfgtoollogs/db_unique_name/preupgrade

Windows

    %ORACLE_BASE%\cfgtoollogs\db_unique_name\preupgrade

如果没有定义 ORACLE_BASE,那么修复文件将放在 

Linux 和 UNIX:

    $ORACLE_HOME/cfgtoollogs/db_unique_name/preupgrade

Windows:

    %ORACLE_HOME\cfgtoollogs\db_unique_name\preupgrade


5. 执行 preupgrade_fixups 脚本或者单独的PDB脚本

6. 对于Oracle RAC数据库,将CLUSTER_DATABASE设置为false

比如;

ALTER SYSTEM SET cluster_database=FALSE SCOPE=spfile;


7. 在旧的Oracle home上关闭数据库

8. 从源库 Oracle home 拷贝spfile 或者 pfile到目标数据库的新 Oracle home 下。
9. 使用 SQL*Plus 连接到数据库

sqlplus / as sysdba

10. 把 CDB$ROOT 置于升级模式

STARTUP UPGRADE

11. 把所有 PDBs 置于升级模式

ALTER PLUGGABLE DATABASE ALL OPEN UPGRADE;

12. 检查所有的PDB,确认它们是正确的状态

SHOW PDBS


所有的 PDBs 的状态都应该是  MIGRATE

13. 退出 SQL*Plus并切换目录到新的 Oracle home $ORACLE_HOME/rdbms/admin:

SQL> EXIT
$ ORACLE_HOME/bin


14. 使用 Parallel Upgrade Utility(catctl.pl,使用shell命令dbupgrade)开始升级,其中-d指定目录的位置

dbupgrade -d $ORACLE_HOME/rdbms/admin

15. 检查日志 upg_summary.log 确保升级是成功的
16. 打开所有的 PDBs 

ALTER PLUGGABLE DATABASE ALL OPEN;

17. 退出 SQL*Plus并切换目录到新的 Oracle home $ORACLE_HOME/rdbms/admin:

SQL> EXIT
cd $ORACLE_HOME/rdbms/admin

18. 运行新版本数据库中提供的 catcon.pl 脚本以及 postupgrade_fixups.sql 脚本。

下面的例子是运行 catcon.pl 的命令,使用 -n 参数为每个 PDB 指定一个并行处理器,使用 -d 参数指定要运行的 preupgrade 脚本所在路径,使用-l参数指定日志文件的存放位置,使用 -b 标志指定 postupgrade_fixups.sql 脚本的日志文件前缀:

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -d \
$ORACLE_HOME/cfgtoollogs/cdbupgr/preupgrade -l /home/oracle/upgrdDBA -b \
postupgrade_fixups postupgrade_fixups.sql

19. 执行 postupgrade_fixups.sql

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

20. 执行 utlu122s.sql 来确认没有错误

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

当时用 catcon.pl 来运行 utlu122s.sql,会产生日志 utlu122s0.log 

21. 对于Oracle RAC数据库修改CLUSTER_DATABASE 参数为TRUE,并启动数据库。这里 db_unique_name 是RAC数据库的名字:

ALTER SYSTEM SET CLUSTER_DATABASE=TRUE SCOPE=SPFILE;
srvctl start database -db db_unique_name

 

 

Oracle 18c - Complete checklist for Manual Upgrade for Multitenant Architecture Oracle Databases from 12.1.x.x to 18.x.x.x (文档 ID 2422161.1)

In this Document

Purpose
Scope
Details
Introduction
Upgrading Oracle Multitenant In Parallel
Upgrading Oracle Multitenant In Sequence
Manually Upgrading a Multitenant Container Oracle Database (CDB)
Step 1: Recommendations for source CDB / PDB database
Step2: Requirements and recommendations for target ORACLE_HOME
Step 3: Pre-Upgrade Steps
Step 4: Upgrade Steps
Step 5: Post-Upgrade Steps
Upgrading PDBs Using the Parallel Upgrade Utility with Priority Lists 

PDB Upgrades Using Priority Lists, Inclusion Lists, and Exclusion Lists
Example of Inclusion List
Example of Exclusion List
Exclusion List using CATCTL_LISTONLY
Upgrading Pluggable Databases (PDBs) In Parallel
Steps to upgrade PDBs in parallel
Upgrading Multitenant Container Databases In Parallel

APPLIES TO:

Oracle Database Exadata Cloud Machine - Version N/A and later
Oracle Cloud Infrastructure - Database Service - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Oracle Database Cloud Exadata Service - Version N/A and later
Oracle Database Cloud Schema Service - Version N/A and later
Information in this document applies to any platform.

PURPOSE

 This document is created for use as a guideline and checklist when upgrading 12cR1, 12cR2 multitenant database to higher version 18.x.x.x

SCOPE

 Database Administrators, Support

DETAILS

Introduction

Multitenant architecture database can either be upgraded in parallel, or in sequence.

Starting with Oracle Database 12c release 1 (12.1), Oracle provides multitenant architecture, which enables the creation and administration of pluggable databases (PDBs) in a container database (CDB). You can upgrade multitenant architecture systems using either Oracle Database Upgrade Assistant (DBUA), or using the Parallel Upgrade Utility to carry out manual upgrades.

There are two techniques for upgrading Oracle Databases using the multitenant architecture:

  • In parallel. With this technique, you carry out one upgrade operation that upgrades the CDB, and then upgrades the PDBs in parallel.
  • Sequentially. With this technique, you install a new release CDB, prepare and unplug PDBs from the earlier release CDB, plug the PDBs into a later release CDB, and then complete the upgrade for each PDB.

Upgrading Oracle Multitenant In Parallel

With the In Parallel technique, you first upgrade CDB$ROOT using the Parallel Upgrade Utility (catctl.pl), using parameters to set the degree of parallel processing and availability:

The -n parameter defines how many parallel processes run the upgrade, up to 8.

The -M parameter determines if the CDB$ROOT stays in UPGRADE mode through the entire upgrade, or becomes available for access after the CDB upgrade is complete. If you do not run the upgrade with the -M parameter, then when the CDB$ROOT upgrade is complete, PDBs then become available for access as soon as each PDB completes its upgrade. If you run the upgrade with the -M parameter, then CDB$ROOT stays in UPGRADE mode, and PDBs do not become available until upgrade of all PDBs is complete.

Upgrading Oracle Multitenant In Sequence

With the In Sequence technique, you install the new release multitenant architecture CDB. Next, in the earlier release multitenant architecture CDB, you issue SQL commands to run preupgrade scripts to prepare one or more PDBs to upgrade, and shut them down. You then unplug PDBs, plug them into the new release multenant architecture CDB, and complete the upgrade sequentially for each PDB.

Manually Upgrading a Multitenant Container Oracle Database (CDB)

Step 1: Recommendations for source CDB / PDB database
  • Make sure there are no INVALID objects/components in the source database.  Verify the database health by executing dbupgdiag.sql (refer Note 556610.1 to download this script).
    • If there are any INVALID objects are found execute $ORACLE_HOME/rdbms/admin/utlrp.sql multiple times to validate them

$ cd $ORACLE_HOME/rdbms/admin

$ sqlplus "/ as sysdba"

SQL> alter session set container=<PDB_Name>

SQL> @utlrp.sql

  • Take a cold or hot backup of the source database
  • Disable any custom triggers that would get executed before / after DDL. You can enable it once upgrade is completed.

Check the status of PDB. It should be in open with Read write mode

These commands will also make sure the Multitenant Option is enabled.

Example:

 

SQL> select name, open_mode,cdb,i.con_id, version from V$database,v$instance i;

NAME OPEN_MODE CDB CON_ID VERSION
--------- -------------------- --- ---------- -----------------
DB18C READ WRITE YES 0 18.0.0.0.0

SQL> select CON_ID, NAME, OPEN_MODE from V$PDBS;

CON_ID NAME OPEN_MODE

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

2 PDB$SEED READ ONLY

3 PDB1 READ WRITE

  • Execute Preupgrade scripts before upgrade and review the preupgrade log for any issues.
  • Check the status of all materialized views (MV), and refresh any materialized views that are not fresh.
  • Before upgrading Oracle Database, you must wait until all materialized views have completed refreshing.

Step2: Requirements and recommendations for target ORACLE_HOME
  • Verify the whether your operating system is certified for 18.1. Click here to launch certification portal
  • Install 18.1.0.0, verify there are no installation related issues.
  • Download and install latest RU / RUR if any
  • Copy spfile or pfile from source ORACLE_HOME (under $ORACLE_HOME/dbs) to target homeReview patch recommendations as given in the article "Patches to apply before upgrading Oracle GI and DB to 18c (Doc ID 2414935.1)"
    • Remove any _ (underscore) parameter, obsolete and deprecated parameters in pfile
    • Note min value of COMPATIBLE parameter to upgrade 18.1 is “11.2.0”, make sure you have COMPATIBLE parameter is set to 11.2.0 or greater
  • Review patch recommendations as given in the article "Patches to apply before upgrading Oracle GI and DB to 18c (Doc ID 2414935.1)"
  • Apply patch 29213893 on target ORACLE_HOME to avoid ORA-01422 error - refer: Database Upgrade to 12.2, 18c, 19c fails with ORA-01422, ORA-06512 for SYS.DBMS_STATS (Doc ID 2525596.1)

Step 3: Pre-Upgrade Steps

1. Open all PDBs

SQL> alter pluggable database all open;

2. Run the Pre-Upgrade Information Tool (preupgrade.jar), using the following syntax:

java -jar $New_release_Oracle_home/rdbms/admin/preupgrade.jar [TERMINAL|FILE|DIR outputdir] [TEXT|XML] [-c InclusionListOfPDBs] [-C ExclusionListOfPDBs]

Use space-delimitation for lists. On Linux and UNIX, define the list by placing the list inside single quotes: '. On Windows systems, define the list by placing the list inside double quotes ".

Linux and UNIX:

java -jar $ORACLE_HOME_18.1/rdbms/admin/preupgrade.jar -c 'pdb1 pdb2 pdb3 pdb4 pdb5 pdb6 pdb7 pdb8 pdb9 pdb10 pdb11 pdb12 pdb13 pdb14 pdb15 pdb16 pdb17 pdb18 pdb19 pdb20 pdb21 pdb22 pdb23 pdb24 pdb25'

Windows:

java -jar %ORACLE_HOME_18.1%/rdbms/admin/preupgrade.jar -c "pdb1 pdb2 pdb3 pdb4 pdb5 pdb6 pdb7 pdb8 pdb9 pdb10 pdb11 pdb12 pdb13 pdb14 pdb15 pdb16 pdb17 pdb18 pdb19 pdb20 pdb21 pdb22 pdb23 pdb24 pdb25"

Note: You must use Java 1.5 or later to run the Pre-Upgrade Information too.
         If no parameters are passed to the preupgrade.jar , it is run against all the container databases ( CDB and PDB's ).

3. Review any generated fixup scripts and log files.

If ORACLE_BASE is defined, then the fixup files are placed in

Linux and UNIX:

$ORACLE_BASE/cfgtoollogs/db_unique_name/preupgrade

Windows:

%ORACLE_BASE%\cfgtoollogs\db_unique_name\preupgrade

If ORACLE_BASE is not defined, then fixup files are placed in one of the following paths:

Linux and UNIX:

$ORACLE_HOME/cfgtoollogs/db_unique_name/preupgrade

Windows:

%ORACLE_HOME\cfgtoollogs\db_unique_name\preupgrade

4. Execute the preupgrade_fixups script, or individual PDB scripts.\

Note: fixup script for PDB$SEED is preupgrade_fixups_pdb_seed.sql

5. For Oracle RAC database set CLUSTER_DATABASE to false

ALTER SYSTEM SET cluster_database=FALSE SCOPE=spfile;

6. Shut down the database in the old Oracle home.

For example, where db_unique_name is your database name:

$ srvctl stop database -d db_unique_name

7. Copy the PFILE or SPFILE from the old Oracle home to the new Oracle home

Step 4: Upgrade Steps

8. Connect with SQL*Plus:

sqlplus / as sysdba

9. Bring the CDB$ROOT instance into upgrade mode:

STARTUP UPGRADE

10. Bring all PDBs into upgrade mode:

ALTER PLUGGABLE DATABASE ALL OPEN UPGRADE;

11. Check the status of PDBs to confirm that they are ready to upgrade:  

SHOW PDBS

For all PDBs, ensure that the status is set to MIGRATE.


12. Exit from SQL*Plus, and change directory to the new Oracle home $ORACLE_HOME/rdbms/admin:

SQL> EXIT
$ ORACLE_HOME/bin

13. Start the upgrade using the Parallel Upgrade Utility (catctl.pl, using the shell command dbupgrade), where -d specifies the location of the directory:

dbupgrade -d $ORACLE_HOME/rdbms/admin

If you do not specify any parameters, then the Parallel Upgrade Utility runs the upgrade in parallel on the number of PDBs equivalent to the number of CPUs divided by 2. On a server with 64 CPUs, 64 divided by 2 equals 32 PDBs upgraded in parallel, carried out with two SQL processors for each PDB. CDB$ROOT remains in NORMAL mode for the duration of the upgrade. 

14. Review the upg_summary.log to confirm that the upgrade was successful, and if necessary, review other logs. 

Step 5: Post-Upgrade Steps

15. Open all PDBs, so that you can recompile the databases:

ALTER PLUGGABLE DATABASE ALL OPEN;

16. Exit from SQL*Plus, and change directory to the new Oracle home path $ORACLE_HOME/rdbms/admin:

SQL> EXIT
cd $ORACLE_HOME/rdbms/admin

17. Run the catcon.pl script and the postupgrade_fixups.sql script that is supplied with the new release Oracle Database.

The following example shows the command strings for running catcon.pl, using the -n parameter to specify one parallel processor for each PDB, using the -d parameter to specify the path where the preupgrade script that you want to run is located, using the -l parameter to specify the location where you want the scripts to place log files, and using the -b flag to specify the log file prefixes for the postupgrade_fixups.sql script:

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -d $ORACLE_HOME/cfgtoollogs/cdbupgr/preupgrade -l /home/oracle/upgrdDBA -b postupgrade_fixups postupgrade_fixups.sql

18. Run postupgrade_fixups.sql.

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

19. Run utlu122s.sql to verify that there are no upgrade issues.

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

log file utlu122s0.log is generated.

20. For Oracle RAC environments set the initialization parameter value for CLUSTER_DATABASE to TRUE, and to start the Oracle RAC database

ALTER SYSTEM SET CLUSTER_DATABASE=TRUE SCOPE=SPFILE;
srvctl start database -db db_unique_name

Upgrading PDBs Using the Parallel Upgrade Utility with Priority Lists 

Oracle Database 12.2 and later releases, you can upgrade PDBs using a priority list to upgrade a set of PDBs ahead of other PDBs, and we can modify that upgrade priority.  This list enables to group and upgrade PDBs based on the priority.  A priority list is a text file with comma-delimited lists defining the order of upgrade priority, and the PDBs in each numeric priority group. We can execute the Parallel Upgrade Utility (dbupgrade, dbupgrade.cmd, or catctl.pl) using the -L option to run the upgrade using a priority list, and to call that list as the upgrade runs. 

Format for creating priority list

Number, Pdb
    numeral,pdb1,pdb2,pdb3
    numeral,pdb4
    numeral,pdb5,pdb6,pdb7,pdb8
    .
    .
    .


Note:  

  • Create priority lists using a plain text editor, such as vi on Linux and UNIX, or Notepad on Windows.
  • Here numeral represents the priority for the PDB.

When you run the Parallel Upgrade Utility, the following processing rules apply:

    CDB$ROOT and PDB$SEED are always processed first, even if they are not present in the priority list.
    All PDBs that are in priority lists are processed in order of priority
    Any PDBs that are not listed in priority lists are processed after the PDBs named in the priority list.


Syntax to run the Parallel Upgrade utility using a priority list:

dbupgrade -L priority_list_name


After upgrade is complete PDB priority states are maintained in the CDB.  If we upgrade the database to next release, it uses the same priority.  To change this we have to execute

SQL> alter session set container = CDB$ROOT
SQL> alter pluggable database PDBName upgrade priorityPDBPriorityNumber


PDB Upgrades Using Priority Lists, Inclusion Lists, and Exclusion Lists

The following terms designate types of upgrade list processing:

    Priority lists: Comma-delimited lists that designate the upgrade priority of PDBs in the list.
    Inclusion lists: Comma-delimited lists that designate PDBs that you want to upgrade. PDBs in these lists are upgraded after the PDBs listed in priority lists.
    Exclusion lists: Comma-delimited lists that designate PDBs that you do not want to be upgraded.

 

Example of Inclusion List

With following priority list

1,CDB$ROOT
1,PDB$SEED
1,CDB1_PDB2,CDB1_PDB4
2.CDB1_PDB5

catctl -L priority.lst -c 'CDB1_PDB2 CDB1_PDB4 CDB1_PDB5' catupgrd.sql

The upgrade order is carried out in the following sequence:

    CDB1_PDB2, CDB1_PDB4
    CDB1_PDB5

The Parallel Upgrade Utility processes only the PDBs that are in the inclusion list, and in the order of the priority list.

Example of Exclusion List

With following priority list

1,CDB$ROOT
1,PDB$SEED
1,CDB1_PDB1,CDB1_PDB2
2,CDB1_PDB3,CDB1_PDB4
3,CDB1_PDB5

catctl -L priority.lst -C 'CDB$ROOT' catupgrd.sql

Because CDB$ROOT is excluded, the priority processing shifts. The upgrade order is carried out in the following sequence:

    PDB$SEED, CDB_PDB1
    CDB_PDB2, CDB_PDB3
    CDB1_PDB4, CDB1_PDB5

Exclusion List using CATCTL_LISTONLY

With following priority list

1,CDB$ROOT
1,PDB$SEED
1,CDB1_PDB1,CDB1_PDB2
2,CDB1_PDB3
3,CDB1_PDB5

catctl -L priority.lst -C 'CATCTL_LISTONLY' catupgrd.sql


With the CATCTL_LISTONLY option, PDBs that are not in the priority list are excluded from the upgrade.  Specifying the keyword CATCTL_LISTONLY in the exclusion list turns the priority list into an inclusion priority list. Only PDBs in the list are processed.

Upgrading Pluggable Databases (PDBs) In Parallel

Using the In-Parallel technique, you can upgrade the CDB, and then immediately upgrade PDBs using parallel SQL processors.

Container databases (CDBs) can contain zero, one, or more pluggable databases (PDBs). By default, the Parallel Upgrade Utility (catctl.pl) updates the CDB and all of its PDBs in the same upgrade window. The Parallel Upgrade Utility uses the number of computer processing units (CPUs) to determine the maximum number of PDBs that are upgraded simultaneously. The number of PDBs that are upgraded in parallel is determined by dividing the parallel SQL process count (-n option) by the parallel PDB SQL process count (-N option).

dbupgrade [-M] -n [-N]

    -M Specifies if CDB$ROOT is kept in upgrade mode, or if it becomes available when it completes upgrade:

        If you run the Parallel Upgrade Utility with the -M parameter, then the upgrade places CDB$ROOT and all of its PDBs in upgrade mode, which can reduce total upgrade time. However, you cannot bring up any of the PDBs until the CDB and all of its PDBs are upgraded.

        If you do not run the Parallel Upgrade Utility with the -M parameter, then CDB$ROOT is upgraded and restarted in normal mode, and the normal background processes are started. After a successful upgrade, only CDB$ROOT is opened in read/write mode. All the PDBs remain in MOUNT mode. As each PDB is upgraded, you can bring each PDB online while other PDBs are still being upgraded.

    -n Specifies the number of in-parallel PDB upgrade processors.

    If you do not specify a value for -n, then the default for -n is the CPU_COUNT value.

    If you do specify a value for -n, then that value is used to determine the number of parallel SQL processes. The maximum value is unlimited. The minimum value is 4.

    -N Specifies the number of SQL processors to use when upgrading PDBs. The maximum value is 8. The minimum value is 1. If you do not specify a value for -N, then the default value is 2.

    The maximum PDB upgrades running concurrently is the value of -n divided by the value of -N.

Steps to upgrade PDBs in parallel

1. Take necessary backup
2. Execute pre-upgrade tool, fix up any issues found, make sure there are no INVALID objects/components
3. un the Parallel Upgrade Utility. In sequence, the following upgrades are carried out:

    a. Cycle 1: CDB$ROOT is upgraded to the new Oracle release
    b. Cycle 2 to Cycle x: PDB$SEED and PDBs are upgraded in parallel, with the number of cycles of upgrades as determined by the parameter settings you specify with -n.
4. Complete post-upgrade steps.

Upgrading Multitenant Container Databases In Parallel

Use this technique to upgrade CDB$ROOT, PDB$SEED, and all PDBS in the CDB in one upgrade operation.
Oracle recommends that you use this approach if you can schedule downtime, because it provides a direct procedure for upgrades and simplicity of maintenance. Using this procedure upgrades in parallel all the PDBs in the multitenant architecture container database, depending on your server’s available processors (CPUs). 

1. Ensure that you have a proper backup strategy in place.
2. Open all PDBs.


For example:

SQL> alter pluggable database all open;


3. Run the Pre-Upgrade Information Tool (preupgrade.jar), using the following syntax:


java -jar $New_release_Oracle_home/rdbms/admin/preupgrade.jar [TERMINAL|FILE|DIR outputdir] [TEXT|XML] [-c InclusionListOfPDBs] [-C ExclusionListOfPDBs]

Linux and UNIX:

java -jar $ORACLE_HOME_18.1/rdbms/admin/preupgrade.jar -c 'pdb1 pdb2 pdb3 pdb4 pdb5 pdb6 pdb7 pdb8 pdb9 pdb10 pdb11 pdb12 pdb13 pdb14 pdb15 pdb16 pdb17 pdb18 pdb19 pdb20 pdb21 pdb22 pdb23 pdb24 pdb25'

Windows:

java -jar %ORACLE_HOME_18.1%/rdbms/admin/preupgrade.jar -c "pdb1 pdb2 pdb3 pdb4 pdb5 pdb6 pdb7 pdb8 pdb9 pdb10 pdb11 pdb12 pdb13 pdb14 pdb15 pdb16 pdb17 pdb18 pdb19 pdb20 pdb21 pdb22 pdb23 pdb24 pdb25"


4. Review any generated fixup scripts and log files.

By default, if ORACLE_BASE is defined, then the fixup files are placed in one of the following paths:

Linux and UNIX:

    $ORACLE_BASE/cfgtoollogs/db_unique_name/preupgrade

Windows

    %ORACLE_BASE%\cfgtoollogs\db_unique_name\preupgrade

If ORACLE_BASE is not defined, then fixup files are placed in one of the following paths:

Linux and UNIX:

    $ORACLE_HOME/cfgtoollogs/db_unique_name/preupgrade

Windows:

    %ORACLE_HOME\cfgtoollogs\db_unique_name\preupgrade


5. Run the preupgrade_fixups script, or individual PDB scripts.

6. For Oracle RAC databases, set the cluster database initialization parameter to false:

For example;

ALTER SYSTEM SET cluster_database=FALSE SCOPE=spfile;


7. Shut down the database in the old Oracle home.

8. Copy the PFILE or SPFILE from the old Oracle home to the new Oracle home
9. Connect with SQL*Plus:

sqlplus / as sysdba

10. Bring the CDB$ROOT instance into upgrade mode:

STARTUP UPGRADE

11. Bring all PDBs into upgrade mode:

ALTER PLUGGABLE DATABASE ALL OPEN UPGRADE;

12. Check the status of PDBs to confirm that they are ready to upgrade:

SHOW PDBS


For all PDBs, ensure that the status is set to MIGRATE.

13. Exit from SQL*Plus, and change directory to the new Oracle home $ORACLE_HOME/rdbms/admin:

SQL> EXIT
$ ORACLE_HOME/bin


14. Start the upgrade using the Parallel Upgrade Utility (catctl.pl, using the shell command dbupgrade), where -d specifies the location of the directory:

dbupgrade -d $ORACLE_HOME/rdbms/admin

15. Review the upg_summary.log to conf8irm that the upgrade was successful, and if necessary, review other logs.
16. Open all PDBs, so that you can recompile the databases:

ALTER PLUGGABLE DATABASE ALL OPEN;

17. Exit from SQL*Plus, and change directory to the new Oracle home path $ORACLE_HOME/rdbms/admin:

SQL> EXIT
cd $ORACLE_HOME/rdbms/admin

18. Run the catcon.pl script and the postupgrade_fixups.sql script that is supplied with the new release Oracle Database.

The following example shows the command strings for running catcon.pl, using the -n parameter to specify one parallel processor for each PDB, using the -d parameter to specify the path where the preupgrade script that you want to run is located, using the -l parameter to specify the location where you want the scripts to place log files, and using the -b flag to specify the log file prefixes for the postupgrade_fixups.sql script:

$ORACLE_HOME/perl/bin/perl $ORACLE_HOME/rdbms/admin/catcon.pl -n 1 -d \
$ORACLE_HOME/cfgtoollogs/cdbupgr/preupgrade -l /home/oracle/upgrdDBA -b \
postupgrade_fixups postupgrade_fixups.sql

19. Run postupgrade_fixups.sql.

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

20. Run utlu122s.sql to verify that there are no upgrade issues.

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

When you use catcon.pl to run utlu122s.sql, the log file utlu122s0.log is generated. 

21. For Oracle RAC environments only, enter the following commands to set the initialization parameter value for CLUSTER_DATABASE to TRUE, and to start the Oracle RAC database, where dbname is the name of the Oracle RAC database:

ALTER SYSTEM SET CLUSTER_DATABASE=TRUE SCOPE=SPFILE;
srvctl start database -db db_unique_name

 





About Me

........................................................................................................................

● 本文作者:小麦苗,部分内容整理自网络,若有侵权请联系小麦苗删除

● 本文在itpub( http://blog.itpub.net/26736162 )、博客园( http://www.cnblogs.com/lhrbest )和个人weixin公众号( xiaomaimiaolhr )上有同步更新

● 本文itpub地址: http://blog.itpub.net/26736162

● 本文博客园地址: http://www.cnblogs.com/lhrbest

● 本文pdf版、个人简介及小麦苗云盘地址: http://blog.itpub.net/26736162/viewspace-1624453/

● 数据库笔试面试题库及解答: http://blog.itpub.net/26736162/viewspace-2134706/

● DBA宝典今日头条号地址: http://www.toutiao.com/c/user/6401772890/#mid=1564638659405826

........................................................................................................................

● QQ群号: 230161599 (满) 、618766405

● weixin群:可加我weixin,我拉大家进群,非诚勿扰

● 联系我请加QQ好友 646634621 ,注明添加缘由

● 于 2019-03-01 06:00 ~ 2019-03-31 24:00 在魔都完成

● 最新修改时间:2019-04-01 06:00 ~ 2019-04-31 24:00

● 文章内容来源于小麦苗的学习笔记,部分整理自网络,若有侵权或不当之处还请谅解

● 版权所有,欢迎分享本文,转载请保留出处

........................................................................................................................

小麦苗的微店 https://weidian.com/s/793741433?wfr=c&ifr=shopdetail

小麦苗出版的数据库类丛书 http://blog.itpub.net/26736162/viewspace-2142121/

小麦苗OCP、OCM、高可用网络班 http://blog.itpub.net/26736162/viewspace-2148098/

小麦苗腾讯课堂主页 https://lhr.ke.qq.com/

........................................................................................................................

使用 weixin客户端 扫描下面的二维码来关注小麦苗的weixin公众号( xiaomaimiaolhr )及QQ群(DBA宝典)、添加小麦苗weixin, 学习最实用的数据库技术。

........................................................................................................................

欢迎与我联系

 

 



来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26736162/viewspace-2640261/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/26736162/viewspace-2640261/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值