ITPub博客

首页 > 数据库 > Oracle > 10gRAC安装-系统配置

10gRAC安装-系统配置

Oracle 作者:desert_xu 时间:2015-12-16 12:46:53 0 删除 编辑

环境说明
本次安装过程是在vmware workstation 9的基础上虚拟2台主机做的RAC测试
操作系统 RHEL5.7 32位
数据库 10.2.0.1
CRS 10.2.0.1

操作系统的配置
虚拟机配置
内存2G
磁盘60G
两块网卡,一块NET,一块hostonly
IP分配,NET 192.168.152.10        255.255.255.0
        hostonly 192.168.40.10        255.255.255.0

 

系统安装
本地磁盘划分
/boot        200M
/swap         4096M  #该空间为内存空间的2倍
其余磁盘使用lvm管理,vgname is rootvg
/            10240M
/s01        剩余全部磁盘空间

 

网络规划
节点1
public ip 192.168.152.11/255.255.255.0
private ip 192.168.40.11/255.255.255.0
vip 192.168.152.13
节点2
public ip 192.168.152.12/255.255.255.0
private ip 192.168.40.12/255.255.255.0
vip 192.168.152.14

关闭不需要的服务
chkconfig sendmail off
chkconfig cups off
chkconfig isdn off
chkconfig smartd off
chkconfig iptables off

安装虚拟机的vmware-tools工具,确保虚拟机时间与主机时间同步
./vmware-install.pl
然后一直回车,即可

检查并安装RAC所需的系统包
1)配置本地yum
mkdir -p /mnt/cdrom
mount /dev/hdc /mnt/cdrom
cd /etc/yum.repos.d/
vi rhel-debuginfo.repo
将baseurl修改为如下形式
baseurl=file:///mnt/cdrom/Server
enabled=1
保存,yum配置完成
2)检查以下系统包,如果没有使用yum安装。
使用rpm -q 包名 来检查系统包是否安装,使用yum install 包名,来安装所需的系统包
binutils-2.17.50.0.6
compat-libstdc++-33-3.2.3
elfutils-libelf-0.125
elfutils-libelf-devel-0.125
elfutils-libelf-devel-static-0.125
gcc-4.1.2
gcc-c++-4.1.2
glibc-2.5-24
glibc-common-2.5
glibc-devel-2.5
glibc-headers-2.5
kernel-headers-2.6.18
ksh-20060214
libaio-0.3.106
libaio-devel-0.3.106
libgcc-4.1.2
libgomp-4.1.2
libstdc++-4.1.2
libstdc++-devel-4.1.2
make-3.81
sysstat-7.0.2
ibgomp-4.1.1-52.el5.i386.rpm
libXp-1.0.0-8.i386.rpm
compat-gcc-34-3.4.6-4.i386rpm
compat-gcc-c++-34-3.4.6-4.i386rpm
compat-libstdc++-33-3.2.3-61.i386.rpm
unixODBC-2.2.11 (32-bit) or later
unixODBC-devel-2.2.11 (32-bit) or later
注意ibgomp和compat-gcc-c++-34没有安装包

创建相关的用户和组
[root@rac1 ~]# /usr/sbin/groupadd oinstall
[root@rac1 ~]# /usr/sbin/groupadd dba
[root@rac1 ~]# /usr/sbin/useradd -g oinstall -G dba oracle
[root@rac1 ~]#
[root@rac1 ~]# id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)

配置共享存储
1)创建共享磁盘
使用vmware-vdiskmanager.exe 命令来创建共享磁盘
C:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 600M -a lsilogic -t 2 F:\vmhome\sharedisk
\ocr.vmdk
C:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 600M -a lsilogic -t 2 F:\vmhome\sharedisk
\votedisk.vmdk
C:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 8192M -a lsilogic -t 2 F:\vmhome\sharedis
k\data1.vmdk
C:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 8192M -a lsilogic -t 2 F:\vmhome\sharedis
k\data2.vmdk
C:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 8192M -a lsilogic -t 2 F:\vmhome\sharedis
k\data3.vmdk
C:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 8192M -a lsilogic -t 2 F:\vmhome\sharedis
k\data4.vmdk

2)到虚拟机的相关路径目录,打开rac1.vmx , 在最后空白处添加这几段内容(一定要最后)
scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"
scsi1.sharedBus = "virtual"
-- 这段是打开 scsi1上的使用,并且设置成virtual, controller设置成lsilogic, 然后依次添加
scsi1:1.present = "TRUE"
scsi1:1.mode = "independent-persistent"
scsi1:1.filename = "F:\vmhome\sharedisk\ocr.vmdk"
scsi1:1.deviceType = "plainDisk"
scsi1:2.present = "TRUE"
scsi1:2.mode = "independent-persistent"
scsi1:2.filename = "F:\vmhome\sharedisk\votedisk.vmdk"
scsi1:2.deviceType = "plainDisk"
scsi1:3.present = "TRUE"
scsi1:3.mode = "independent-persistent"
scsi1:3.filename = "F:\vmhome\sharedisk\data1.vmdk"
scsi1:3.deviceType = "plainDisk"
scsi1:4.present = "TRUE"
scsi1:4.mode = "independent-persistent"
scsi1:4.filename = "F:\vmhome\sharedisk\data2.vmdk"
scsi1:4.deviceType = "plainDisk"
scsi1:5.present = "TRUE"
scsi1:5.mode = "independent-persistent"
scsi1:5.filename = "F:\vmhome\sharedisk\data3.vmdk"
scsi1:5.deviceType = "plainDisk"
scsi1:6.present = "TRUE"
scsi1:6.mode = "independent-persistent"
scsi1:6.filename = "F:\vmhome\sharedisk\data4.vmdk"
scsi1:6.deviceType = "plainDisk"
--最后添加这个,这段是对vmware使用共享硬盘的方式进行定义,必须添加
disk.locking = "false"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.DataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize = "4096"
diskLib.maxUnsyncedWrites = "0"

3)使用udev绑定共享存储
[root@rac1 ~]# fdisk -l

Disk /dev/sda: 64.4 GB, 64424509440 bytes
255 heads, 63 sectors/track, 7832 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          25      200781   83  Linux
/dev/sda2              26         547     4192965   82  Linux swap / Solaris
/dev/sda3             548        7832    58516762+  8e  Linux LVM

Disk /dev/sdb: 629 MB, 629145600 bytes
64 heads, 32 sectors/track, 600 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/sdc: 629 MB, 629145600 bytes
64 heads, 32 sectors/track, 600 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes

Disk /dev/sdc doesn't contain a valid partition table

Disk /dev/sdd: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdd doesn't contain a valid partition table

Disk /dev/sde: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sde doesn't contain a valid partition table

Disk /dev/sdf: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdf doesn't contain a valid partition table

Disk /dev/sdg: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdg doesn't contain a valid partition table

脚本
for i in b c d e f g;
do
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id -g -u -s %p\", RESULT==\"`scsi_id -g -u -s /block/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"oracle\", GROUP=\"oinstall\", MODE=\"0660\""
done

KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="36000c2963e5b57f8d31423979046356e", NAME="asm-diskb", OWNER="oracle", GROUP="oinstall", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="36000c2977bd806fafbe4c9dbd79e7e03", NAME="asm-diskc", OWNER="oracle", GROUP="oinstall", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="36000c2965b85a7a1b6f59eef8d33c563", NAME="asm-diskd", OWNER="oracle", GROUP="oinstall", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="36000c29ee9b530b8d8c04d8681eacde5", NAME="asm-diske", OWNER="oracle", GROUP="oinstall", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="36000c29811db03c1042d8633bd69bac4", NAME="asm-diskf", OWNER="oracle", GROUP="oinstall", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="36000c290cdb14a47be59f9b9a1250db2", NAME="asm-diskg", OWNER="oracle", GROUP="oinstall", MODE="0660"

[root@rac1 ~]#  cd /etc/udev/rules.d/
[root@rac1 rules.d]# vi 99-oracle-asmdisk.rules
将脚本输出结果拷贝进去

重启udev
[root@rac1 rules.d]# /sbin/udevcontrol reload_rules
[root@rac1 rules.d]# /sbin/start_udev
Starting udev:                                             [  OK  ]

检查
[root@rac1 rules.d]# ls -l /dev/asm*
brw-rw---- 1 oracle oinstall 8, 16 Feb 17 15:52 /dev/asm-diskb
brw-rw---- 1 oracle oinstall 8, 32 Feb 17 15:52 /dev/asm-diskc
brw-rw---- 1 oracle oinstall 8, 48 Feb 17 15:52 /dev/asm-diskd
brw-rw---- 1 oracle oinstall 8, 64 Feb 17 15:52 /dev/asm-diske
brw-rw---- 1 oracle oinstall 8, 80 Feb 17 15:52 /dev/asm-diskf
brw-rw---- 1 oracle oinstall 8, 96 Feb 17 15:52 /dev/asm-diskg

设置时间同步
[root@rac1 ~]# chkconfig time-stream on
在rac2节点添加时钟同步
[root@rac2 ~]# crontab -l
*/1 * * * * rdate -s 192.168.152.11

修改/etc/hosts文件
127.0.0.1 localhost
#public ip
192.168.152.11 rac1
192.168.152.12 rac2
#private ip
192.168.40.11 rac1-priv
192.168.40.12 rac2-priv
#vip
192.168.152.13 rac1-vip
192.168.152.14 rac2-vip

配置 hangcheck-timer 模块,2个节点都要执行
Hangcheck-timer 是Linux 提供的一个内核级的IO-Fencing 模块, 这个模块会监控Linux 内核运行状态, 如
果长时间挂起, 这个模块会自动重启系统。 这个模块在Linux 内核空间运行, 不会受系统负载的影响。 这个模块会
使用CPU的Time Stamp Counter(TSC) 寄存器,这个寄存器的值会在每个时钟周期自动增加, 因此使用的是硬件时间
,所以精度更高。
配置这个模块需要2个参数: hangcheck_tick 和 hangcheck_margin。
hangcheck_tick用于定义多长时间检查一次,缺省值是30秒。 有可能内核本身很忙, 导致这个检查被推迟, 该
模块还允许定义一个延迟上限,就是hangcheck_margin, 它的缺省值是180秒。
Hangcheck-timer 模块会根据hangcheck_tick 的设置,定时检查内核。只要2次检查的时间间隔小于 hangcheck
_tick + hangchec_margin, 都会认为内核运行正常,否则就意味着运行异常,这个模块会自动重启系统。
CRS本身还有一个MissCount 参数,可以通过crsctl get css miscount 命令查看。
当RAC结点间的心跳信息丢失时, Clusterware 必须确保在进行重构时,故障结点确实是Dead 状态,否则结点仅
是临时负载过高导致心跳丢失,然后其他结点开始重构,但是结点没有重启,这样会损坏数据库。 因此MissCount 必须
大于 hangcheck_tick+hangcheck_margin的和。
1) 查看模块位置:
[root@rac1 ~]# find /lib/modules -name "hangcheck-timer.ko"
/lib/modules/2.6.18-274.el5/kernel/drivers/char/hangcheck-timer.ko
2) 配置系统启动时自动加载模块,在/etc/rc.d/rc.local 中添加如下内容
[root@rac1 ~]# modprobe hangcheck-timer
[root@rac1 ~]# vi /etc/rc.d/rc.local
modprobe hangcheck-timer
3) 配置hangcheck-timer参数, 在/etc/modprobe.conf 中添加如下内容:
[root@rac1 ~]# vi /etc/modprobe.conf
options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180
4) 确认模块加载成功:
[root@rac1 ~]# grep Hangcheck /var/log/messages | tail -2
Feb 17 15:00:00 rac1 kernel: Hangcheck: starting hangcheck timer 0.9.0 (tick is 180 seconds, margin is 60 seconds).
Feb 17 15:00:00 rac1 kernel: Hangcheck: Using get_cycles().

建立用户的有效性
Rac1:
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
Rac2:
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
Rac1:
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys
Rac2:
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys rac1:~/.ssh/authorized_keys
等效性验证
date;ssh rac1 date

配置系统参数
vi /etc/sysctl.conf

kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144

vi /etc/security/limits.conf
oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  1024
oracle              hard    nofile  65536

vi /etc/pam.d/login
session    required     /lib/security/pam_limits.so
session    required     pam_limits.so

vi /etc/profile
if [ $USER = "oracle" ]; then
        if [ $SHELL = "/bin/ksh" ]; then
              ulimit -p 16384
              ulimit -n 65536
        else
              ulimit -u 16384 -n 65536
        fi
fi

建立相关安装路径
[root@rac2 ~]# mkdir -p /s01/app/oracle
[root@rac2 ~]# mkdir -p /s01/crs
[root@rac2 ~]# chown -R oracle:oinstall /s01

配置环境变量
export ORACLE_BASE=/s01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export CRS_HOME=/s01/crs
export ORACLE_SID=rac1

export PATH=$ORACLE_HOME/bin:$CRS_HOME/bin:$PATH

export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS10=$ORACLE_HOME/nls/data
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21980353/viewspace-1873214/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-10-23

  • 博文量
    79
  • 访问量
    241161