Oracle 11g RAC 原地升级到 19c

2022-12-07 14:17:28 浏览数 (1)

作者 | JiekeXu

来源 |公众号 JiekeXu DBA之路(ID: JiekeXu_IT)

如需转载请联系授权

大家好,我是 JiekeXu,很高兴又和大家见面了,今天和大家一起来看看 Oracle 11g RAC 原地升级到 19c

记得去年初的一段时间内,总是在进行数据库 19c 的升级,安装,测试工作,当时不知怎的,有一个特殊的要求就是原地升级 11g RAC 到 19c,刚好操作系统版本以及 JDK 均满足要求,就当学习了,顺便将第一次的测试步骤大概记录了下来,便有了这篇文章。

目 录

代码语言:javascript复制
一、GI 升级
    1) 准备 Linux-zSer 环境 19c 软件,RU19.10 补丁包 p32126842
    2) 两节点停集群 备份家目录
    3)新建 19c 升级目录
    4) 环境变量
    5) 图形化升级 GI
    6)ORA-59303
    7)跑升级脚本完成 GI 安装
    8) 挂载磁盘组
    9) 最终集群状态如下
二、DB 升级
    10)DB 软件安装
    11) 数据库实例操作
        参数文件创建
        附:19c 升级参数文件
    12)跑升级脚本 dbupgrade

说明:原环境架构为 Linux-zSer 环境,OS:Suse12sp5 DB:11.2.0.4 RAC

一、GI 升级

1) 准备 Linux-zSer 环境 19c 软件,RU19.10 补丁包 p32126842
代码语言:javascript复制
drwxrwxrwx  4 grid oinstall       4096 Feb  5 19:52 32126842
-rwxr-xr-x  1 grid oinstall 2835755051 Mar  6 22:02 LINUX.ZSERIES64_193000_db_home.zip
-rwxr-xr-x  1 grid oinstall 2519769777 Mar  6 22:00 LINUX.ZSERIES64_193000_grid_home.zip
drwxr-x--- 15 grid oinstall       4096 Nov  6 03:51 OPatch
-rw-r--r--  1 grid oinstall 2754599824 Mar  6 22:07 p32126842_190000_Linux-zSer_1910_GI_OJVM.zip
-rwxr-xr-x  1 grid oinstall  173937575 Mar  6 22:06 p6880880_122010_Linux-zSer_12.2.0.1.23.zip
-rw-rw-r--  1 grid oinstall     796834 Feb  5 20:21 PatchSearch.xml
2) 两节点停集群 备份家目录
代码语言:javascript复制
# /app/product/11.2.0/grid/bin/crsctl stop crs
# tar -zcvf /app/GI.tar.gz  /app/grid /app/oracle /app/product /app/oraInventory 
代码语言:javascript复制
3)新建 19c 升级目录
代码语言:javascript复制
mkdir -p /backup/app/19.0.0.0/grid 
mkdir -p /backup/app/grid 
mkdir -p /backup/app/oracle/product/19.0.0.0/dbhome_1
chown -R grid:oinstall /backup
chown -R oracle:oinstall /backup/app/oracle
chmod -R 775 /backup

--注意:这里新建目录应该按照 oracle 标准目录 OFA 结构建立,但由于不满足,最好建立成如下路径,ORACLE_BASE 不需改动,ORACLE_HOME 如下即可。
mkdir -p /app/product/19.0.0./grid
mkdir -p /app/oracle/product/19.0.0/dbhome_1

官方文档建议如下:
# mkdir -p /u01/app/19.0.0/grid
# mkdir -p /u01/app/grid
# mkdir -p /u01/app/oracle
# mkdir -p /u01/app/oracle/product/19.0.0/dbhome_1
# chown -R grid:oinstall /u01
# chown oracle:oinstall /u01/app/oracle
# chmod -R 775 /u01/

If you create the OFA path /u01, and grant oracle 755 permissions to write to that path, then the Oracle Inventory directory is created in the path /u01/app/oraInventory, and Oracle Universal Installer creates the path /u01/app/oracle, and configures the ORACLE_BASE environment variable for the Oracle user to that path. If you are performing an Oracle Database installation, then the Oracle home is installed under the Oracle base. However, if you are installing Oracle Grid Infrastructure for a cluster, then be aware that ownership of the path for the Grid home is changed to root after installation and the Grid base and Grid home should be in different locations, such as /u01/app/19.0.0/grid for the Grid home path, and /u01/app/grid for the Grid base. For example: /u01/app/oraInventory, owned by grid:oinstall /u01/app/oracle, owned by oracle:oinstall /u01/app/oracle/product/19.0.0/dbhome_1/, owned by oracle:oinistall /u01/app/grid, owned by grid:oinstall /u01/app/19.0.0/grid, owned by root

4) 环境变量

Grid 原有 11g 环境变量

代码语言:javascript复制
umask 022
export ORACLE_BASE=/app/grid
export ORACLE_HOME=/app/product/11.2.0/grid
export ORACLE_SID= ASM1
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
export PATH=${ORACLE_HOME}/bin:${ORACLE_HOME}/OPatch:${PATH}
export HOST=`hostname | cut -f1 -d"."`
export PS1='${HOST}:$PWD(${ORACLE_SID})>'

GRID 19c 环境变量:

代码语言:javascript复制
jieker1:/home/grid( ASM)>more .bash_profile_19c 
umask 022
export ORACLE_BASE=/backup/app/grid
export ORACLE_HOME=/backup/app/19.0.0.0/grid
export ORACLE_SID= ASM1
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
export JAVA_HOME=$ORACLE_HOME/jdk
export PATH=$ORACLE_HOME/bin:$PATH:$ORACLE_HOME/OPatch:$ORACLE_HOME/jdk/jre/bin:$ORACLE_HOME/jdk/bin
export HOST=`hostname | cut -f1 -d"."`
export PS1='${HOST}:$PWD(${ORACLE_SID})>'
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib

ORACLE: 原有 11g 环境变量

代码语言:javascript复制
umask 022
export ORACLE_BASE=/app/oracle
export ORACLE_HOME=/app/product/11.2.0/db
export ORACLE_SID=jiekedb1
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
export LD_LIBRARY_PATH=${ORACLE_HOME}/lib
export PATH=${ORACLE_HOME}/bin:${ORACLE_HOME}/OPatch:${PATH}
export HOST=`hostname | cut -f1 -d"."`
export PS1='${HOST}:$PWD(${ORACLE_SID})>'

Oracle 19c 环境变量

代码语言:javascript复制
more .bash_profile_19c 

umask 022
export ORACLE_BASE=/backup/app/oracle
export ORACLE_HOME=/backup/app/oracle/product/19.0.0.0/dbhome_1
export ORACLE_SID=jiekedb1
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export PATH=$ORACLE_HOME/bin:$PATH:$ORACLE_HOME/OPatch:.
export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
export HOST=`hostname | cut -f1 -d"."`
export PS1='${HOST}:$PWD(${ORACLE_SID})$'
5) 图形化升级 GI

RAC1 Grid 用户解压 GI 安装软件到 19c 环境变量 $ORACLE_HOME

代码语言:javascript复制
unzip LINUX.ZSERIES64_193000_grid_home.zip -d $ORACLE_HOME
cd $ORACLE_HOME
--调用图形界面
jieker1:/backup/app/19.0.0.0/grid( ASM1)>./gridSetup.sh 
代码语言:javascript复制
以升级模式运行 gridSetup.sh

上面的检查关键信息一定要检查通过!!!

6)ORA-59303

在升级 GI 的过程中一定会出现磁盘组兼容性问题而无法正常挂载,就会报如下错误。

ORA-15032: not all alterations performed ORA-59303: The attribute compatible.asm (11.2.0.0.0) of the diskgroup being mounted should be 11.2.0.2.0 or higher. (DBD ERROR: OCIStmtExecute)

代码语言:javascript复制
SQL> alter diskgroup ARCH set attribute 'compatible.asm'='11.2.0.4.0';

映像中这里的 OCR 盘我使用的是新划分的 1G 大小的三块盘,新的 OCR 磁盘组为JIEKER_OCR

7)跑升级脚本完成 GI 安装

跑升级脚本 rootupgrade.sh

rootupgrade.sh 脚本简要信息示例如下:

代码语言:javascript复制
2021/04/08 16:03:28 CLSRSC-594: Executing installation step 10 of 19: 'ConfigCHMOS'.
2021/04/08 16:03:28 CLSRSC-594: Executing installation step 11 of 19: 'CreateOHASD'.
2021/04/08 16:03:29 CLSRSC-594: Executing installation step 12 of 19: 'ConfigOHASD'.
2021/04/08 16:03:30 CLSRSC-330: Adding Clusterware entries to file 'oracle-ohasd.service'
2021/04/08 16:03:38 CLSRSC-4002: Successfully installed Oracle Trace File Analyzer (TFA) Collector.
2021/04/08 16:04:16 CLSRSC-594: Executing installation step 13 of 19: 'InstallAFD'.
2021/04/08 16:04:17 CLSRSC-594: Executing installation step 14 of 19: 'InstallACFS'.
2021/04/08 16:04:18 CLSRSC-594: Executing installation step 15 of 19: 'InstallKA'.
2021/04/08 16:04:19 CLSRSC-594: Executing installation step 16 of 19: 'InitConfig'.
2021/04/08 16:04:41 CLSRSC-594: Executing installation step 17 of 19: 'StartCluster'.
2021/04/08 16:06:04 CLSRSC-343: Successfully started Oracle Clusterware stack
2021/04/08 16:06:04 CLSRSC-594: Executing installation step 18 of 19: 'ConfigNode'.
2021/04/08 16:06:17 CLSRSC-594: Executing installation step 19 of 19: 'PostConfig'.
2021/04/08 16:06:32 CLSRSC-325: Configure Oracle Grid Infrastructure for a Cluster ... succeeded
代码语言:javascript复制
8) 挂载磁盘组
代码语言:javascript复制
ASMCMD> lsdg 
State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N        4096            4096   4096  4194304      3072     2204             1024             590              0             Y  JIEKER_OCR/
ASMCMD> 
ASMCMD> mount JIEKE_ARCH
ORA-15032: not all alterations performed
ORA-59303: The attribute compatible.asm (11.2.0.0.0) of the diskgroup being mounted should be 11.2.0.2.0 or higher. (DBD ERROR: OCIStmtExecute)
ASMCMD>

这里挂载归档磁盘组就会报 ORA-59303,那么我们来查看一下磁盘组的兼容性,发现全是 0,我们需要将其设置为最低为 19.0.0.0.0。

代码语言:javascript复制
jieker1:/home/grid( ASM1)>sqlplus / as sysasm 
SQL*Plus: Release 19.0.0.0.0 - Production on Thu Apr 8 16:29:50 2021
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.
Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> col COMPATIBILITY for a20
SQL> col DATABASE_COMPATIBILITY for a18
SQL> col name for a16
select GROUP_NUMBER,NAME,BLOCK_SIZE,COMPATIBILITY,DATABASE_COMPATIBILITY from v$asm_diskgroup;

SQL> 
GROUP_NUMBER NAME             BLOCK_SIZE COMPATIBILITY        DATABASE_COMPATIBI
------------ ---------------- ---------- -------------------- ------------------
           0 JIEKE_DATA                 0 0.0.0.0.0            0.0.0.0.0
           0 JIEKE_OCR                  0 0.0.0.0.0            0.0.0.0.0
           0 JIEKE_ARCH                 0 0.0.0.0.0            0.0.0.0.0
           1 JIEKER_OCR              4096 19.0.0.0.0           10.1.0.0.0

当去改参数时又会报错 ORA-15032:并不是所有的改变都被执行

代码语言:javascript复制
SQL> alter diskgroup JIEKE_ARCH set attribute 'compatible.asm'='19.0.0.0.0';
alter diskgroup JIEKE_ARCH set attribute 'compatible.asm'='19.0.0.0.0'
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15001: diskgroup "JIEKE_ARCH" does not exist or is not mounted

那么,怎么办呢?这里就需要到一个隐含参数 ‘_disk_sector_size_override’,可以设置_disk_sector_size_override 参数为 true,来覆盖扇区的设置,这样就可以强制挂载磁盘组。

代码语言:javascript复制
SQL> col KSPPINM for a30 
SQL> col KSPPSTVL for a30 
SQL> col KSPPDESC for a39
SQL> select ksppinm,ksppstvl,ksppdesc from x$ksppi x,x$ksppcv y where x.indx = y.indx and ksppinm='_disk_sector_size_override';
KSPPINM                        KSPPSTVL                       KSPPDESC
------------------------------ ------------------------------ ---------------------------------------
_disk_sector_size_override     FALSE                          if TRUE, OSD sector size could be overr
                                                              idden
--支持动态修改
SQL> alter system set "_disk_sector_size_override"=true;
System altered.

SQL> select ksppinm,ksppstvl,ksppdesc from x$ksppi x,x$ksppcv y where x.indx = y.indx and ksppinm='_disk_sector_size_override';

KSPPINM                        KSPPSTVL                       KSPPDESC
------------------------------ ------------------------------ ---------------------------------------
_disk_sector_size_override     TRUE                           if TRUE, OSD sector size could be overr
                                                              idden
--强制挂载磁盘组
SQL> alter diskgroup JIEKE_ARCH  mount restricted;
Diskgroup altered.

--修改磁盘组兼容性参数
SQL> alter diskgroup JIEKE_ARCH  SET ATTRIBUTE 'compatible.asm'='19.0.0.0.0'; 
Diskgroup altered.

SQL> select GROUP_NUMBER,NAME,BLOCK_SIZE,COMPATIBILITY,DATABASE_COMPATIBILITY from v$asm_diskgroup;
GROUP_NUMBER NAME             BLOCK_SIZE COMPATIBILITY        DATABASE_COMPATIBI
------------ ---------------- ---------- -------------------- ------------------
           0 JIEKE_DATA                 0 0.0.0.0.0            0.0.0.0.0
           0 JIEKE_OCR                  0 0.0.0.0.0            0.0.0.0.0
           1 JIEKER_OCR              4096 19.0.0.0.0           10.1.0.0.0
           2 JIEKE_ARCH              4096 19.0.0.0.0           10.1.0.0.0

接下来我们对数据磁盘组 DATA 磁盘组也进行如上操作。

代码语言:javascript复制
SQL> alter diskgroup JIEKE_DATA  mount restricted;
Diskgroup altered.

SQL> alter diskgroup JIEKE_DATA  SET ATTRIBUTE 'compatible.asm'='19.0.0.0.0'; 
Diskgroup altered.

SQL> select GROUP_NUMBER,NAME,BLOCK_SIZE,COMPATIBILITY,DATABASE_COMPATIBILITY from v$asm_diskgroup;

GROUP_NUMBER NAME             BLOCK_SIZE COMPATIBILITY        DATABASE_COMPATIBI
------------ ---------------- ---------- -------------------- ------------------
           0 JIEKE_OCR                  0 0.0.0.0.0            0.0.0.0.0
           1 JIEKER_OCR              4096 19.0.0.0.0           10.1.0.0.0
           2 JIEKE_ARCH              4096 19.0.0.0.0           10.1.0.0.0
           3 JIEKE_DATA              4096 19.0.0.0.0           10.1.0.0.0

SQL> ALTER diskgroup JIEKE_ARCH dismount;
Diskgroup altered.

SQL> ALTER diskgroup JIEKE_DATA dismount;
Diskgroup altered.

当然也可以直接在 CMD 里运行 mount 磁盘组的命令。

注意:JIEKE_OCR 旧的磁盘组不用挂载,新的 OCR 磁盘组为 JIEKER_OCR。

代码语言:javascript复制
ASMCMD> lsdg
State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N        4096            4096   4096  4194304      3072     2204             1024             590              0             Y  JIEKER_OCR/
ASMCMD> 
ASMCMD> mount JIEKE_ARCH
ASMCMD> lsdg
State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N        4096            4096   4096  4194304      3072     2204             1024             590              0             Y  JIEKER_OCR/
MOUNTED  EXTERN  N        4096            4096   4096  4194304    102400   102268                0          102268              0             N  JIEKE_ARCH/
ASMCMD> mount JIEKE_DATA
ASMCMD> lsdg
State    Type    Rebal  Sector  Logical_Sector  Block       AU  Total_MB   Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  NORMAL  N        4096            4096   4096  4194304      3072      2204             1024             590              0             Y  JIEKER_OCR/
MOUNTED  EXTERN  N        4096            4096   4096  4194304    102400    102268                0          102268              0             N  JIEKE_ARCH/
MOUNTED  EXTERN  N        4096            4096   4096  4194304  31457280  13640924                0        13640924              0             N  JIEKE_DATA/
ASMCMD>
代码语言:javascript复制
SQL> select GROUP_NUMBER,NAME,BLOCK_SIZE,COMPATIBILITY,DATABASE_COMPATIBILITY from v$asm_diskgroup;

GROUP_NUMBER NAME             BLOCK_SIZE COMPATIBILITY        DATABASE_COMPATIBI
------------ ---------------- ---------- -------------------- ------------------
           0 JIEKE_OCR                  0 0.0.0.0.0            0.0.0.0.0
           1 JIEKER_OCR              4096 19.0.0.0.0           10.1.0.0.0
           2 JIEKE_ARCH              4096 19.0.0.0.0           10.1.0.0.0
           3 JIEKE_DATA              4096 19.0.0.0.0           10.1.0.0.0
SQL> select GROUP_NUMBER,NAME,TYPE,STATE,total_mb/1024 total_gb,free_mb/1024 free_gb from v$asm_diskgroup;

GROUP_NUMBER NAME             TYPE   STATE         TOTAL_GB    FREE_GB
------------ ---------------- ------ ----------- ---------- ----------
           0 JIEKE_OCR                DISMOUNTED           0          0
           1 JIEKER_OCR        NORMAL MOUNTED              3 2.12890625
           2 JIEKE_ARCH        EXTERN MOUNTED            100 99.8710938
           3 JIEKE_DATA        EXTERN MOUNTED          30720 13321.2148
9) 最终集群状态如下
代码语言:javascript复制
jieker2:/home/grid( ASM2)>crsctl status res -t 
--------------------------------------------------------------------------------
Name           Target  State        Server                   State details       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.LISTENER.lsnr
               ONLINE  ONLINE       jieker1                   STABLE
               ONLINE  ONLINE       jieker2                   STABLE
ora.net1.network
               ONLINE  ONLINE       jieker1                   STABLE
               ONLINE  ONLINE       jieker2                   STABLE
ora.ons
               ONLINE  ONLINE       jieker1                   STABLE
               ONLINE  ONLINE       jieker2                   STABLE
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.ASMNET1LSNR_ASM.lsnr(ora.asmgroup)
      1        ONLINE  ONLINE       jieker1                   STABLE
      2        ONLINE  ONLINE       jieker2                   STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.JIEKER_OCR.dg(ora.asmgroup)
      1        ONLINE  ONLINE       jieker1                   STABLE
      2        ONLINE  ONLINE       jieker2                   STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.JIEKE_ARCH.dg(ora.asmgroup)
      1        ONLINE  ONLINE       jieker1                   STABLE
      2        ONLINE  ONLINE       jieker2                   STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.JIEKE_DATA.dg(ora.asmgroup)
      1        ONLINE  ONLINE       jieker1                   STABLE
      2        ONLINE  ONLINE       jieker2                   STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       jieker1                   STABLE
ora.asm(ora.asmgroup)
      1        ONLINE  ONLINE       jieker1                   STABLE
      2        ONLINE  ONLINE       jieker2                   Started,STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.asmnet1.asmnetwork(ora.asmgroup)
      1        ONLINE  ONLINE       jieker1                   STABLE
      2        ONLINE  ONLINE       jieker2                   STABLE
      3        OFFLINE OFFLINE                               STABLE
ora.cvu
      1        ONLINE  ONLINE       jieker1                   STABLE
ora.jieker1.vip
      1        ONLINE  ONLINE       jieker1                   STABLE
ora.jieker2.vip
      1        ONLINE  ONLINE       jieker2                   STABLE
ora.scan1.vip
      1        ONLINE  ONLINE       jieker1                   STABLE

二、DB 升级

10)DB 软件安装

软件安装和正常的 19c DB 软件安装没有区别,只要 JDK 版本合适,操作系统版本合适,正常下一步下一步就好。

调用图形化运行 ./runInstaller

其他步骤截图略。

11) 数据库实例操作
  • 参数文件创建

使用原先修改好的 19c 参数文件 pfile_19c_forupdate.ora 启动数据库。

代码语言:javascript复制
jieker1:/home/oracle(jiekedb1)$ sqlplus / as sysdba 

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Apr 9 17:25:41 2021
Version 19.10.0.0.0

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

Connected to an idle instance.
SQL> startup nomount 
ORACLE instance started.

Total System Global Area 4.4560E 10 bytes
Fixed Size                 30247520 bytes
Variable Size            7516192768 bytes
Database Buffers         3.6910E 10 bytes
Redo Buffers              103968768 bytes
SQL> create pfile='/home/oracle/pfile_19c_forupdate.ora'  from spfile;
File created.
SQL> shu immediate 
ORA-01507: database not mounted

jieker1:/home/oracle(ysJIEKE1)$  sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Fri Apr 9 20:06:24 2021
Version 19.10.0.0.0

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

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

SQL> shu immediate 
Database closed.
Database dismounted.
ORACLE instance shut down.
  • 附:19c 升级参数文件
代码语言:javascript复制
vim pfile_19c_forupdate.ora

jiekedb2.__data_transfer_cache_size=0
jiekedb1.__data_transfer_cache_size=0
jiekedb2.__db_cache_size=36909875200
jiekedb1.__db_cache_size=36775657472
jiekedb2.__inmemory_ext_roarea=0
jiekedb1.__inmemory_ext_roarea=0
jiekedb2.__inmemory_ext_rwarea=0
jiekedb1.__inmemory_ext_rwarea=0
jiekedb2.__java_pool_size=0
jiekedb1.__java_pool_size=0
jiekedb2.__large_pool_size=671088640
jiekedb1.__large_pool_size=671088640
jiekedb1.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
jiekedb2.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
jiekedb2.__pga_aggregate_target=14898167808
jiekedb1.__pga_aggregate_target=14898167808
jiekedb2.__sga_target=44560285696
jiekedb1.__sga_target=44560285696
jiekedb2.__shared_io_pool_size=134217728
jiekedb1.__shared_io_pool_size=134217728
jiekedb2.__shared_pool_size=6710886400
jiekedb1.__shared_pool_size=6845104128
jiekedb2.__streams_pool_size=0
jiekedb1.__streams_pool_size=0
jiekedb2.__unified_pga_pool_size=0
jiekedb1.__unified_pga_pool_size=0
*._cleanup_rollback_entries=10000
*._clusterwide_global_transactions=FALSE
*._cursor_obsolete_threshold=100
*._lm_tickets=5000
*._memory_imm_mode_without_autosga=FALSE
*._optim_peek_user_binds=FALSE
*._optimizer_adaptive_cursor_sharing=FALSE
*._optimizer_extended_cursor_sharing_rel='NONE'
*._optimizer_extended_cursor_sharing='NONE'
*._optimizer_use_feedback=FALSE
*._PX_use_large_pool=TRUE
*._rollback_segment_count=500
*._undo_autotune=FALSE
*._use_adaptive_log_file_sync='FALSE'
*.aq_tm_processes=1
*.archive_lag_target=1800
*.audit_file_dest='/u01/app/oracle/admin/jiekedb/adump'
*.audit_trail='NONE'
#*.cluster_database=true   --以升级模式启动时关闭节点 2 并修改此参数
*.compatible='19.0.0'
*.control_file_record_keep_time=39
#*.control_files=' JIEKE_DATA/jiekedb/CONTROLFILE/current.885.1069371489',' JIEKE_ARCH/jiekedb/CONTROLFILE/current.256.1069371491' –注释掉现有控制文件
*.control_files=' JIEKE_DATA/jiekedb/CONTROLFILE/Current.673.1060408079' –使用原先的控制文件
*.db_block_checking='MEDIUM'
*.db_block_checksum='FULL'
*.db_block_size=8192
*.db_create_file_dest=' JIEKE_DATA'
*.db_create_online_log_dest_1=' JIEKE_DATA'
*.db_create_online_log_dest_2=' JIEKE_ARCH'
*.db_domain=''
*.db_files=8192
*.db_lost_write_protect='TYPICAL'
*.db_name='jiekedb'
*.db_writer_processes=8
*.deferred_segment_creation=FALSE
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=jiekedbXDB)'
*.enable_ddl_logging=TRUE
*.event='10949 trace name context forever','28401 trace name context forever,level 1','10503 trace name context forever, level
 4000'
*.fast_start_mttr_target=180
*.gcs_server_processes=10
family:dw_helper.instance_mode='read-only'
jiekedb2.instance_number=2
jiekedb1.instance_number=1
*.job_queue_processes=1000
*.local_listener='-oraagent-dummy-'
*.log_archive_config='DG_CONFIG=(jiekedb, jiekedb3)'
*.log_archive_dest_1='location= JIEKE_ARCH'
*.log_archive_dest_2='SERVICE=jiekedb3 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=jiekedb3'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='DEFER'
*.log_checkpoints_to_alert=TRUE
*.max_dump_file_size='102400000'
*.max_idle_blocker_time=5
*.nls_language='AMERICAN'
*.nls_territory='AMERICA'
*.open_cursors=300
*.optimizer_adaptive_plans=FALSE
*.optimizer_adaptive_statistics=FALSE
*.parallel_degree_policy='MANUAL'
*.parallel_force_local=TRUE
*.parallel_max_servers=128
*.pga_aggregate_limit=0
*.pga_aggregate_target=14165m
*.processes=8000
*.remote_listener='JIEKEr-cls-scan:1521'
*.remote_login_passwordfile='exclusive'
*.resource_manager_plan='DEFAULT_PLAN'
*.sga_max_size=42494m
*.sga_target=42494m
*.standby_file_management='AUTO'
jiekedb2.thread=2
jiekedb1.thread=1
*.undo_retention=43200
jiekedb2.undo_tablespace='UNDOTBS2'
jiekedb1.undo_tablespace='UNDOTBS1'
12)跑升级脚本 dbupgrade

以升级模式启动节点 1 DB

代码语言:javascript复制
SQL> startup upgrade pfile='/home/oracle/pfile_19c_forupdate.ora'
ORACLE instance started.

Total System Global Area 4.4560E 10 bytes
Fixed Size                 30247520 bytes
Variable Size            7516192768 bytes
Database Buffers         3.6910E 10 bytes
Redo Buffers              103968768 bytes
Database mounted.
Database opened.

$ORACLE_HOME/bin/dbupgrade -n 8 -l /tmp

代码语言:javascript复制
jieker1:/home/oracle(jiekedb1)$ $ORACLE_HOME/bin/dbupgrade -n 8 -l /tmp 

Argument list for [/u01/app/oracle/product/19.0.0.0/dbhome_1/rdbms/admin/catctl.pl]
For Oracle internal use only A = 0
Run in                       c = 0
Do not run in                C = 0
Input Directory              d = 0
Echo OFF                     e = 1
Simulate                     E = 0
Forced cleanup               F = 0
Log Id                       i = 0
Child Process                I = 0
Log Dir                      l = /tmp
Priority List Name           L = 0
Upgrade Mode active          M = 0
SQL Process Count            n = 8
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.10.0.0.0DBRU_LINUX.ZSERIES64_210107]

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

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

Log file directory = [/tmp]

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

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

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

Number of Cpus        = 48
Database Name         = jiekedb
DataBase Version      = 11.2.0.4.0
Parallel SQL Process Count            = 8
Components in [jiekedb]
    Installed [APEX CATALOG CATJAVA CATPROC EM JAVAVM ORDIM OWM RAC XDB XML]
Not Installed [APS CONTEXT DV MGW ODM OLS SDO WK XOQ]
DataBase Version      = 11.2.0.4.0

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

------------------------------------------------------
Phases [0-107]         End Time:[2021_04_09 17:51:08]
------------------------------------------------------

Grand Total Time: 876s 

 LOG FILES: (/tmp/catupgrd*.log)

Upgrade Summary Report Located in:
/tmp/upg_summary.log

Grand Total Upgrade Time:    [0d:0h:14m:36s]

升级完之后数据库已经关闭,可将 pfile 中关于集群的参数注释 #*.cluster_database=true 去掉 #,然后用 pfile 启动去重建 spfile.

代码语言:javascript复制
vim '/home/oracle/pfile_19c_forupdate.ora'
#*.cluster_database=true
代码语言:javascript复制
jieker1:/home/oracle(jiekedb1)$ sqlplus / as sysdba
SQL*Plus: Release 19.0.0.0.0 - Production on Fri Apr 9 19:46:13 2021
Version 19.10.0.0.0
Copyright (c) 1982, 2020, Oracle.  All rights reserved.
Connected to an idle instance.
SQL> startup pfile='/home/oracle/pfile_19c_forupdate.ora';
ORACLE instance started.

Total System Global Area 4.4560E 10 bytes
Fixed Size                 30247520 bytes
Variable Size            7516192768 bytes
Database Buffers         3.6910E 10 bytes
Redo Buffers              103968768 bytes
Database mounted.
Database opened.
SQL> create spfile=' JIEKE_DATA/jiekedb/spfilejiekedb.ora' from pfile='/home/oracle/pfile_19c_forupdate.ora';

File created.
SQL> shu immediate 
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.10.0.0.0
jieker1:/home/oracle(jiekedb1)$ srvctl start database -d jiekedb 
jieker1:/home/oracle(jiekedb1)$ srvctl status database -d jiekedb 
Instance jiekedb1 is running on node jieker1
Instance jiekedb2 is running on node jieker2

总结

以上大概步骤为去年 4 月份一测试 RAC 升级 19c 时做的测试步骤,主要就是 GI 升级这块以及后面的数据库实例升级,DB 软件直接安装即可,其他的一些小细节这里没有记录,比如打补丁呀,磁盘挂载呀等等均没有涉及。而实际生产环境步骤肯定要比这个详细完善,这里只是抛砖引玉,供大家借鉴。况且,一般生产环境均是先搭建 19c 新环境迁移升级,很少有直接在原环境下进行升级操作。

以上如有错误及不到的地方,还望海涵。

0 人点赞