一.说明
在官网看到一篇ASM升级的文档,如下:
How To Upgrade ASM from 10.2 to 11.1 (RAC)
http://blog.csdn.net/xujinyang/article/details/6832813
Unable To Open Database After ASM Upgrade From Release 11.1 To Release 11.2
http://blog.csdn.net/xujinyang/article/details/6832794
RAC下数据库的升级参考:
Redhat 5.4 Orcle RAC数据库从10.2.0.1升级到10.2.0.4
http://blog.csdn.net/xujinyang/article/details/6837242
几点说明:
1. Clusterware的版本必须要和DB或者ASM的版本一致。如果说要升级ASM或者DB,那么就必须先要升级clusterware。
Either the release version of Oracle Clusterware must be equal to the ASM release to which you want to upgrade, or you must first upgrade Oracle Clusterware.For example, you can upgrade ASM release 11.1.0.6 to 11.1.0.7 if Oracle Clusterware on your system is release 11.1.0.7, but you cannot do this if Oracle Clusterware is 11.1.0.6 or an earlier release.
2.可以把ASM和DB一起升级,如果只升级ASM实例的话,就像官网里提供的方法:
(1)将新版本的ASM安装到其他目录。即安装数据库软件。
(2)用旧版本的ASM启动实例实例。
(3)另开一个窗口,重新指定ORACLE_HOME,PATH等参数,指定到新版本的ORACLE软件目录。
(4)在这个窗口运行dbua,选择ASM实例进行升级。
3.在这个实验中,我们将DB和ASM一起进行升级。就不在分开升级。因为虚拟机的空间不够折腾。了解这个思路就可以了。
二.查看RAC信息
2.1 DB版本信息
[oracle@rac1 ~]$ export ORACLE_SID=dave1
[oracle@rac1 ~]$ sqlplus / as sysdba;
SQL*Plus: Release 10.2.0.1.0 - Production on Thu May 12 15:08:44 2011
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
SYS@dave1(rac1)>select * fromv$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE10.2.0.1.0Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
SYS@dave1(rac1)>
2.2ASM实例版本
[oracle@rac1 ~]$ export ORACLE_SID=+ASM1
[oracle@rac1 ~]$ sqlplus / as sysdba;
SQL*Plus: Release 10.2.0.1.0 - Production on Thu May 12 18:19:29 2011
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
SYS@+ASM1(rac1)>
2.3RAC进程信息
[oracle@rac1 ~]$ cd /u01
[oracle@rac1 u01]$ sh crs_stat.sh
NameTargetStateHost
------------------------------ ---------- ----------------
ora.dave.dave1.instONLINEONLINErac1
ora.dave.dave2.instONLINEONLINErac2
ora.dave.dbONLINEONLINErac1
ora.dave.taf.csONLINEONLINErac1
ora.dave.taf.dave1.srvONLINEONLINErac1
ora.dave.taf.dave2.srvONLINEONLINErac2
ora.rac1.ASM1.asmONLINEONLINErac1
ora.rac1.LISTENER_RAC1.lsnrONLINEONLINErac1
ora.rac1.gsdONLINEONLINErac1
ora.rac1.onsONLINEONLINErac1
ora.rac1.vipONLINEONLINErac1
ora.rac2.ASM2.asmONLINEONLINErac2
ora.rac2.LISTENER_RAC2.lsnrONLINEONLINErac2
ora.rac2.gsdONLINEONLINErac2
ora.rac2.onsONLINEONLINErac2
ora.rac2.vipONLINEONLINErac2
三.升级Clusterware
10.2.0.4的patch number是:p6810189。
3.1将升级包mout到linux系统
我的Patch下到的本地的操作系统,网络又被网管限了速,所以直接就mount到linux上。
用root用户登陆系统,执行如下命令:
mount -o username=administrator,password=12345678 //192.168.3.115/Software /mnt
mount -o username=administrator,password=bailing520//192.168.3.115/Software /mnt
3.2停止相关的进程
3.2.1每个节点分别停止EM和isqlplus
[oracle@rac1 bin]$ emctl stop dbconsole
[oracle@rac1 bin]$ isqlplusctl stop
3.2.2停止相关进程
这个可以用srvctl命令来一个一个进行,也可以用crs_stop -all进行。
这部分内容参考Blog:
Oracle RAC启动与关闭
http://blog.csdn.net/xujinyang/article/details/6829632
[oracle@rac1 u01]$ sh crs_stat.sh
NameTargetStateHost
------------------------------ ---------- ----------------
ora.dave.dave1.instOFFLINEOFFLINE
ora.dave.dave2.instOFFLINEOFFLINE
ora.dave.dbOFFLINEOFFLINE
ora.dave.taf.csOFFLINEOFFLINE
ora.dave.taf.dave1.srvOFFLINEOFFLINE
ora.dave.taf.dave2.srvOFFLINEOFFLINE
ora.rac1.ASM1.asmOFFLINEOFFLINE
ora.rac1.LISTENER_RAC1.lsnrOFFLINEOFFLINE
ora.rac1.gsdOFFLINEOFFLINE
ora.rac1.onsOFFLINEOFFLINE
ora.rac1.vipOFFLINEOFFLINE
ora.rac2.ASM2.asmOFFLINEOFFLINE
ora.rac2.LISTENER_RAC2.lsnrOFFLINEOFFLINE
ora.rac2.gsdOFFLINEOFFLINE
ora.rac2.onsOFFLINEOFFLINE
ora.rac2.vipOFFLINEOFFLINE
3.2.3停止每个节点上的CRS
[root@rac1 ~]# /u01/app/oracle/product/crs/bin/crsctl stop crs
3.3用Nomachine工具运行runInstaller
该工具的使用,参考:
远程桌面工具-- NoMachine
http://blog.csdn.net/xujinyang/article/details/6924796
3.3.1进行升级包的目录,运行runInstaller
[oracle@rac1 p6810189_10204_Linux-x86]$ pwd
/mnt/OracleSoftware/p6810189_10204_Linux-x86
[oracle@rac1 p6810189_10204_Linux-x86]$ cd Disk1/
[oracle@rac1 Disk1]$ ls
10204_buglist.htminstallpatch_note.htmresponserunInstallerstage
[oracle@rac1 Disk1]$ ./runInstaller -ignoreSysPreReqs
--因为我用的是redhat 5,所以忽略了版本检查
3.3.2在可视化的安装窗口选择CRS_HOME。看清楚,不要选错了。然后一下步进行安装。
3.3.3安装结束会提示运行2个脚本
The installer has detected that your Cluster Ready Services (CRS) installation is shared amongst the following nodes:
rac1
rac2
Because of the shared nature of this installation, you cannot perform a rolling upgrade of your CRS software.
To complete the installation of this patchset, you must perform the following tasks:
1.On each node, do the following:
a.Log in as the root user.
b.As root, shutdown the CRS daemons on the node
using the following command:
/u01/app/oracle/product/crs/bin/crsctl stop crs
Repeat this step until the CRS daemons on all the nodes are shutdown.
2.After all the CRS daemons on all the nodes are shutdown, run the shell script located at:
/u01/app/oracle/product/crs/install/root102.sh
This script will automatically start the CRS daemons on the patched node upon completion.
3.Wait until the script finishes and then proceed to the next node and repeat step 2.
[root@rac1 ~]# /u01/app/oracle/product/crs/bin/crsctl stop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@rac1 ~]#/u01/app/oracle/product/crs/install/root102.sh
Creating pre-patch directory for saving pre-patch clusterware files
Completed patching clusterware files to /u01/app/oracle/product/crs
Relinking some shared libraries.
Relinking of patched files is complete.
WARNING: directory '/u01/app/oracle/product' is not owned by root
WARNING: directory '/u01/app/oracle' is not owned by root
WARNING: directory '/u01/app' is not owned by root
WARNING: directory '/u01' 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.
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 <nodenumber>: <nodename> <private interconnect name> <hostname>
node 2: rac1 rac1-priv rac1
Creating OCR keys for user 'root', privgrp 'root'..
Operation successful.
clscfg -upgrade completed successfully
四.升级数据库软件
升级clusterware的时候,升级结束的时候会启动CRS服务。我们在升级数据库的时候需要关闭这些服务。
4.1停止相关进程
[oracle@rac1 u01]$ sh crs_stat.sh
NameTargetStateHost
------------------------------ ---------- ----------------
ora.dave.dave1.instONLINEOFFLINE
ora.dave.dave2.instONLINEOFFLINE
ora.dave.dbOFFLINEOFFLINE
ora.dave.taf.csOFFLINEOFFLINE
ora.dave.taf.dave1.srvOFFLINEOFFLINE
ora.dave.taf.dave2.srvOFFLINEOFFLINE
ora.rac1.ASM1.asmONLINEONLINErac1
ora.rac1.LISTENER_RAC1.lsnrONLINEONLINErac1
ora.rac1.gsdONLINEONLINErac1
ora.rac1.onsONLINEONLINErac1
ora.rac1.vipONLINEONLINErac1
ora.rac2.ASM2.asmONLINEONLINErac2
ora.rac2.LISTENER_RAC2.lsnrONLINEONLINErac2
ora.rac2.gsdONLINEONLINErac2
ora.rac2.onsONLINEONLINErac2
ora.rac2.vipONLINEONLINErac2
[oracle@rac1 u01]$ crs_stop -all
Attempting to stop `ora.rac1.gsd` on member `rac1`
Attempting to stop `ora.rac2.gsd` on member `rac2`
Attempting to stop `ora.rac1.ons` on member `rac1`
Attempting to stop `ora.rac2.ons` on member `rac2`
Stop of `ora.rac1.ons` on member `rac1` succeeded.
Stop of `ora.rac2.gsd` on member `rac2` succeeded.
Stop of `ora.rac1.gsd` on member `rac1` succeeded.
Stop of `ora.rac2.ons` on member `rac2` succeeded.
Attempting to stop `ora.rac1.LISTENER_RAC1.lsnr` on member `rac1`
Attempting to stop `ora.rac1.ASM1.asm` on member `rac1`
Attempting to stop `ora.rac2.ASM2.asm` on member `rac2`
Attempting to stop `ora.rac2.LISTENER_RAC2.lsnr` on member `rac2`
Stop of `ora.rac1.LISTENER_RAC1.lsnr` on member `rac1` succeeded.
Stop of `ora.rac2.LISTENER_RAC2.lsnr` on member `rac2` succeeded.
Attempting to stop `ora.rac1.vip` on member `rac1`
Attempting to stop `ora.rac2.vip` on member `rac2`
Stop of `ora.rac1.vip` on member `rac1` succeeded.
Stop of `ora.rac2.vip` on member `rac2` succeeded.
Stop of `ora.rac1.ASM1.asm` on member `rac1` succeeded.
Stop of `ora.rac2.ASM2.asm` on member `rac2` succeeded.
[oracle@rac1 u01]$ sh crs_stat.sh
NameTargetStateHost
------------------------------ ---------- ----------------
ora.dave.dave1.instONLINEOFFLINE
ora.dave.dave2.instONLINEOFFLINE
ora.dave.dbOFFLINEOFFLINE
ora.dave.taf.csOFFLINEOFFLINE
ora.dave.taf.dave1.srvOFFLINEOFFLINE
ora.dave.taf.dave2.srvOFFLINEOFFLINE
ora.rac1.ASM1.asmOFFLINEOFFLINE
ora.rac1.LISTENER_RAC1.lsnrOFFLINEOFFLINE
ora.rac1.gsdOFFLINEOFFLINE
ora.rac1.onsOFFLINEOFFLINE
ora.rac1.vipOFFLINEOFFLINE
ora.rac2.ASM2.asmOFFLINEOFFLINE
ora.rac2.LISTENER_RAC2.lsnrOFFLINEOFFLINE
ora.rac2.gsdOFFLINEOFFLINE
ora.rac2.onsOFFLINEOFFLINE
ora.rac2.vipOFFLINEOFFLINE
[oracle@rac1 u01]$
4.2用Nomachine工具连接上服务器,进行升级包的目录,运行runInstaller
在可视化的安装窗口选择ORACLE_HOME。看清楚,不要选错了。然后一下步进行安装。
4. 3安装结束会提示用root用户在所有节点上运行一个脚本
/u01/app/oracle/product/10.2.0/db_1/root.sh
[root@rac1 ~]# /u01/app/oracle/product/10.2.0/db_1/root.sh
Running Oracle10 root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME=/u01/app/oracle/product/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.
五.升级ASM和DB实例
在升级界面选择升级ASM,它会提示我们的ASM已经是最新版本了。因为我们前面已经升级过了Oracle软件,ASM实例存在与ORACLE_HOME下。所以ASM实例已经升级过了。
所以,我们直接选择升级DB就好了。
这个升级需要1个小时左右的时间。
六.升级完之后,在验证下ASM和DB版本
6.1ASM版本:
[oracle@rac1 u01]$ export ORACLE_SID=+ASM1
[oracle@rac1 u01]$ sqlplus / as sysdba;
SQL*Plus: Release 10.2.0.4.0 - Production on Thu May 12 22:04:53 2011
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
SYS@+ASM1(rac1)>
6.2DB版本
[oracle@rac1 u01]$ sqlplus / as sysdba;
SQL*Plus: Release 10.2.0.4.0 - Production on Thu May 12 22:02:26 2011
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
SYS@dave1(rac1)>
-------------------------------------------------------------------------------------------------------