暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

oracle小版本升级实战

IT那活儿 2021-04-15
983

oracle11.2.0.3升级至11.2.0.4单机版

前言:

由于客户的环境有的比较老,数据库版本还停留在11.2.0.3版本,随着数据库的更新换代,以及方便以后升级到12或者18,19乃至更高的数据库版本,客户决定先升级数据库版本到11.2.0.4,于是在升级之前先在测试环境做一个测试,同时可以发现一些需要特别注意的点,在实际操作中避免失误。

1

查看操作系统信息

uname-a

2

查看数据库各个组件版本信息

    [oracle@lisai ~]$ sqlplus  as sysdba

    SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 1 13:13:59 2021

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


    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options

    SQL> select comp_name,status,version from dba_server_registry;

    COMP_NAME
    --------------------------------------------------------------------------------
    STATUS VERSION
    -------------------------------------------- ------------------------------
    OWB
    VALID 11.2.0.3.0

    Oracle Application Express
    VALID 3.2.1.00.12

    Oracle Enterprise Manager
    VALID 11.2.0.3.0


    COMP_NAME
    --------------------------------------------------------------------------------
    STATUS VERSION
    -------------------------------------------- ------------------------------
    OLAP Catalog
    VALID 11.2.0.3.0

    Spatial
    VALID 11.2.0.3.0

    Oracle Multimedia
    VALID 11.2.0.3.0


    COMP_NAME
    --------------------------------------------------------------------------------
    STATUS VERSION
    -------------------------------------------- ------------------------------
    Oracle XML Database
    VALID 11.2.0.3.0

    Oracle Text
    VALID 11.2.0.3.0

    Oracle Expression Filter
    VALID 11.2.0.3.0


    COMP_NAME
    --------------------------------------------------------------------------------
    STATUS VERSION
    -------------------------------------------- ------------------------------
    Oracle Rules Manager
    VALID 11.2.0.3.0

    Oracle Workspace Manager
    VALID 11.2.0.3.0

    Oracle Database Catalog Views
    VALID 11.2.0.3.0


    COMP_NAME
    --------------------------------------------------------------------------------
    STATUS VERSION
    -------------------------------------------- ------------------------------
    Oracle Database Packages and Types
    VALID 11.2.0.3.0

    JServer JAVA Virtual Machine
    VALID 11.2.0.3.0

    Oracle XDK
    VALID 11.2.0.3.0


    COMP_NAME
    --------------------------------------------------------------------------------
    STATUS VERSION
    -------------------------------------------- ------------------------------
    Oracle Database Java Packages
    VALID 11.2.0.3.0

    OLAP Analytic Workspace
    VALID 11.2.0.3.0

    Oracle OLAP API
    VALID 11.2.0.3.0


    18 rows selected.

    SQL>
    复制

    3

    rman备份数据库

      [oracle@lisai u02]$ rman target 

      Recovery Manager: Release 11.2.0.3.0 - Production on Fri Jan 1 13:23:49 2021

      Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

      connected to target database: ORCL (DBID=1588474417)

      RMAN> run{
      allocate channel c1 type disk;
      allocate channel c2 type disk;
      backup filesperset 2 database format '/u02/full_%d_%T_%s_%p';
      sql 'alter system archive log current';
      sql 'alter system archive log current';
      sql 'alter system archive log current';
      backup 2> 3> 4> 5> 6> 7> 8> archivelog all format '/u02/arch_%d_%T_%s_%p' delete input;
      backup current controlfile format '/u02/ctl_%d_%T_%s_%p';
      BACKUP as compressed backupset FORMAT '/u02/spfile_%s_%p_%t' spfile;
      }9> 10> 11>

      using target database control file instead of recovery catalog
      allocated channel: c1
      channel c1: SID=28 device type=DISK

      allocated channel: c2
      channel c2: SID=27 device type=DISK

      Starting backup at 01-JAN-21
      channel c1: starting full datafile backup set
      channel c1: specifying datafile(s) in backup set
      input datafile file number=00001 name=/u01/app/orcl/oradata/orcl/system01.dbf
      input datafile file number=00004 name=/u01/app/orcl/oradata/orcl/users01.dbf
      channel c1: starting piece 1 at 01-JAN-21
      channel c2: starting full datafile backup set
      channel c2: specifying datafile(s) in backup set
      input datafile file number=00002 name=/u01/app/orcl/oradata/orcl/sysaux01.dbf
      input datafile file number=00003 name=/u01/app/orcl/oradata/orcl/undotbs01.dbf
      channel c2: starting piece 1 at 01-JAN-21
      channel c1: finished piece 1 at 01-JAN-21
      piece handle=/u02/full_ORCL_20210101_13_1 tag=TAG20210101T132358 comment=NONE
      channel c1: backup set complete, elapsed time: 00:00:03
      channel c1: starting full datafile backup set
      channel c1: specifying datafile(s) in backup set
      channel c2: finished piece 1 at 01-JAN-21
      piece handle=/u02/full_ORCL_20210101_14_1 tag=TAG20210101T132358 comment=NONE
      channel c2: backup set complete, elapsed time: 00:00:03
      channel c2: starting full datafile backup set
      channel c2: specifying datafile(s) in backup set
      including current SPFILE in backup set
      channel c2: starting piece 1 at 01-JAN-21
      including current control file in backup set
      channel c1: starting piece 1 at 01-JAN-21
      channel c2: finished piece 1 at 01-JAN-21
      piece handle=/u02/full_ORCL_20210101_16_1 tag=TAG20210101T132358 comment=NONE
      channel c2: backup set complete, elapsed time: 00:00:00
      channel c1: finished piece 1 at 01-JAN-21
      piece handle=/u02/full_ORCL_20210101_15_1 tag=TAG20210101T132358 comment=NONE
      channel c1: backup set complete, elapsed time: 00:00:01
      Finished backup at 01-JAN-21

      sql statement: alter system archive log current

      sql statement: alter system archive log current

      sql statement: alter system archive log current

      Starting backup at 01-JAN-21
      current log archived
      channel c1: starting archived log backup set
      channel c1: specifying archived log(s) in backup set
      input archived log thread=1 sequence=8 RECID=5 STAMP=1060694642
      input archived log thread=1 sequence=9 RECID=6 STAMP=1060694642
      channel c1: starting piece 1 at 01-JAN-21
      channel c2: starting archived log backup set
      channel c2: specifying archived log(s) in backup set
      input archived log thread=1 sequence=10 RECID=7 STAMP=1060694642
      input archived log thread=1 sequence=11 RECID=8 STAMP=1060694642
      channel c2: starting piece 1 at 01-JAN-21
      channel c1: finished piece 1 at 01-JAN-21
      piece handle=/u02/arch_ORCL_20210101_17_1 tag=TAG20210101T132402 comment=NONE
      channel c1: backup set complete, elapsed time: 00:00:00
      channel c1: deleting archived log(s)
      archived log file name=/u01/app/orcl/product/11.2.3/dbhome_1/dbs/arch1_8_1060693684.dbf RECID=5 STAMP=1060694642
      archived log file name=/u01/app/orcl/product/11.2.3/dbhome_1/dbs/arch1_9_1060693684.dbf RECID=6 STAMP=1060694642
      channel c2: finished piece 1 at 01-JAN-21
      piece handle=/u02/arch_ORCL_20210101_18_1 tag=TAG20210101T132402 comment=NONE
      channel c2: backup set complete, elapsed time: 00:00:00
      channel c2: deleting archived log(s)
      archived log file name=/u01/app/orcl/product/11.2.3/dbhome_1/dbs/arch1_10_1060693684.dbf RECID=7 STAMP=1060694642
      archived log file name=/u01/app/orcl/product/11.2.3/dbhome_1/dbs/arch1_11_1060693684.dbf RECID=8 STAMP=1060694642
      Finished backup at 01-JAN-21

      Starting backup at 01-JAN-21
      channel c1: starting full datafile backup set
      channel c1: specifying datafile(s) in backup set
      including current control file in backup set
      channel c1: starting piece 1 at 01-JAN-21
      channel c1: finished piece 1 at 01-JAN-21
      piece handle=/u02/ctl_ORCL_20210101_19_1 tag=TAG20210101T132402 comment=NONE
      channel c1: backup set complete, elapsed time: 00:00:01
      Finished backup at 01-JAN-21

      Starting backup at 01-JAN-21
      channel c1: starting compressed full datafile backup set
      channel c1: specifying datafile(s) in backup set
      including current SPFILE in backup set
      channel c1: starting piece 1 at 01-JAN-21
      channel c1: finished piece 1 at 01-JAN-21
      piece handle=/u02/spfile_20_1_1060694644 tag=TAG20210101T132404 comment=NONE
      channel c1: backup set complete, elapsed time: 00:00:01
      Finished backup at 01-JAN-21
      released channel: c1
      released channel: c2

      RMAN>
      复制

      4

      关库关监听

        [oracle@lisai u02]$ sqlplus  as sysdba

        SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 1 13:26:23 2021

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


        Connected to:
        Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
        With the Partitioning, OLAP, Data Mining and Real Application Testing options

        SQL> shutdown immediate;
        Database closed.
        Database dismounted.
        ORACLE instance shut down.
        SQL>
        复制

        关闭监听

          [oracle@lisai u02]$ lsnrctl stop

          LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 01-JAN-2021 13:31:51

          Copyright (c) 1991, 2011, Oracle. All rights reserved.

          Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=lisai)(PORT=1521)))
          The command completed successfully
          [oracle@lisai u02]$
          复制

          5

          备份/u01目录

          [root@lisai~]# tar -cvf u01.zip u01

          6
          上传并解压缩OracleDatabase 11.2.0.4安装介质

          6.1 取消oracle支持

          6.2 跳过软件更新

          6.3 选择最后一个选项"Upgradean existing database" 后下一步

          6.4 选择语言然后下一步

          6.5 选择升级的数据库版本下一步

          6.6 选择新版本数据库安装目录然后下一步

          6.7 选择数据库所属用户组然后下一步

          6.8 检查前置条件后下一步

          6.9 察看数据库配置信息后,点击Install开始进行新版本软件安装

          6.10 执行root.sh脚本

          6.11 继续执行软件升级

          7
          至此11.2.0.4的软件就已经装完了,修改Oracle环境变量

          8

          拷贝监听配置文件

          9

          执行SQL

          运行catupgrd.sql进行实例升级

          @?/rdbms/admin/catupgrd.sql

          运行utlrp.sql编译失效对象

          @?/rdbms/admin/utlrp

          10

          验证升级是否完成

          查看各个组件版本

          selectcomp_name,status,version from dba_server_registry;

          查看有无失效对象

          select * fromdba_objects where status !='VALID';


          补丁安装完执行应用补丁

          @catbundle.sql psuapply


          总结(过程中需要特别注意的点)

          1.升级前的准备

          升级之前做好oracle之前安装目录以及数据库的备份,升级过程中如果有问题,可以先回退,排查问题后再次升级。

          2.升级完以后的注意事项

          首先检查各个组件的升级情况,没问题后编译失效对象。以及根据需要安装新版本的补丁集。都做完以后,验证是否可以正常连接,正常使用。


          END


          文章转载自IT那活儿,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

          评论