BALLONTT |
RAC版本升级 |
10.2.0.1.0→10.2.0.5.9 |
|
ballontt |
2013/10/10 |
此文档详细描述了RAC+ASM环境下,CRS&DATABASE从10.2.0.1.0到10.2.0.5.9的升级步骤 |
环境
RAC+ASM
Linux:redhat5.8_X86_64
DB version:10.2.0.1
CRS version:10.2.0.1
节点1:rac01
Instance:ball1
$ORACLE_HOME:/u01/app/oracle/product/10.2.0/db_1
$CRS_HOME:/u01/app/oracle/product/10.2.0/crs_1
节点2:rac02
Instance:ball2
$ORACLE_HOME:/u01/app/oracle/product/10.2.0/db_1
$CRS_HOME:/u01/app/oracle/product/10.2.0/crs_1
CRS升级(10.2.0.1→10.2.0.5)
升级所用的PATCH: p8202632_10205_Linux-x86-64
1. 关闭crs资源,暂时不需要关闭crs stack
[oracle@rac01 ~]$ crs_stop –all
[oracle@rac01 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....L1.inst application OFFLINE OFFLINE
ora....L2.inst application OFFLINE OFFLINE
ora.BALL.db application OFFLINE OFFLINE
ora....SM1.asm application OFFLINE OFFLINE
ora....01.lsnr application OFFLINE OFFLINE
ora.rac01.gsd application OFFLINE OFFLINE
ora.rac01.ons application OFFLINE OFFLINE
ora.rac01.vip application OFFLINE OFFLINE
ora....SM2.asm application OFFLINE OFFLINE
ora....02.lsnr application OFFLINE OFFLINE
ora.rac02.gsd application OFFLINE OFFLINE
ora.rac02.ons application OFFLINE OFFLINE
ora.rac02.vip application OFFLINE OFFLINE
2. 解压升级文件
[oracle@rac01 psr5.0]$ unzipp8202632_10205_Linux-x86-64.zip
3. 确保图像化正常启动
[oracle@rac01 Disk1]$ export DISKPLAY=192.168.10.1:0.0
[root@rac01 ~]# xhost +
access control disabled, clients can connect from any host
4. 启动升级
[oracle@rac01 Disk1]$ ./runInstaller –ignoreSysPrereqs
【开始】
5. 开始图像界面升级
6. 先开始CRS的升级,注意Patch路径选择$ORA_CRS_HOME
7. 点击Next
8. 完成环境检查,没有检查的选项,手动选中继续Next
9. 点击Install,开始真正的安装
10. 等待进度条满后,点击Next
11. 根据要求执行1. 2.两步操作
12. 根据11步中的要求执行下述操作
[root@rac01 bin]# ./crsctlstop crs
Stopping resources.
Successfully stopped CRS resources
Stopping CSSD.
Shutting down CSS daemon.
Shutdown request successfully issued.
[root@rac01 ~]# cd/u01/app/oracle/product/10.2.0/crs_1/install
[root@rac01 install]# sh root102.sh
[root@rac02 bin]# ./crsctl stop crs
Stoppingresources.
Successfullystopped CRS resources
Stopping CSSD.
Shutting downCSS daemon.
Shutdown request successfully issued.
[root@rac02 ~]# cd/u01/app/oracle/product/10.2.0/crs_1/install
[root@rac02 install]# sh root102.sh
脚本执行结束后,crs及各项服务已经自动启动了
13. 验证版本信息
[oracle@rac01 ~]$ crsctl query crs softwareversion rac01
CRS software version on node [rac01] is [10.2.0.5.0]
[oracle@rac01 ~]$ crsctl query crs softwareversion rac02
CRS software version on node [rac02] is [10.2.0.5.0]
[oracle@rac01~]$ crsctl check crs
CSS appearshealthy
CRS appearshealthy
EVM appearshealthy
[oracle@rac01~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....L1.inst application ONLINE ONLINE rac01
ora....L2.inst application ONLINE ONLINE rac02
ora.BALL.db application ONLINE ONLINE rac01
ora....SM1.asm application ONLINE ONLINE rac01
ora....01.lsnr application ONLINE ONLINE rac01
ora.rac01.gsd application ONLINE ONLINE rac01
ora.rac01.ons application ONLINE ONLINE rac01
ora.rac01.vip application ONLINE ONLINE rac01
ora....SM2.asm application ONLINE ONLINE rac02
ora....02.lsnr application ONLINE ONLINE rac02
ora.rac02.gsd application ONLINE ONLINE rac02
ora.rac02.ons application ONLINE ONLINE rac02
ora.rac02.vip application ONLINE ONLINE rac02
DATABASE升级(10.2.0.1→10.2.0.5)
1. 停掉数据库及应用
[oracle@rac01 ~]$ srvctl stop database -d BALL
[oracle@rac01 ~]$ srvctl stop nodeapps -n rac01
[oracle@rac01 ~]$ srvctl stop nodeapps -n rac02
[oracle@rac01~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....L1.instapplication OFFLINE OFFLINE
ora....L2.instapplication OFFLINE OFFLINE
ora.BALL.db application OFFLINE OFFLINE
ora....SM1.asmapplication OFFLINE OFFLINE
ora....01.lsnrapplication OFFLINE OFFLINE
ora.rac01.gsd application OFFLINE OFFLINE
ora.rac01.ons application OFFLINE OFFLINE
ora.rac01.vip application OFFLINE OFFLINE
ora....SM2.asmapplication OFFLINE OFFLINE
ora....02.lsnrapplication OFFLINE OFFLINE
ora.rac02.gsd application OFFLINE OFFLINE
ora.rac02.ons application OFFLINE OFFLINE
ora.rac02.vip application OFFLINE OFFLINE
2. 运行安装文件,开始安装(和CRS升级使用的是同一个升级文件)
[oracle@rac01 Disk1]$ ./runInstaller –ignoreSysPrereqs
【开始】
3. 点击Next
4. 这里注意选择ORACLE_HOME路径,CRS升级时是使用CRS_HOME路径
5. 点击Next
6. 环境检查,手动勾选上没有执行的选项
7. 点击install,开始正式安装
8. 进度条满后,点击Next
9. 根据要求,以root用户执行脚本后点击OK
10. 以root用户在两个节点分别执行脚本
[root@rac01 ~]# sh/u01/app/oracle/product/10.2.0/db_1/root.sh
[root@rac02 ~]# sh/u01/app/oracle/product/10.2.0/db_1/root.sh
升级数据库
到这里,只是软件升级结束。版本升级后,在新的版本下,字典表中某些对象的属性也需要随之改变。所以,需要继续升级一下数据库,更新数据库字典。
1. [oracle@rac01 ~]$ crs_start –all
[oracle@rac01 ~]$ crs_stat –t
2. 启动数据库到nomount状态,临时修改一个参数,然后再shutdown数据库
[oracle@rac01 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Mon Oct 721:34:37 2013
Copyright (c) 1982, 2010, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 281018368 bytes
Fixed Size 2095672 bytes
Variable Size 88081864 bytes
Database Buffers 184549376 bytes
Redo Buffers 6291456 bytes
SQL> alter system set cluster_database=falsescope=spfile;
System altered.
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
3. 以upgrade方式启动数据库,依次执行如下命令
SQL> startup upgrade
SQL> SPOOL patch.log
SQL> SHUTDOWN IMMEDIATE
SQL> SPOOL off
4. 再次启动数据库,查看确认有多少无效对象
SQL> startup
ORACLE instance started.
Total System Global Area 281018368 bytes
Fixed Size 2095672 bytes
Variable Size 155190728 bytes
Database Buffers 117440512 bytes
Redo Buffers 6291456 bytes
Database mounted.
SQL> select count(*) from dba_objects wherestatus='INVALID';
COUNT(*)
----------
401
SQL> select count(*) from dba_objects wherestatus='VALID';
COUNT(*)
----------
50302
5. 执行脚本,并修改回参数,重启
SQL> @?/rdbms/admin/utlrp.sql
SQL> alter system set cluster_database=true scope=spfile;
SQL> shutdown immediate;
SQL> startup
6. 再次查看无效对象的数量
SQL> select count(*) from dba_objects wherestatus='VALID';
COUNT(*)
----------
50703
SQL> select count(*) from dba_objects wherestatus='INVALID';
COUNT(*)
----------
0
7. 查看版本信息:
DB:
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE 10.2.0.5.0 Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 – Production
CRS:
[oracle@rac01 ~]$ crsctl query crs softwareversion rac01
CRS software version on node [rac01] is [10.2.0.5.0]
[oracle@rac01 ~]$ crsctl query crs softwareversion rac02
CRS software version on node [rac02] is [10.2.0.5.0]
更新OPatch(10.2.0.1.0→10.2.0.5.1)
升级crs到10.2.0.5.2(最新版本),根据readme里信息,OPatch工具的版本不能低于10.2.0.4.7,现在升级其至最新版本10.2.0.5.1
1. 查看当前Opatch版本
[oracle@rac01OPatch]$ ./opatch version
Invoking OPatch10.2.0.1.0
OPatch Version:10.2.0.1.0
2. 解压新版本压缩包(两个节点都要解压)
3. 用新解压出来的OPatch目录夹分别替换$ORACLE_HOME和$CRS_HOME下的OPatch,注意替换后OPatch目录的权限修改
CRS_PSU升级(10.2.0.5.0→10.2.0.5.2)
升级所用的PSU: 9952245(10.2.0.5.2是CRS在10g下的最新版本)
1. 所有节点上环境变量的正确设置,确保相关的命令都能执行
Echo $ORACLE_HOME
Echo $ORA_CRS_HOME
同时将opatch命令所在路径加入到PATH中
Root用户和oracle用户的环境变量都设置
2. 解压升级所用的PSU(在所有节点执行)
[oracle@rac01 ~]$ cd ./psu/psu5.2
[oracle@rac01psu5.2]$ unzip p9952245_10205_Linux-x86-64--10.2.0.5.2--CRSPSU--10.2.0.5.2.zip
[oracle@rac02 ~]$ cd ./psu/psu5.2
[oracle@rac02psu5.2]$ unzip p9952245_10205_Linux-x86-64--10.2.0.5.2--CRSPSU--10.2.0.5.2.zip
3. 在两个节点上查看历史patch信息
[oracle@rac01 ~]$ cd$ORACLE_HOME/OPatch
[oracle@rac01OPatch]$ ./opatch lsinventory -detail -oh $ORA_CRS_HOME
[oracle@rac01OPatch]$ ./opatch lsinventory -detail -oh $ORACLE_HOME
[oracle@rac02 ~]$ cd$ORACLE_HOME/OPatch
[oracle@rac02OPatch]$./opatch lsinventory -detail -oh $ORA_CRS_HOME
[oracle@rac02OPatch]$ ./opatch lsinventory -detail -oh $ORACLE_HOME
4. 通过emocmrsp命令生成OCM file,用以第5步中使用。在文件执行过程中根据要求填入相应的内容。(在两个节点分别执行)
[oracle@rac01~]$ cd $ORACLE_HOME/OPatch/ocm/bin
[oracle@rac01bin]$ ./emocmrsp
(命令执行结束后,会在当前目录下产生ocm.rsp这样的一个文件)
[oracle@rac02~]$ cd $ORACLE_HOME/OPatch/ocm/bin
[oracle@rac02bin]$ ./emocmrsp
5. root用户以auto的方式应用psu,在节点1执行完后,以同样的方式在节点2执行,不可同时执行。Auto方式会自动停掉database,asm,nodeapps,crs stack,执行脚本,应用psu,最后自动启动RAC
进入9952245所在目录
[root@rac01 ~]# cd /home/oracle/psu/psu5.2
[root@rac01 psu5.2]# opatch auto ./9952245 -och$ORA_CRS_HOME
在自动应用的过程中需要,会要求输入步骤4产生的文件的路径(如下):
/u01/app/oracle/product/10.2.0/crs_1/OPatch/opatchis bundled with OCM, Enter the absolute OCM response file path:
/u01/app/oracle/product/10.2.0/db_1/OPatch/ocm/bin/ocm.rsp
6. 升级结束,查看crs版本
[oracle@rac01~]$ opatch lsinventory -bugs_fixed | grep -i 'TRACKING BUG' | grep -i 'PSU'
9952245 9952245 Tue Oct 08 01:30:18 CST 2013 TRACKING BUG FOR 10.2.0.5.2 CRS PSU
已经为10.2.0.5.2
7. 在第二个节点rac02上重复第5步骤
8. 查看RAC状态
[oracle@rac01 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora....L1.inst application ONLINE ONLINE rac01
ora....L2.inst application ONLINE ONLINE rac02
ora.BALL.db application ONLINE ONLINE rac02
ora....SM1.asm application ONLINE ONLINE rac01
ora....01.lsnr application ONLINE ONLINE rac01
ora.rac01.gsd application ONLINE ONLINE rac01
ora.rac01.ons application ONLINE ONLINE rac01
ora.rac01.vip application ONLINE ONLINE rac01
ora....SM2.asm application ONLINE ONLINE rac02
ora....02.lsnr application ONLINE ONLINE rac02
ora.rac02.gsd application ONLINE ONLINE rac02
ora.rac02.ons application ONLINE ONLINE rac02
ora.rac02.vip application ONLINE ONLINE rac02
DATABASE PSU升级(10.2.0.5.0→10.2.0.5.9)
升级所用的PSU: 14275629
1. OPatch工具版本检查,其版本应在10.2.0.5.0以上
[oracle@rac01~]$ opatch version
Invoking OPatch10.2.0.5.1
OPatch Version:10.2.0.5.1
如果OPatch工具版本不符合README中的要求,下载最新版本OPatch,解压后,直接用解压后得到OPatch目录替换$ORACLE_HOME和$CRS_HOME下的OPatch目录,并注意替换后目录的权限修改
2. 环境变量的设置,确保make,ar,ld和nm可以执行。
这些命令都在/usr/ccs/bin下,export PATH=$PATH:/usr/ccs/bin
3. 解压PSU升级包
[oracle@rac01 psu5.9]$ unzipp14275629_10205_Linux-x86-64--DB--10.2.0.5.9.zip
4. 需安装的PSU与以前安装过的PATCH的冲突检测
[oracle@rac01psu5.9]$ opatch prereq CheckConflictAgainstOHWithDetail -phBaseDir ./14275629
5. 关闭DATABASE,ASM,LISTENER,EM,CRS不需要关掉
[oracle@rac01 ~]$ srvctlstop listener -n rac01
[oracle@rac01 ~]$srvctl stop listener -n rac02
[oracle@rac01 ~]$ srvctl stop database –d BALL
[oracle@rac01 ~]$ srvctl stop asm-n rac01
[oracle@rac01 ~]$srvctl stop asm -n rac02
[oracle@rac01 ~]$emctl stop dbconsole
[oracle@rac02 ~]$ emctl stop dbconsole
6. 应用PSU
[oracle@rac01psu5.9]$ cd 14275629/
[oracle@rac0114275629]$ opatch apply
在我的测试时,Opatch工具应用过程中发生了一个报错
[报错]:
Runningprerequisite checks...
Prerequisitecheck "CheckActiveFilesAndExecutables" failed.
Thedetails are:
Followingexecutables are active :
/u01/app/oracle/product/10.2.0/db_1/bin/oracle
ApplySessionfailed during prerequisite checks: Prerequisite check"CheckActiveFilesAndExecutables" failed.
Systemintact, OPatch will not attempt to restore the system
OPatchfailed with error code 74
根据提示说明,有进程在使用/u01/app/oracle/product/10.2.0/db_1/bin/oracle目下的文件,我们升级的PSU会安装在/u01/app/oracle/product/10.2.0/db_1下,应确保该目下的文件没有被使用。
[解决方法]:
[oracle@rac0114275629]$ fuser -k /u01/app/oracle/product/10.2.0/db_1/bin/oracle
找到使用该目下的进程,并通过-k参数删掉该进程
7. 启动数据库,并执行编译数据库中无效对象的脚本
[oracle@rac01 ~]$srvctl start listener -n rac01
[oracle@rac01 ~]$srvctl start listener -n rac02
[oracle@rac01 ~]$srvctl start asm -n rac01
[oracle@rac01 ~]$srvctl start asm -n rac02
[oracle@rac01 ~]$srvctl start database -d B
[oracle@rac01 ~]$ cd $ORACLE_HOME/rdbms/admin
[oracle@rac01 admin]$ sqlplus / as sysdba
SQL> @catbundle.sql psu apply
SQL> @utlrp.sql
8. PSU升级结束,确认无效对象的数量。即使有无效对象,其数量不应多余升级前无效对象的数量
SQL> selectcount(*) from dba_objects where status='INVALID';
COUNT(*)
-------------------
0
9. 确认升级后DB的版本
[oracle@rac01 ~]$opatch lsinventory -bugs_fixed | egrep -i 'PSU|DATABASE PATCH SET UPDATE'