分类: 其他UNIX
2014-01-08 17:10:28
Oracle 10g RAC 在HP-UX v3+MC ServiceGuard环境的安装
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
OS环境: HP-UX 11.31
HA软件: MC/ServiceGuard 11.18+Serviceguard Extension for RAC
Oracle: Oracle10g 10.2.0.1+10.2.0.4补丁
Hostname: hp1 hp2
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
1.检查环境
# machinfo #查系列号
# /usr/contrib/bin/machinfo | grep -i Memory #查看物理内存
# /usr/sbin/swapinfo -a #查看交换空间
# bdf /tmp #查看/tmp的空间情况,至少400M,推荐1G
如果没有400M可以设置oracle用户的环境变量,增加临时空间
$ oracle用户执行 vi ~/.profile,增加
export TEMP=/directory
export TMPDIR=/directory
# bdf #至少有10GB 的磁盘空间给Oracle software.
# uname -a #查看操作系统的版本
# /bin/getconf KERNEL_BITS #查看操作系统bit数
# date #查看每个节点的日期时间,同步时间
Tue Nov 25 10:34:33 EAT 2008 #时区要为EAT。
# date 11310959 #修改时间
# set_parms timezone #修改时区
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
2.编辑相关的配置文件
2.1
# vi /etc/hosts添加如下内容:
222.3.25.121 hp1
222.3.25.123 hp1-vip
10.1.0.121 hp1_priv
222.3.25.122 hp2
222.3.25.124 hp2-vip
10.1.0.122 hp2_priv
# vi .rhosts
hp1 root
hp2 root
2.2
#禁止卷组的自动激活
# vi /etc/lvmrc
auto_vg_activite=0
custom_vg_activation()
{
# e.g. /sbin/vgchange -a y -s
# parallel_vg_sync "/dev/vg00 /dev/vg01"
# parallel_vg_sync "/dev/vg02 /dev/vg03"
/sbin/vgchange -a y -s /dev/vg00 #*添加此行
return 0
}
2.3
#AIO配置
ll /dev/async
crw-rw-rw- 1 bin bin 101 0x000000 Jun 9 09:38 /dev/async
#如果没有开启,可以通过如下方法开启:
#创建/dev/async character device
/sbin/mknod /dev/async c 101 0x0
chown oracle:dba /dev/async
chmod 660 /dev/async
#用SAM在 kernel配置async driver
=> Kernel Configuration
=> Kernel
=> the driver is called 'asyncdsk'
Generate new kernel(生成新的kernel)
2.4
# 查看符合的连接是否存在
cd /usr/lib
ls libX*.sl
# 如果不存在需要创建
ln -s libX11.3 libX11.sl
ln -s libXIE.2 libXIE.sl
ln -s libXext.3 libXext.sl
ln -s libXhp11.3 libXhp11.sl
ln -s libXi.3 libXi.sl
ln -s libXm.4 libXm.sl
ln -s libXp.2 libXp.sl
ln -s libXt.3 libXt.sl
ln -s libXtst.2 libXtst.sl
2.5.
#调整内核参数
#kctune 查内核参数
kctune -h -B nproc="4200"
kctune -h -B ksi_alloc_max="33600"
kctune -h -B max_thread_proc="1100"
kctune -h -B maxdsiz="1073741824"
kctune -h -B maxdsiz_64bit="4294967296"
kctune -h -B maxssiz="134217728"
kctune -h -B maxssiz_64bit="1073741824"
kctune -h -B maxuprc="3688"
kctune -h -B msgmni="4096"
kctune -h -B msgtql="4096"
kctune -h -B ncsize="35840"
kctune -h -B nflocks="4096"
kctune -h -B ninode="34816"
kctune -h -B nkthread="8416"
kctune -h -B semmni="8192"
kctune -h -B semmns="16384"
kctune -h -B semmnu="4092"
kctune -h -B semvmx="32767"
kctune -h -B shmmax="34359738368"
kctune -h -B shmmni="512"
kctune -h -B shmseg="300"
kctune -h -B vps_ceiling="64"
2.6.创建Oracle用户
groupadd -g 500 dba
groupadd -g 501 oinstall
/usr/sbin/useradd -u 501 -g oinstall -G dba oracle
mkdir /home/oracle
chown oracle:oinstall /home/oracle
usermod -d /home/oracle oracle
mkdir -p /oracle/product/10.2.0/crs_1
mkdir -p /oracle/product/10.2.0/db_1
chown -R oracle:oinstall /oracle
chmod -R 775 /oracle
# vi /home/oracle/.rhosts
hp1 oracle
hp2 oracle
hp1_pirv oracle
hp2_priv oracle
hp1-vip oracle
hp2-vip oracle
2.7.解压缩安装文件
$ /opt/java1.4/bin/jar -xvf 10gr2_clusterware_hp.ia64.zip
$ /opt/java1.4/bin/jar -xvf 10gr2_database_hp.ia64.zip
$ /opt/java1.4/bin/jar -xvf p6810189_10204_HPUX-IA64
2.8
#shutdown -ry 0 #重启服务器
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
3.逻辑卷配置
3.1.创建PV
insf -eC disk #生成磁盘设备文件
ioscan -funC disk #扫描磁盘设备
ioscan -m dsf #查看磁盘设备名
pvcreate -f /dev/rdisk/disk28
diskinfo /dev/rdisk/disk28
3.2.创建vg
mkdir /dev/lockvg
mkdir /dev/datavg
mkdir /dev/archvg1
ll /dev/*/group
mknod /dev/lockvg/group c 64 0x010000
mknod /dev/datavg/group c 64 0x020000
mknod /dev/archvg1/group c 64 0x030000
vgcreate /dev/lockvg /dev/disk/disk28
vgcreate -s 64 /dev/datavg /dev/disk/disk47 /dev/disk/disk48 /dev/disk/disk49 /dev/disk/disk50
vgcreate /dev/archvg1 /dev/disk/disk51
3.3.在archvg1上创建arch1文件系统
lvcreate -L 150000 -n lvarch1 archvg1
newfs -F vxfs -o largefiles /dev/archvg1/lvarch1
3.4.创建lv
lvcreate -n ora_vote01 -L 128 /dev/datavg
lvcreate -n ora_vote02 -L 128 /dev/datavg
lvcreate -n ora_vote03 -L 128 /dev/datavg
lvcreate -n ora_crs01 -L 128 /dev/datavg
lvcreate -n ora_crs02 -L 128 /dev/datavg
lvcreate -n ora_spfile -L 128 /dev/datavg
lvcreate -n ora_pwd -L 128 /dev/datavg
lvcreate -n db_control01 -L 128 /dev/datavg
lvcreate -n db_control02 -L 128 /dev/datavg
lvcreate -n db_control03 -L 128 /dev/datavg
lvcreate -n db_users01 -L 256 /dev/datavg
lvcreate -n db_sysaux01 -L 2048 /dev/datavg
lvcreate -n db_system01 -L 2048 /dev/datavg
lvcreate -n db_temp01 -L 8192 /dev/datavg
lvcreate -n db_temp02 -L 8192 /dev/datavg
lvcreate -n db_temp03 -L 8192 /dev/datavg
lvcreate -n db_temp04 -L 8192 /dev/datavg
lvcreate -n db_undo1_01 -L 8192 /dev/datavg
lvcreate -n db_undo1_02 -L 8192 /dev/datavg
lvcreate -n db_undo2_01 -L 8192 /dev/datavg
lvcreate -n db_undo2_02 -L 8192 /dev/datavg
lvcreate -n db_redo1_01 -L 256 /dev/datavg
lvcreate -n db_redo1_02 -L 256 /dev/datavg
lvcreate -n db_redo1_03 -L 256 /dev/datavg
lvcreate -n db_redo1_04 -L 256 /dev/datavg
lvcreate -n db_redo1_05 -L 256 /dev/datavg
lvcreate -n db_redo2_01 -L 256 /dev/datavg
lvcreate -n db_redo2_02 -L 256 /dev/datavg
lvcreate -n db_redo2_03 -L 256 /dev/datavg
lvcreate -n db_redo2_04 -L 256 /dev/datavg
lvcreate -n db_redo2_05 -L 256 /dev/datavg
3.5.对vg,lv设权限
chown root.oinstall /dev/datavg/rora_crs0*
chown oracle.oinstall /dev/datavg/rora_vote0*
chown oracle.dba /dev/datavg/rora_spfile
chown oracle.dba /dev/datavg/rora_pwd
chown oracle.dba /dev/datavg/rdb_*
chmod 664 /dev/datavg/rora_crs0*
chmod 664 /dev/datavg/rora_vote0*
chmod 660 /dev/datavg/rora_spfile
chmod 660 /dev/datavg/rora_pwd
chmod 660 /dev/datavg/rdb_*
3.6.vgexport vgimport卷组
hp1:
vgchange -a n /dev/lockvg
vgchange -a n /dev/datavg
vgexport -v -p -s -m /tmp/lockvg.map /dev/lockvg
vgexport -v -p -s -m /tmp/datavg.map /dev/datavg
rcp /tmp/lockvg.map hp2:/tmp
rcp /tmp/datavg.map hp2:/tmp
hp2:
mkdir /dev/lockvg
mkdir /dev/datavg
mkdir /dev/archvg2
mknod /dev/lockvg/group c 64 0x010000
mknod /dev/datavg/group c 64 0x020000
mknod /dev/archvg2/group c 64 0x030000
vgcreate /dev/archvg2 /dev/disk/disk51
vgimport -v -m /tmp/lockvg.map /dev/lockvg /dev/disk/disk28
vgimport -v -m /tmp/datavg.map /dev/datavg /dev/disk/disk47 /dev/disk/disk48 /dev/disk/disk49 /dev/disk/disk50
strings /etc/lvmtab
vgchange -a y /dev/lockvg
vgchange -a y /dev/datavg
vgcfgbackup /dev/lockvg
vgcfgbackup /dev/datavg
vgchange -a n /dev/lockvg
vgchange -a n /dev/datavg
vgchange -a n /dev/archvg2
chown root.oinstall /dev/datavg/rora_crs0*
chown oracle.oinstall /dev/datavg/rora_vote0*
chown oracle.dba /dev/datavg/rora_spfile
chown oracle.dba /dev/datavg/rora_pwd
chown oracle.dba /dev/datavg/rdb_*
chmod 664 /dev/datavg/rora_crs0*
chmod 664 /dev/datavg/rora_vote0*
chmod 660 /dev/datavg/rora_spfile
chmod 660 /dev/datavg/rora_pwd
chmod 660 /dev/datavg/rdb_*
3.7.在archvg2上创建arch2文件系统
lvcreate -L 150000 -n lvarch2 archvg2
newfs -F vxfs -o largefiles /dev/archvg2/lvarch2
# strings /etc/lvmtab
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
4 集群配置
4.1
使用cmquerycl去创建一个集群配置文件,Cmquerycl命令必须在主节点上进行。
# cmquerycl -v -C /etc/cmcluster/cmcluster.ascii -n hp1 -n hp2
4.2
# vi /etc/cmcluster/cmcluster.ascii
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
CLUSTER_NAME cluster1
NODE_NAME hp1
NETWORK_INTERFACE lan2
HEARTBEAT_IP 10.1.0.121
NETWORK_INTERFACE lan1
NETWORK_INTERFACE lan0
HEARTBEAT_IP 222.3.25.121
# CLUSTER_LOCK_LUN
FIRST_CLUSTER_LOCK_PV /dev/disk/disk28
NODE_NAME hp2
NETWORK_INTERFACE lan2
HEARTBEAT_IP 10.1.0.122
NETWORK_INTERFACE lan1
NETWORK_INTERFACE lan0
HEARTBEAT_IP 222.3.25.122
# CLUSTER_LOCK_LUN
FIRST_CLUSTER_LOCK_PV /dev/disk/disk28
****************************************************
VOLUME_GROUP /dev/vglock #HA模式需要,RAC模式不需要。
VOLUME_GROUP /dev/vgora
****************************************************
OPS_VOLUME_GROUP /dev/vgdata # RAC模式,不需要加lockvg。
****************************************************
NODE_TIMEOUT 6000000 #修改NODE_TIMEOUT为6s。
其他参数采用默认值。
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
4.3
# cmcheckconf -v -C /etc/cmcluster/cmcluster.ascii
vgchange -a y /dev/lockvg
vgchange -a y /dev/datavg
cmapplyconf -v -C /etc/cmcluster/cmcluster.ascii
将卷组datavg去激活:
#vgchange -a n datavg
启/停双机并设置卷组信息:
#cmruncl
#cmviewcl -v
#vgchange -S y -c y datavg
#vgchange -a s datavg
#remsh hp2 /usr/sbin/vgchange -a s datavg
通过在每个节点上vgdisplay -v datavg进行查看,可见每个卷组datavg卷都为激活状态。
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
5.建第一个包pkg_ora1:
mkdir /etc/cmcluster/pkg_ora1
cmmakepkg -p /etc/cmcluster/pkg_ora1/pkg_ora1.conf
# vi /etc/cmcluster/pkg_ora1/pkg_ora1.conf
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
PACKAGE_NAME pkg_ora1
NODE_NAME hpdb1 #只加节点1.
RUN_SCRIPT /etc/cmcluster/pkg_ora1/pkg_ora1.cntl
HALT_SCRIPT /etc/cmcluster/pkg_ora1/pkg_ora1.cntl
MONITORED_SUBNET 222.3.25.0 #11.31版本中代替SUBNET。
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
# cmmakepkg -s /etc/cmcluster/pkg_ora1/pkg_ora1.cntl
# vi /etc/cmcluster/pkg_ora1/pkg_ora1.cntl
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
****************************************
VGCHANGE="vgchange -a s" # RAC模式
****************************************
VG[0]="datavg" #需要激活的包,lockvg不需要添加。
#LV[0]=/dev/vgora/lvoradata; FS[0]=/oradata;FS_MOUNT_OPT[0]=""; FS_UMOUNT_OPT[0]=""; FS_FSCK_OPT[0]="" #HA模式需要。
#IP[0]="222.3.25.123" # RAC模式不用设IP
#SUBNET[0]="222.3.25.0"
function customer_defined_run_cmds
{
# ADD customer defined run commands.
: # do nothing instruction, because a function must contain some command.
test_return 51
}
# This function is a place holder for customer define functions.
# You should define all actions you want to happen here, after the service is
# halted.
function customer_defined_halt_cmds
{
# ADD customer defined halt commands.
: # do nothing instruction, because a function must contain some command.
test_return 52
}
# END OF CUSTOMER DEFINED FUNCTIONS
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
# chmod +x /etc/cmcluster/pkg_ora1/pkg_ora1.cntl
# chmod 700 /etc/cmcluster/pkg_ora1
在备机上
# mkdir /etc/cmcluster/pkg_ora1
# chmod 700 /etc/cmcluster/pkg_ora1
回主机上
# rcp /etc/cmcluster/pkg_ora1/pkg_ora1.cntl hp2:/etc/cmcluster/pkg_ora1/
# cmcheckconf -C /etc/cmcluster/cmcluster.ascii
# cmcheckconf -P /etc/cmcluster/pkg_ora1/pkg_ora1.conf
# cmhaltcl -v -f
# cmapplyconf -v -C /etc/cmcluster/cmcluster.ascii -P /etc/cmcluster/pkg_ora1/pkg_ora1.conf
# cmruncl -v -f
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
6. 增加第二个包
# mkdir /etc/cmcluster/pkg_ora2
# cmmakepkg -p /etc/cmcluster/pkg_ora2/pkg_ora2.conf
# vi /etc/cmcluster/pkg_ora2/pkg_ora2.conf
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
PACKAGE_NAME pkg_ora2
NODE_NAME hpdb2 #只加节点2.
RUN_SCRIPT /etc/cmcluster/pkg_ora2/pkg_ora2.cntl
HALT_SCRIPT /etc/cmcluster/pkg_ora2/pkg_ora2.cntl
MONITORED_SUBNET 222.3.25.0
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
# cmmakepkg -s /etc/cmcluster/pkg_ora2/pkg_ora2.cntl
# vi /etc/cmcluster/pkg_ora2/pkg_ora2.cntl
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
VGCHANGE="vgchange -a s" # RAC模式
VG[0]="datavg" #需要激活的包,lockvg不需要添加。
#IP[0]="222.3.25.123" #HA模式需要,RAC模式不需要。
#SUBNET[0]="222.3.25.0" #HA模式需要,RAC模式不需要。
function customer_defined_run_cmds
{
# ADD customer defined run commands.
: # do nothing instruction, because a function must contain some command.
test_return 51
}
# This function is a place holder for customer define functions.
# You should define all actions you want to happen here, after the service is
# halted.
function customer_defined_halt_cmds
{
# ADD customer defined halt commands.
: # do nothing instruction, because a function must contain some command.
test_return 52
}
# END OF CUSTOMER DEFINED FUNCTIONS
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
# chmod +x /etc/cmcluster/pkg_ora2/pkg_ora2.cntl
# chmod 700 /etc/cmcluster/pkg_ora2
在备机上
# mkdir /etc/cmcluster/pkg_ora2
# chmod 700 /etc/cmcluster/pkg_ora2
回主机上
# rcp /etc/cmcluster/pkg_ora2/pkg_ora2.cntl hp2:/etc/cmcluster/pkg_ora2
# cmcheckconf -P /etc/cmcluster/pkg_ora2/pkg_ora2.conf
# cmapplyconf -v -P /etc/cmcluster/pkg_ora2/pkg_ora2.conf
# cmhaltcl -v -f
# cmruncl -v -f
/etc/rc.config.d/cmcluster中AUTOSTART_CMCLD=1自动启动MC,一般设为AUTOSTART_CMCLD=0。
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
7.安装CRS
需要用runInstaller –ignoreSysPrereqs跳过操作系统检查。
分别在两个节点运行下面脚本:
/oracle/oraInventory/orainstRoot.sh
然后分别在两个节点运行下面脚本:
/oracle/product/10.2.0/crs_1/root.sh
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
8.安装DB
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
9.打10.2.0.4补丁。
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
10.
创建VIP vipca
创建监听 netca
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
11.DBCA建库