Redhat 5.4 Orcle RAC 数据库 从10.2.0.1升级到 10.2.0.4

之前安装的是两个节点的RAC平台。数据库版本是10.2.0.1.这个实验的目的就是将这个数据库版本从10.2.0.1升级到10.2.0.4.升级包可以从Oracle metalink上进行下载,这个下载需要Oracle付费的帐号。网络可能也有资源下载。10.2.0.4的patch number是:p6810189。

两个节点的RAC安装,参考Blog:

Redhat 5.4 + ASM + RAW+ Oracle 10g RAC安装文档

http://blog.csdn.net/xujinyang/article/details/6837265

升级过程和单节点的升级差不多。10g单节点的升级参考Blog:

Oracle 10g upgrade from 10.2.0.1 to 10.2.0.4

http://blog.csdn.net/xujinyang/article/details/6829567

RAC环境下的升级分三步。这个在patch包里的readme文档里有详细的说明。

1.升级clusterware-- >升级包中安装程序里选择CRS_HOME后安装

2.升级数据库软件-- >升级包中安装程序里选择ORACLE_HOME后安装

3.升级实例-- >可以使用脚本或者直接运行DBUA实现,如果用脚本,参考单节点的升级

RAC的升级分滚动升级升级和非滚动升级。

滚动升级就是每次升级一个节点。

非滚动就是一次升级所有节点。

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

注意:

如果是生产库,在升级之前做好备份。备份数据库(如:RMAN),备份ORA_CRS_HOME目录,备份ORACLE_HOME目录。虽然很少会出现问题,但是如果出现问题,谁来为我们的错误买单,所以作为一个DBA要铭记于心的就是备份。

一.从客户端查看现在的版本

1.1 修改tnsnames.Ora 文件,增加一下内容:

RAC =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = TCP)(HOST = 110.853.10.1)(PORT = 1521))

(ADDRESS = (PROTOCOL = TCP)(HOST = 10.85.10.2)(PORT = 1521))

(LOAD_BALANCE=YES)

(

CONNECT_DATA=

(SERVER=DEDICATED)

(SERVICE_NAME=ORCL)

(

FAILOVER_MODE=

(TYPE=session)

(METHOD=basic)

(RETRIES=180)

(DELAY=5)

)

)

)

1.2客户端用sqlplus 连接数据库, 查看数据库版本信息

C:/Users/Administrator.DavidDai>sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on 星期三 9月 15 16:32:47 2010

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

SQL>conn sys/oracle@rac as sysdba;

已连接。

SQL>select instance_name from V$instance;

INSTANCE_NAME

--------------------------------

orcl2

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

CORE10.2.0.1.0Production

TNS for Linux: Version 10.2.0.1.0 - Production

NLSRTL Version 10.2.0.1.0 - Production

SQL>

查看版本其实没必要这么复杂,这里是额外的演示一下客户端如何连接RAC.

二. 升级Clusterware 软件

2.1 将升级包mout到linux系统

用root用户登陆系统,执行如下命令:

mount -o username=administrator,password=12345678 //10.85.10.80/Software /mnt

2.2 停止相关的进程

2.2.1每个节点分别停止EM和isqlplus

[oracle@rac1 bin]$ emctl stop dbconsole

[oracle@rac1 bin]$ isqlplusctl stop

2.2.2停止相关进程

这个可以用srvctl 命令来一个一个进行,也可以用crs_stop -all 进行。

这部分内容参考Blog:

Oracle RAC 启动与关闭

http://blog.csdn.net/xujinyang/article/details/6829632

[oracle@rac1 bin]$ crs_stat -t

NameTypeTargetStateHost

------------------------------------------------------------

ora.orcl.dbapplicationOFFLINEOFFLINE

ora....oltp.cs applicationOFFLINEOFFLINE

ora....cl1.srv applicationOFFLINEOFFLINE

ora....cl2.srv applicationOFFLINEOFFLINE

ora....l1.inst applicationOFFLINEOFFLINE

ora....l2.inst applicationOFFLINEOFFLINE

ora....SM2.asm applicationOFFLINEOFFLINE

ora....C1.lsnr applicationOFFLINEOFFLINE

ora.rac1.gsdapplicationOFFLINEOFFLINE

ora.rac1.onsapplicationOFFLINEOFFLINE

ora.rac1.vipapplicationOFFLINEOFFLINE

ora....SM1.asm applicationOFFLINEOFFLINE

ora....C2.lsnr applicationOFFLINEOFFLINE

ora.rac2.gsdapplicationOFFLINEOFFLINE

ora.rac2.onsapplicationOFFLINEOFFLINE

ora.rac2.vipapplicationOFFLINEOFFLINE

2.2.3停止每个节点上的CRS

[root@rac1 ~]# /u01/app/oracle/product/crs/bin/crsctl stop crs

2.3 用Xmanger 工具运行runInstaller

2.3.1 先在Xmanager 工具里面指定DISPLAY 变量

[oracle@rac1 ~]$ export DISPLAY=10.85.10.80:0.0

2.3.2 进行升级包的目录,运行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,所以忽略了版本检查

2.3.3在可视化的安装窗口选择CRS_HOME。看清楚,不要选错了。然后一下步进行安装。

2.3.4安装结束会提示运行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服务。 我们在升级数据库的时候需要关闭这些服务。

3.1停止相关进程

[oracle@rac1 bin]$ crs_stop -all

[oracle@rac1 bin]$ crs_stat -t

NameTypeTargetStateHost

------------------------------------------------------------

ora.orcl.dbapplicationONLINEOFFLINE

ora....oltp.cs applicationONLINEOFFLINE

ora....cl1.srv applicationONLINEOFFLINE

ora....cl2.srv applicationONLINEOFFLINE

ora....l1.inst applicationOFFLINEOFFLINE

ora....l2.inst applicationOFFLINEOFFLINE

ora....SM2.asm applicationOFFLINEOFFLINE

ora....C1.lsnr applicationOFFLINEOFFLINE

ora.rac1.gsdapplicationOFFLINEOFFLINE

ora.rac1.onsapplicationOFFLINEOFFLINE

ora.rac1.vipapplicationOFFLINEOFFLINE

ora....SM1.asm applicationOFFLINEOFFLINE

ora....C2.lsnr applicationOFFLINEOFFLINE

ora.rac2.gsdapplicationOFFLINEOFFLINE

ora.rac2.onsapplicationOFFLINEOFFLINE

ora.rac2.vipapplicationOFFLINEOFFLINE

3.2用Xmanger 工具运行runInstaller

3.2.1 先在Xmanager 工具里面指定DISPLAY 变量

[oracle@rac1 ~]$ export DISPLAY=10.85.10.80:0.0

3.2.2 进行升级包的目录,运行runInstaller

在可视化的安装窗口选择ORACLE_HOME。看清楚,不要选错了。然后一下步进行安装。

3.2.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.

四.升级实例

升级实例有两种方法:

1. DBUA

2.手动执行脚本

4.1用脚本升级

After you install the patch set,you must perform the following steps on every database associated with the upgraded Oracle home:

Note:

If you do not run thecatupgrd.sqlscript as described in this section and you start up a database for normal operation, thenORA-01092: ORACLE instance terminated. Disconnection forcederrors will occur and the errorORA-39700: database must be opened with UPGRADE optionwill be in the alert log.

  1. Log in as the Oracle software owner user.
  2. For Oracle RAC installations, start listener on each node of the cluster as follows:

$ srvctl start listener -nnode

  1. If you are using Automatic Storage Management, start the Automatic Storage Management instance.
  2. For Oracle RAC installations:
    1. Use SQL*Plus to log in to the database as theSYSuser withSYSDBAprivileges:

$ sqlplus /nolog

SQL> CONNECT SYS AS SYSDBA

Enter password:SYS_password

SQL> STARTUP NOMOUNT

    1. Set theCLUSTER_DATABASEinitialization parameter toFALSE:

SQL> ALTER SYSTEM SET CLUSTER_DATABASE=FALSE SCOPE=spfile;

    1. Shut down the database:

SQL> SHUTDOWN

  1. Enter the following SQL*Plus commands:

SQL> STARTUP UPGRADE

SQL> SPOOL patch.log

SQL> @?/rdbms/admin/catupgrd.sql

SQL> SPOOL OFF

  1. Review thepatch.logfile for errors and inspect the list of components that is displayed at the end ofcatupgrd.sqlscript.

This list provides the version and status of eachSERVERcomponent in the database.

  1. If necessary, rerun thecatupgrd.sqlscript after correcting any problems.
  2. Restart the database:

SQL> SHUTDOWN IMMEDIATE

SQL> STARTUP

  1. Run theutlrp.sqlscript to recompile all invalid PL/SQL packages now instead of when the packages are accessed for the first time. This step is optional but recommended.

SQL> @?/rdbms/admin/utlrp.sql

Note:

When the 10.2.0.4 patch set is applied to an Oracle Database 10gStandard Edition database, there may be 54 invalid objects after theutlrp.sqlscript runs. These objects belong to the unsupported components and do not affect the database operation.

Ignore any messages indicating that the database contains invalid recycle bin objects similar to the following:

BIN$4lzljWIt9gfgMFeM2hVSoA==$0

  1. Run the following command to check the status of all the components after the upgrade:

SQL> select comp_name, version, status from sys.dba_registry;

In the output of the preceding command, the status of all the components should beVALIDfor a successful upgrade.

  1. If you are using the Oracle Recovery Manager catalog, enter the following command:

$ rman catalogusername/password@alias

  1. For Oracle RAC installations:
    1. Set theCLUSTER_DATABASEinitialization parameter toTRUE:

SQL> ALTER SYSTEM SET CLUSTER_DATABASE=TRUE SCOPE=spfile;

    1. Restart the database:

SQL> SHUTDOWN

SQL> STARTUP

    1. Start any database services that you want to use:

$ srvctl start service -ddb_name-sservice_name

  1. To configure and secure Enterprise Manager follow these steps:

Ensure the database and Listener are operational.

    • In the case of a single instance, execute

emca -upgrade db

    • In the case of Oracle Real Application Clusters (RAC), execute

emca -upgrade db -cluster

4.2用DBUA升级

使用DBUA工具的话,会把升级的一些代码封装起来,我们只需要在界面上点点就可以了。所以比较方便。在一个节点运行DBUA即可。 会同时升级2个节点的实例。

4.2.1启动相关的进程

[oracle@rac1 bin]$ crs_start -all

4.2.2运行dbua

[oracle@rac1 ~]$ export DISPLAY=192.168.1.111:0.0

[oracle@rac1 ~]$ dbua

说明:

(1)启动dbua工具后,会提示选择升级ASM还是数据库,这里是从10.2.0.1的基础上升级,不需要升级ASM,直接跳过,如低于此版本而是必须先升级ASM。

(2)运行过程中有选项是否编译无效的对象。默认勾上。在升级之后会自己编译无效对象。

(3)运行需要一个小时左右。

安装结束后会提示安装日志存放目录:

/u01/app/oracle/product/10.2.0/db_1/cfgtoollogs/dbua/orcl/upgrade/

五.验证

我们还是从客户端来验证,监听之前已经配好了。

C:/Users/Administrator.DavidDai>sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on星期四9月16 12:18:32 2010

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

SQL>conn sys/oracle@rac as sysdba;

已连接。

SQL>select instance_name from V$instance;

INSTANCE_NAME

--------------------------------

orcl2

SQL>select * from v$version;

BANNER

--------------------------------------------------------------------------------

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Prod

PL/SQL Release 10.2.0.4.0 - Production

CORE10.2.0.4.0Production

TNS for Linux: Version 10.2.0.4.0 - Production

NLSRTL Version 10.2.0.4.0 - Production

SQL>select comp_name, version, status from sys.dba_registry;

COMP_NAMEVERSIONSTATUS

-------------------------------------------------- -------------------- --------

Oracle Enterprise Manager10.2.0.4.0VALID

Spatial10.2.0.4.0VALID

Oracle interMedia10.2.0.4.0VALID

OLAP Catalog10.2.0.4.0VALID

Oracle XML Database10.2.0.4.0VALID

Oracle Text10.2.0.4.0VALID

Oracle Expression Filter10.2.0.4.0VALID

Oracle Rule Manager10.2.0.4.0VALID

Oracle Workspace Manager10.2.0.4.3VALID

Oracle Data Mining10.2.0.4.0VALID

Oracle Database Catalog Views10.2.0.4.0VALID

COMP_NAMEVERSIONSTATUS

-------------------------------------------------- -------------------- --------

Oracle Database Packages and Types10.2.0.4.0VALID

JServer JAVA Virtual Machine10.2.0.4.0VALID

Oracle XDK10.2.0.4.0VALID

Oracle Database Java Packages10.2.0.4.0VALID

OLAP Analytic Workspace10.2.0.4.0VALID

Oracle OLAP API10.2.0.4.0VALID

Oracle Real Application Clusters10.2.0.4.0VALID

已选择18行。

顺便验证一下RAC的性能,我们看到现在连的是oracl2.我们上服务器,把这个实例停掉。在查看连哪个实例。

[oracle@rac1 upgrade]$export ORACLE_SID=orcl2

[oracle@rac1 upgrade]$sqlplus /nolog

SQL*Plus: Release 10.2.0.4.0 - Production on Thu Sep 16 00:48:47 2010

Copyright (c) 1982, 2007, Oracle.All Rights Reserved.

SQL>conn / as sysdba;

Connected.

SQL>shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SQL>

我们在客户端在查询一下看看:

SQL>select instance_name from V$instance;

INSTANCE_NAME

--------------------------------

orcl1

注意:这里自动切换到了orcl1实例。这个就体现RAC的价值,当一个实例宕掉后,不会影响系统的运行。

至此,RAC的升级结束。

------------------------------------------------------------------------------

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值