ITPub博客

首页 > Linux操作系统 > Linux操作系统 > ORACLE 10gR2 RAC升级至10.2.0.4

ORACLE 10gR2 RAC升级至10.2.0.4

Linux操作系统 作者:xfhuangfu 时间:2015-07-04 09:09:30 0 删除 编辑
之前安装的是两个节点的RAC 平台, Redhat 4.7 + ASM + RAW+ Oracle 10g RAC  
数据库版本是10.2.0.1. 这个实验的目的就是将这个数据库版本从10.2.0.1 升级到 10.2.0.4 ,
10.2.0.4的patch number 是:p6810189

RAC 环境下的升级分三步。 这个在patch 包里的readme 文档里有详细的说明。
       1. 升级clusterware  -- > 升级包中安装程序里选择CRS_HOME后安装
       2. 升级数据库软件  -- >升级包中安装程序里选择ORACLE_HOME后安装
       3. 升级实例    -- > 可以使用脚本 或者直接运行DBUA 实现, 如果用脚本,参考单节点的升级
 
RAC 的升级分滚动升级升级和非滚动升级。
       滚动升级就是每次升级一个节点。
       非滚动就是一次升级所有节点

这个patch包的readme文档也有说明。这次升级用的是非滚动升级。 即一次性搞定所有节点。

注意:
       如果是生产库,在升级之前做好备份。 备份数据库(如:RMAN),备份ORA_CRS_HOME 目录,备份ORACLE_HOME目录。

这次升级放在rac2节点上执行

1:查看数据库的信息
[oracle@rac2 Disk1]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Tue May 21 04:44:52 2013
Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL>
SQL>
SQL>
SQL> select instance_name from V$instance;

INSTANCE_NAME
----------------
racdb2
SQL> SQL> select * from v$version;

BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE    10.2.0.1.0      Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
 

二. 升级Clusterware 软件

2.1   停止相关进程
可以用srvctl 命令来一个一个进行,也可以用crs_stop -all 进行。
在任意节点上执行即可,此处我选择rac2节点执行
[oracle@rac2 Disk1]$ crs_stop -all
再次确认集群状态
[oracle@rac2 ~]$ crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora....SM1.asm application    OFFLINE   OFFLINE              
ora....C1.lsnr application    OFFLINE   OFFLINE              
ora.rac1.gsd   application    OFFLINE   OFFLINE              
ora.rac1.ons   application    OFFLINE   OFFLINE              
ora.rac1.vip   application    OFFLINE   OFFLINE              
ora....SM2.asm application    OFFLINE   OFFLINE              
ora....C2.lsnr application    OFFLINE   OFFLINE              
ora.rac2.gsd   application    OFFLINE   OFFLINE              
ora.rac2.ons   application    OFFLINE   OFFLINE              
ora.rac2.vip   application    OFFLINE   OFFLINE              
ora.racdb.db   application    OFFLINE   OFFLINE              
ora....b1.inst application    OFFLINE   OFFLINE              
ora....b2.inst application    OFFLINE   OFFLINE     

2.2 用Xmanger 工具运行runInstaller
[oracle@rac2 ~]$ ls -lt
total 1030280
drwxr-xr-x  2 oracle dba       4096 May 21 04:40 Desktop
drwxrwxrwx  2 oracle dba       4096 May 21 03:52 rac2_arch
-rw-r--r--  1 oracle dba       1497 May 20 22:37 initbak.0521
-rwxrwxrwx  1 oracle dba 1053748381 May 20 20:44 p6810189_10204_Linux-x86.zip
-rw-r--r--  1 oracle dba       1410 May  6 17:12 init20130506_1.ora
-rw-r--r--  1 oracle dba       1340 May  6 17:02 init20130506.ora
drwxr-xr-x  4 oracle dba       4096 Oct 19  2012 admin
drwxrwx---  5 oracle dba       4096 Oct 19  2012 oraInventory
drwxr-xr-x  4 oracle dba       4096 Oct 17  2012 10.2.0
-rw-r--r--  1 oracle dba     178473 Feb 26  2008 README.html
drwxr-xr-x  5 oracle dba       4096 Feb 22  2008 Disk1
[oracle@rac2 ~]$
[oracle@rac2 ~]$ cd Disk1/
[oracle@rac2 Disk1]$ ls
10204_buglist.htm  install  patch_note.htm  response  runInstaller  stage
[oracle@rac2 Disk1]$ ./runInstaller
然后在图形化界面中一步一步操作
欢迎页面-------next
选择软件的目录,这里我们要首先选择OraCrs10g的主目录,点击Name中的下拉框 ,然后 next
OUI 自动选中的cluster的安装方式,并选中了所有可用的节点 , 然后next
安装环境的检查,如无异常,直接点击 next
显示摘要信息,如无异常点击install:
提示安装结束:
图形界面操作完成,不过认真看了窗口中提示信息,会发现接下来还需要执行两个命令,具体操作如下:
 
首先在节点rac2上执行下列命令,注意是root用户执行
[root@rac2 ~]# cd /home/oracle/10.2.0/crs_1/bin
[root@rac2 bin]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@rac2 bin]# cd /home/oracle/10.2.0/crs_1/install
[root@rac2 install]# ./root102.sh
Creating pre-patch directory for saving pre-patch clusterware files
Completed patching clusterware files to /home/oracle/10.2.0/crs_1
Relinking some shared libraries.
Relinking of patched files is complete.
WARNING: directory '/home/oracle/10.2.0' is not owned by root
WARNING: directory '/home/oracle' is not owned by root
Preparing to recopy patched init and RC scripts.
Recopying init and RC scripts.
Startup will be queued to init within 30 seconds.
/home/oracle/.bash_profile: line 27: ulimit: open files: cannot modify limit: Operation not permitted
Starting up the CRS daemons.
Waiting for the patched CRS daemons to start.
  This may take a while on some systems.
.
10204 patch successfully applied.
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node :
node 2: rac2 rac2-priv rac2
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
clscfg -upgrade completed successfully
[root@rac2 install]#
 
然后在rac1节点执行
[root@rac1 ~]# cd /home/oracle/10.2.0/crs_1/bin
[root@rac1 bin]# crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.

root@rac1 crs_1]# cd /home/oracle/10.2.0/crs_1/install
[root@rac1 install]# ./root102.sh
Creating pre-patch directory for saving pre-patch clusterware files
Completed patching clusterware files to /home/oracle/10.2.0/crs_1
Relinking some shared libraries.
Relinking of patched files is complete.
WARNING: directory '/home/oracle/10.2.0' is not owned by root
WARNING: directory '/home/oracle' is not owned by root
Preparing to recopy patched init and RC scripts.
Recopying init and RC scripts.
Startup will be queued to init within 30 seconds.
/home/oracle/.bash_profile: line 27: ulimit: open files: cannot modify limit: Operation not permitted
Starting up the CRS daemons.
Waiting for the patched CRS daemons to start.
  This may take a while on some systems.
.
10204 patch successfully applied.
clscfg: EXISTING configuration version 3 detected.
clscfg: version 3 is 10G Release 2.
Successfully accumulated necessary OCR keys.
Using ports: CSS=49895 CRS=49896 EVMC=49898 and EVMR=49897.
node :
node 1: rac1 rac1-priv rac1
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
clscfg -upgrade completed successfully

在两个节点执行完这两个脚本以后,在IU中点exit退出
 

三、安装数据库软件补丁集
3.1 由于前面执行root102.sh时,会自动重启crs,因此在升级数据库软件前需要关闭CRS服务
关闭crs资源
[root@rac2 install]# crs_stop -all
查看crs状态
[root@rac2 install]# crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora....SM1.asm application    OFFLINE   OFFLINE              
ora....C1.lsnr application    OFFLINE   OFFLINE              
ora.rac1.gsd   application    OFFLINE   OFFLINE              
ora.rac1.ons   application    OFFLINE   OFFLINE              
ora.rac1.vip   application    OFFLINE   OFFLINE              
ora....SM2.asm application    OFFLINE   OFFLINE              
ora....C2.lsnr application    OFFLINE   OFFLINE              
ora.rac2.gsd   application    OFFLINE   OFFLINE              
ora.rac2.ons   application    OFFLINE   OFFLINE              
ora.rac2.vip   application    OFFLINE   OFFLINE              
ora.racdb.db   application    OFFLINE   OFFLINE              
ora....b1.inst application    OFFLINE   OFFLINE              
ora....b2.inst application    OFFLINE   OFFLINE

3.2 用Xmanger 工具运行runInstaller
[oracle@rac2 Disk1]$ pwd
/home/oracle/Disk1
[oracle@rac2 Disk1]$ ls
10204_buglist.htm  install  patch_note.htm  response  runInstaller  stage
[oracle@rac2 Disk1]$ ./runInstaller
欢迎界面------ 点next
弹出OUI的欢迎界面后,这次选择OracDb的主目录 -----next
OUI 自动选中了cluster的安装方式  -----next
检查环境,确认无误 -------next
提示是否要绑定metalink,可以根据实际情况进行选择:我在这里什么多没填,直接点next
概要预览,如无问题直接点击install
开始执行安装,视I/O速率,本步操作可能需要费时良久
在此期间,OUI会自动弹出窗口如下,提示在RAC环境中的各个节点执行指定的脚本,注意是以root身份执行

rac1节点
[root@rac1 install]# /home/oracle/10.2.0/db_1/root.sh
Running Oracle10 root.sh script...
The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /home/oracle/10.2.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying dbhome to /usr/local/bin ...
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying oraenv to /usr/local/bin ...
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying coraenv to /usr/local/bin ...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
 
rac2节点
[root@rac2 install]# /home/oracle/10.2.0/db_1/root.sh
Running Oracle10 root.sh script...
The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /home/oracle/10.2.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying dbhome to /usr/local/bin ...
The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying oraenv to /usr/local/bin ...
The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n)
[n]: y
   Copying coraenv to /usr/local/bin ...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
 

脚本执行完成后,返回视窗界面,点击ok按钮即可,补丁集就更新完了,点击exit退出当前操作界面

四. 升级实例
 
升级实例有两种方法:
    1. DBUA
    2. 手动执行脚本
对于RAC数据库环境下的升级,首先需要启动各节点的监听服务
4.1 启动相关的进程
[root@rac1 install]# crs_start -all

[root@rac2 install]# crs_stat -t
Name           Type           Target    State     Host       
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    rac1       
ora....C1.lsnr application    ONLINE    ONLINE    rac1       
ora.rac1.gsd   application    ONLINE    ONLINE    rac1       
ora.rac1.ons   application    ONLINE    ONLINE    rac1       
ora.rac1.vip   application    ONLINE    ONLINE    rac1       
ora....SM2.asm application    ONLINE    ONLINE    rac2       
ora....C2.lsnr application    ONLINE    ONLINE    rac2       
ora.rac2.gsd   application    ONLINE    ONLINE    rac2       
ora.rac2.ons   application    ONLINE    ONLINE    rac2       
ora.rac2.vip   application    ONLINE    ONLINE    rac2       
ora.racdb.db   application    ONLINE    OFFLINE              
ora....b1.inst application    ONLINE    OFFLINE              
ora....b2.inst application    ONLINE    OFFLINE  

4.2  通过xmanager运行dbua
[oracle@rac2 Disk1]$ dbua
然后在UI图形界面中一步步操作
欢迎页面 ---  next
执行选择页面----选择默认 upgrade a database ,然后点 next
选择要升级的(并且当前可用的数据库),这里只有一个并已被默认选中,输入sys用户密码  -----next
选择是否在升级后自动编译无效的对象,默认是选中的  -------next
 开始执行升级  ---- 需等待一段时间(大概一个小时)
上述操作完成后,点击ok即可,OUI弹出整个操作的返回结果,点击close按钮关闭窗口。
 
 
 此时可以登陆任意节点,以sqlplus命令行连接进去执行查询:
oracle@rac1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Wed May 22 07:45:20 2013
Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> set linesize 200;
SQL> select * from gv$instance;
   INST_ID INSTANCE_NUMBER INSTANCE_NAME    HOST_NAME                                                        VERSION           STARTUP_T STATUS       PAR    THREAD# ARCHIVE LOG_SWITCH_WAIT LOGINS
---------- --------------- ---------------- ---------------------------------------------------------------- ----------------- --------- ------------ --- ---------- ------- --------------- ----------
SHU DATABASE_STATUS   INSTANCE_ROLE      ACTIVE_ST BLO
--- ----------------- ------------------ --------- ---
         1               1 racdb1           rac1                                                             10.2.0.4.0        21-MAY-13 OPEN            YES          1 STOPPED                 ALLOWED
NO  ACTIVE            PRIMARY_INSTANCE   NORMAL    NO
         2               2 racdb2           rac2                                                             10.2.0.4.0        21-MAY-13 OPEN            YES          2 STOPPED                 ALLOWED
NO  ACTIVE            PRIMARY_INSTANCE   NORMAL    NO

SQL>
 
 
 

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

请登录后发表评论 登录
全部评论
Xiaofei Huangfu Oracle DBA,Oracle ACE Oracle 19c OCM12c OCM,11g OCM MySQL 5.6,5.7,8.0 OCP 18年以上IT从业经验,有丰富的数据库和开发领域经验,多年Oracle运维经验和java开发经验。

注册时间:2013-09-05

  • 博文量
    151
  • 访问量
    231241