最近遇到一个项目,是在AIX5.3上安装ORACLE 9i RAC,说实话,ORACLE俺压根就没有接触过,我也是临危受命。感觉如同当年实施AS400的XSM项目一般。无奈,下载了N多本REDBOOK开始研究,终于有了些眉目,找到了一份英文资料《Step-By-Step Installation of RAC on IBM AIX (RS/6000)》看后觉得很不错,闲暇之余翻译并修改了一些地方,发到这里与大家分享。


Oracle RAC的三种架构模式:

1、RAC+HACMP---最常见,但是其实安装HACMP只为了使用concurrent vg

教您如何在AIX上安装Oracle RAC_在AIX

2、RAC+GPFS---个人感觉应该是比较好的选择,减少了管理的复杂度

教您如何在AIX上安装Oracle RAC_AIX上安装Oracle RAC_02

3、RAC+ASM---由于使用ASM管理磁盘系统,所以从系统层面来看存在一些弊端

教您如何在AIX上安装Oracle RAC_AIX上安装Oracle RAC_03


以上是个人的粗略之见,不对之处,还望高手指教。这次项目是RAC+HACMP,希望有机会尝试一下另外两种模式,哈哈


马上就要实施这个项目,我将在实施的过程中随时上来与大家分享实战心得


? 1. Configuring the Cluster Hardware

o 1.1 Minimal Hardware list / System Requirements

§ 1.1.1 Hardware

§ 1.1.2 Software

§ 1.1.3 Patches

o 1.2 Installing Disk Arrays

o 1.3 Installing Cluster Interconnect and Public Network Hardware

? 2. Creating a cluster

o 2.1 HACMP/ES Software Installation

o 2.2 Configuring Cluster Topology

o 2.3 Synchronizing Cluster Topology

o 2.4 Configuring Cluster Resources

§ 2.4.1 Create volume groups to be shared concurrently on one node

§ 2.4.2 Create Shared RAW Logical Volumes

§ 2.4.3 Import the Volume Group on to the Other Nodes

§ 2.4.4 Add a Concurrent Cluster Resource Group

§ 2.4.5 Configure the Concurrent Cluster Resource Group

§ 2.4.6 Creating Parallel Filesystems (GPFS)

o 2.5 Synchronizing Cluster Resources

o 2.6 Joining Nodes Into the Cluster

o 2.7 Basic Cluster Administration

? 3. Preparing for the Installation of RAC

o 3.1 Configure the shared disks and UNIX preinstallation tasks

§ 3.2.1 Configure the shared disks

§ 3.2.2 UNIX preinstallation tasks

o 3.2 Using the Oracle Universal Installer for Real Application Clusters

o 3.3 Create a RAC Database using the Oracle Database Configuration Assistant

? 4. Administering Real Application Clusters Instances

? 5. References


1. 配置群集硬件

1.1 系统需求

至少需要两个节点

查看AIX和RAC的兼容性列表

1.1.1 硬件

? IBM 小型机 – 两台运行 AIX 4.3.3 或 5L (需要64位)

? 至少512MB内存,1G换页空间

1.1.2 软件

? 当使用IBM AIX 4.3.3时:

o HACMP/ES CRM 4.4.x

o 数据库文件仅支持RAW Logical Volumes (Raw Devices)

o Oracle数据库企业版 9i Release 1 (9.0.1) 或 9i Release 2 (9.2.0)

? 当使用IBM AIX 5.1 (5L)时:

o 数据库文件 RAW Logical Volumes (Raw Devices)和Parallel Filesystem (GPFS):

o HACMP/ES CRM 4.4.x(当使用GPFS时不需要HACMP)

o GPFS 1.5

o IBM Patch PTF12 and IBM patch IY34917 or IBM Patch PTF13

o Oracle Server Enterprise Edition 9i Release 2 (9.2.0)

o Oracle数据库企业版(含RAC)9i for AIX 4.3.3 和 5L 包含在不同的CD中

1.1.3 补丁

需要如下补丁:

? IBM AIX 操作系统环境补丁

? 存储firmware或者微码补丁

补丁考虑因素:

? 务必保证所有节点中的补丁版本一致

? 不要轻易安装firmware相关的补丁

? 尽量获得最新补丁的相关信息


1.2 安装磁盘阵列

参照磁盘阵列的初始安装说明完成安装步骤。

1.3 安装群集互联和公共网络硬件

该部分务必在群集被配置前配置完成并保证可用

? 如果尚未安装,则在群集节点中安装主机适配器。

? 如果群集中超过两个节点,则需要交换机进行连接


2. 创建群集

2.1 IBM HACMP/ES软件安装

大致步骤如下:

? 安装硬件

? 安装IBM AIX操作系统软件

? 安装最新的AIX操作系统补丁

? 在每个节点上安装HACMP/ES 4.X.X软件

? 安装HACMP/ES需要的补丁

? 配置群集拓扑

? 同步群集拓扑

? 配置群集资源

? 同步群集资源

在HACMP for AIX 4.X.X 的安装过程中,需要如下包被安装:

? cluster.adt.es.client.demos

? cluster.adt.es.client.include

? cluster.adt.es.server.demos

? cluster.clvm.rte HACMP for AIX Concurrent

? cluster.cspoc.cmds HACMP CSPOC commands

? cluster.cspoc.dsh HACMP CSPOC dsh and perl

? cluster.cspoc.rte HACMP CSPOC Runtime Commands

? cluster.es.client.lib ES Client Libraries

? cluster.es.client.rte ES Client Runtime

? cluster.es.client.utils ES Client Utilities

? cluster.es.clvm.rte ES for AIX Concurrent Access

? cluster.es.cspoc.cmds ES CSPOC Commands>;

? cluster.es.cspoc.dsh ES CSPOC dsh and perl

? cluster.es.cspoc.rte ES CSPOC Runtime Commands

? cluster.es.hc.rte ES HC Daemon

? cluster.es.server.diag ES Server Diags

? cluster.es.server.events ES Server Events

? cluster.es.server.rte ES Base Server Runtime

? cluster.es.server.utils ES Server Utilities

? cluster.hc.rte HACMP HC Daemon

? cluster.msg.En_US.cspoc HACMP CSPOC Messages - U.S.

? cluster.msg.en_US.cspoc HACMP CSPOC Messages - U.S.

? cluster.msg.en_US.es.client

? cluster.msg.en_US.es.server

? cluster.msg.en_US.haview HACMP HAView Messages - U.S.

? cluster.vsm.es ES VSM Configuration Utility

? cluster.clvm.rte HACMP for AIX Concurrent

? cluster.es.client.rte ES Client Runtime

? cluster.es.clvm.rte ES for AIX Concurrent Access

? cluster.es.hc.rte ES HC Daemon

? cluster.es.server.events ES Server Events

? cluster.es.server.rte ES Base Server Runtime

? cluster.es.server.utils ES Server Utilities

? cluster.hc.rte HACMP HC Daemon

? cluster.man.en_US.client.data

? cluster.man.en_US.cspoc.data

? cluster.man.en_US.es.data ES Man Pages - U.S. English

? cluster.man.en_US.server.data

? rsct.basic.hacmp RS/6000 Cluster Technology

? rsct.basic.rte RS/6000 Cluster Technology

? rsct.basic.sp RS/6000 Cluster Technology

? rsct.clients.hacmp RS/6000 Cluster Technology

? rsct.clients.rte RS/6000 Cluster Technology

? rsct.clients.sp RS/6000 Cluster Technology

? rsct.basic.rte RS/6000 Cluster Technology

你可以使用如下命令验证HACMP软件的安装情况

# /usr/sbin/cluster/diag/clverify


2.2 配置群集拓扑

使用如下命令:

# smit hacmp


添加群集定义:

Smit HACMP ->; Cluster Configuration ->; Cluster Topology ->; Configure Cluster ->; Add a Cluster Definintion

快捷路径:

# smit cm_config_cluster.add

在打开的界面中为群集指定一个名字,例如cluster01


配置节点:

Smit HACMP ->; Cluster Configuration ->; Cluster Topology ->; Configure Nodes ->; Add Cluster Nodes

快捷路径:

# smit cm_config_nodes.add

在打开的界面中为群集指定参与的节点,例如Node1和Node2


配置网络适配器[以每个节点两个网络适配器和一个串口为例]

Node Name address IP Label (/etc/hosts) Type

node1 192.168.0.1 node1srvc service服务IP

192.168.1.1 node1stby standby 启动IP

/dev/tty0 serial用于心跳

node2 192.168.0.2 node2srvc service 服务IP

192.168.1.2 node2stby standby 启动IP

/dev/tty0 serial用于心跳


将网络配置定义到群集配置中:

Smit HACMP ->; Cluster Configuration ->; Cluster Topology ->; Configure Nodes ->; Add an Adapter

快捷路径:

# smit cm_confg_adapters.add

在打开的界面中为群集指定参与节点的网络设置。务必保证Adapter IP Label与/etc/hosts中的定义一致,Network Name可以选择ipa或者rs232

例如:

Add an AdapterType or select values in entry fields.

* Adapter IP Label [node1stby]

* Network Type [ether] +

* Network Name [ipa] +

* Network Attribute public +

* Adapter Function standby +

Adapter Identifier []

Adapter Hardware Address []

Node Name [node1] +


Add an AdapterType or select values in entry fields.

* Adapter IP Label [node1_tty]

* Network Type [rs232] +

* Network Name [serial] +

* Network Attribute serial +

* Adapter Function service +

Adapter Identifier [/dev/tty0]

Adapter Hardware Address []

Node Name [node1] +


Oracle RAC for AIX.rar (43.49 KB)

英文原版与汉化版





2.3 同步群集拓扑

在进行同步之前需要在"/" 目录下创建".rhosts" 文件.

".rhosts" 文件样例:

node1 root

node2 root

保证"/.rhosts" 文件的权限是 600.

# chmod 600 /.rhosts

使用"rcp" 命令在每个节点上测试:

在node1上:

# rcp /etc/group node2:/tmp

在node2上:

# rcp /etc/group node1:/tmp


同步群集拓扑:

Smit HACMP ->; Cluster Configuration ->; Cluster Topology ->; Synchronize Cluster Topology

快捷路径:

# smit configchk.dialog


2.4 配置群集资源组

在RAC的配置中仅需要一个资源组。这个资源组就是共享卷组的并行资源组:

1)使用lspv检查是否目标硬盘被物理连接到群集中的两个节点

2.4.1 在一个节点上创建并行卷组

# smit vg 并选择"Add a Volume Group"

在打开的界面中设定该卷组为并行卷组,禁止卷组的自动启动和并行模式的自动激活,务必保证 major number 在所有节点中相同

2.4.2 如果不使用GPFS,则创建共享的 RAW Logical Volumes

mklv -y'db_name_cntrl1_110m' -w'n' -s'n' -r'n' usupport_vg 4 hdisk5

mklv -y'db_name_cntrl2_110m' -w'n' -s'n' -r'n' usupport_vg 4 hdisk5

mklv -y'db_name_system_400m' -w'n' -s'n' -r'n' usupport_vg 13 hdisk5

mklv -y'db_name_users_120m' -w'n' -s'n' -r'n' usupport_vg 4 hdisk5

mklv -y'db_name_drsys_90m' -w'n' -s'n' -r'n' usupport_vg 3 hdisk5

mklv -y'db_name_tools_12m' -w'n' -s'n' -r'n' usupport_vg 1 hdisk5

mklv -y'db_name_temp_100m' -w'n' -s'n' -r'n' usupport_vg 4 hdisk5

mklv -y'db_name_undotbs1_312m' -w'n' -s'n' -r'n' usupport_vg 10 hdisk5

mklv -y'db_name_undotbs2_312m' -w'n' -s'n' -r'n' usupport_vg 10 hdisk5

mklv -y'db_name_log11_120m' -w'n' -s'n' -r'n' usupport_vg 4 hdisk5

mklv -y'db_name_log12_120m' -w'n' -s'n' -r'n' usupport_vg 4 hdisk5

mklv -y'db_name_log21_120m' -w'n' -s'n' -r'n' usupport_vg 4 hdisk5

mklv -y'db_name_log22_120m' -w'n' -s'n' -r'n' usupport_vg 4 hdisk5

mklv -y'db_name_indx_70m' -w'n' -s'n' -r'n' usupport_vg 3 hdisk5

mklv -y'db_name_cwmlite_100m' -w'n' -s'n' -r'n' usupport_vg 4 hdisk5

mklv -y'db_name_example_160m' -w'n' -s'n' -r'n' usupport_vg 5 hdisk5

mklv -y'db_name_oemrepo_20m' -w'n' -s'n' -r'n' usupport_vg 1 hdisk5

mklv -y'db_name_spfile_5m' -w'n' -s'n' -r'n' usupport_vg 1 hdisk5

mklv -y'db_name_srvmconf_100m' -w'n' -s'n' -r'n' usupport_vg 4 hdisk5

解释:"mklv -y'db_name_cntrl1_110m' -w'n' -s'n' -r'n' usupport_vg 4 hdisk5"将创建4个分区,每个分区32MB,该命令创建两个文件:

/dev/db_name_cntrl1_110m 物理文件

/dev/rdb_name_cntrl1_110m 裸设备文件(raw)

使用下面的方法修改文件的权限:

# chown oracle:dba /dev/rdb_name*

2.4.3 在其他节点中导入卷组

在第一个节点中输入:

% varyoffvg 卷组名

在其他节点中输入"smit vg" :

选择"Import a Volume Group"

在打开的界面中禁止卷组的自动启动和并行模式的自动激活,务必保证 major number 与之前节点中的相同

使用下面的方法修改文件的权限:

# chown oracle:dba /dev/rdb_name*

2.4.4 添加一个并行资源组

Smit HACMP ->; Cluster Configuration ->; Cluster Resources ->; Define Resource Groups ->; Add a Resource Group

快捷路径:

# smit cm_add_grp

2.4.5 配置并行资源组

Smit HACMP ->; Cluster Configuration ->; Cluster Resources ->; Change/Show Resources for a Resource Group

快捷路径:

# smit cm_cfg_res.select

在打开的界面中Concurrent Volume groups处输入之前创建的并行卷组名

2.4.6 创建并行文件系统(GPFS) 此处忽略

With AIX 5.1 (5L) you can also place your files on GPFS (RAW Logical Volumes are not a requirement of GPFS). In this case create GPFS capable of holding all required Database Files, Controlfiles and Logfiles.


2.5 同步群集资源组

Smit HACMP ->; Cluster Configuration ->; Cluster Resources ->; Synchronize Cluster Resources

快捷路径:

# smit clsyncnode.dialog


2.6 添加节点到群集中

Smit HACMP ->; Cluster Services ->; Start Cluster Services

快捷路径:

# smit clstart.dialog

在打开的界面中 "Startup Cluster Information Daemon?" 应该选择为"true".

通过查看"/etc/hacmp.out"可以得知启动情况。如果节点添加成功则会显示在 "/tmp/hacmp.out" 文件中:


2.7 基本群集管理

"/tmp/hacmp.out"是最好的查看群集信息的地方。"clstat" 也可以用于验证群集的健康情况。

# /usr/es/sbin/cluster/clstat

快速查看群集服务情况:

Smit HACMP ->; Cluster Services ->; Show Cluster Services


3.0 安装RAC前的准备工作

The Real Application Clusters安装过程包含以下四个步骤.

1. 配置共享磁盘和UNIX预安装任务.

2. 安装Oracle9i Enterprise Edition 和Oracle9i Real Application Clusters 软件.

3. 创建和配置数据库.


3.1 配置共享磁盘和UNIX预安装任务

3.1.1 配置共享磁盘

如果你没有安装GPFS,那么Real Application Clusters 需要所有的实例都可以访问在共享磁盘上未被格式化的设备,即裸设备。

Oracle 实例通过配置RAC可以向裸设备写入:

? 控制文件

? spfile.ora

? 数据文件

? 在线重做日志文件

? 服务器管理(SRVM)配置信息

因此为每一个类型的文件定义裸设备十分必要。Oracle数据库配置助手将创建如下配置:

Raw Volume File Size Sample File Name

SYSTEM tablespace 400 Mb db_name_raw_system_400m

USERS tablespace 120 Mb db_name_raw_users_120m

TEMP tablespace 100 Mb db_name_raw_temp_100m

UNDOTBS tablespace 312 Mb db_name_raw_undotbsx_312m

CWMLITE tablespace 100 Mb db_name_raw_cwmlite_100m

EXAMPLE 160 Mb db_name_raw_example_160m

OEMREPO 20 Mb db_name_raw_oemrepo_20m

INDX tablespace 70 Mb db_name_raw_indx_70m

TOOLS tablespace 12 Mb db_name_raw_tools_12m

DRYSYS tablespace 90 Mb db_name_raw_drsys_90m

First control file 110 Mb db_name_raw_controlfile1_110m

Second control file 110 Mb db_name_raw_controlfile2_110m

两个在线重做日志文件,每个120 Mb x 2 db_name_thread_lognumber_120m

spfile.ora 5 Mb db_name_raw_spfile_5m

srvmconfig 100 Mb db_name_raw_srvmconf_100m

3.1.2 UNIX预安装步骤

使用root用户运行installPrep.sh脚本 [从网上下载,提供自动检查]

添加Oracle用户

? 确保在所有的节点上已经创建了osdba 组和oinstall组(primary group)

典型的定义如下:

osdba::101:oracle

oinstall::102:root,oracle

? 在每个节点上创建oracle用户,确保:

o 是osdba 组的成员

o oinstall 作为首选组

o 仅用于安装和升级Oracle软件

o 拥有远程目录的写权限

创建用户:

Smit ->; Security & Users ->; Users ->; Add a User

快捷路径:

# smit mkuser

? 创建挂载点目录,确保:

o 每个节点的挂载点相同

o oracle帐户拥有读写和执行权限

? 在安装Oracle的节点上,设定用户等效。包含本地节点,oracle帐户的.rhosts文件或者/etc/hosts.equiv 文件.

? 对于oracle帐户,通过执行远程登录(rlogin)来检查群集中每个节点的用户等效机制

建立系统环境变量:

?在用户的PATH中设定本地的bin目录, 例如 /usr/local/bin, 或者 /opt/bin. 在这些目录中拥有执行权限十分重要

? 设定 DISPLAY 变量指向显示系统的IP地址,名称,X服务器和屏幕

? 为TMPDIR设定至少20MB的临时目录空间

设定Oracle环境变量(建议):

ORACLE_BASE eg /u01/app/oracle

ORACLE_HOME eg /u01/app/oracle/product/901

ORACLE_TERM xterm

NLS_LANG AMERICAN-AMERICA.UTF8 for example

ORA_NLS33 $ORACLE_HOME/ocommon/nls/admin/data

PATH Should contain $ORACLE_HOME/bin

CLASSPATH $ORACLE_HOME/JRE:$ORACLE_HOME/jlib \$ORACLE_HOME/rdbms/jlib: \$ORACLE_HOME/network/jlib

? 创建目录 /var/opt/oracle 并设定oracle用户的所有权.

? 验证/opt/SUNWcluster/bin/lkmgr的存在.


3.2 安装Oracle数据库和Real Application Clusters

安装Oracle软件,请执行一下步骤:

? 使用root用户登录并加载光驱

# mount -rv cdrfs /dev/cd0 /cdrom

? 执行存放于光盘中的"rootpre.sh" 脚本

# / ;/rootpre.sh

? 使用oracle 用户登录并执行"runInstaller".

$ / ;/runInstaller

? 打开图形界面执行安装.

? 关于Inventory Location的定义存放在/etc/oraInst.loc中.

? 验证用户组。可以执行/tmp/orainstRoot.sh来强制通过验证

? 选择配置类型为高级配置。

? 选择数据库将要安装的其他节点。

? 建议raw partition最小100MB.

? 务必不要选择升级或者迁移已经存在的数据库选项,否则将导致错误

? 显示总结界面.确认RAC 数据库软件被选择。OUI将安装 Oracle9i 软件到当前的节点,然后拷贝信息到其他已选的节点上.


3.3 使用Oracle数据库配置助手创建RAC数据库


4.0 管理Real Application Clusters实例

Oracle公司建议使用SRVCTL去管理RAC数据库环境. 在使用SRVCTL之前, 确保在配置完数据库后的Global Services Daemon (GSD) 处于运行状态. 为了使用SRVCTL,必须为所管的数据库创建了配置信息.

如果这是群集中的第一个Oracle9i数据库, 则必须初始clusterwide SRVM 配置. 首先, 创建或者编辑/var/opt/oracle/srvConfig.loc文件并且添加 srvconfig_loc=path_name.其中的path_name指cluster-shared raw volume

例如

$ vi /var/opt/oracle/srvConfig.loc

srvconfig_loc=/dev/rrac_srvconfig_100m

然后执行如下命令初始这个raw volume (Note: gsd运行过程中不可执行. Prior to 9i Release 2 you will need to kill the .../jre/1.1.8/bin/... process to stop the gsd from running. From 9i Release 2 use the gsdctl stop command):

$ srvconfig -init

第一次使用 SRVCTL 去创建配置,需要在所有节点上启用GSD以便SRVCTL可以访问节点信息。然后执行srvctl add命令使RAC知道哪些实例属于该节点:

对于Oracle RAC v9.0.1:

$ gsd

Successfully started the daemon on the local node.

$ srvctl add db -p db_name -o oracle_home

然后从每个节点输入命令:

$ srvctl add instance -p db_name -i sid -n node

显示配置信息,输入如下命令:

$ srvctl config

racdb1

racdb2

$ srvctl config -p racdb1

racnode1 racinst1

racnode2 racinst2

$ srvctl config -p racdb1 -n racnode1

racnode1 racinst1


启动和停止RAC的命令如下:

$ srvctl start -p racdb1

Instance successfully started on node: racnode2

Listeners successfully started on node: racnode2

Instance successfully started on node: racnode1

Listeners successfully started on node: racnode1


$ srvctl stop -p racdb2

Instance successfully stopped on node: racnode2

Instance successfully stopped on node: racnode1

Listener successfully stopped on node: racnode2

Listener successfully stopped on node: racnode1


$ srvctl stop -p racdb1 -i racinst2 -s inst

Instance successfully stopped on node: racnode2


$ srvctl stop -p racdb1 -s inst

PRKO-2035 : Instance is already stopped on node: racnode2

Instance successfully stopped on node: racnode1


对于Oracle RAC v9.2.0+:

$ gsdctl start

Successfully started the daemon on the local node.

$ srvctl add database -d db_name -o oracle_home [-m domain_name] [-s spfile]

然后从每个节点输入命令:

$ srvctl add instance -d db_name -i sid -n node


显示配置信息,输入如下命令:

racnode1/2 with instances racinst1/2 run:-


$ srvctl config

racdb1

racdb2


$ srvctl config -p racdb1 -n racnode1

racnode1 racinst1 /u01/app/oracle/product/9.2.0.1


$ srvctl status database -d racdb1

Instance racinst1 is running on node racnode1

Instance racinst2 is running on node racnode2


启动和停止RAC的命令如下:

$ srvctl start database -d racdb2


$ srvctl stop database -d racdb2


$ srvctl stop instance -d racdb1 -i racinst2


$ srvctl start instance -d racdb1 -i racinst2


$ gsdctl stat

GSD is running on local node

$ gsdctl stop


oracle视频教程请关注:http://down.51cto.com/4202939/up