Linux redhat5.5安装Oracle 11g RAC + ASM + RAW 准备工作

提示
linux 磁盘最好是用lvm的方式管理
内存 1.5G以上
交换空间 3G以上
/tmp 目录2GB以上
安装Grid Infrastracture所需空间:8GB
安装Oracle Database所需空间:4GB
注:本文只讲解安装前的配置,具体的图形化安装教程网上很多,如果linux未安装图形界面,可以使用xmanager安装

查看内存及Swap大小的命令如下。
[root@rac1 ~]# grep MemTotal /proc/meminfo
[root@rac1 ~]# grep SwapTotal /proc/meminfo

创建共享磁盘
D:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 5
00Mb -a lsilogic -t 2 "G:\Virtual Machines\Share Disks"\sharedisk01.vmdk
D:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 5
00Mb -a lsilogic -t 2 "G:\Virtual Machines\Share Disks"\sharedisk02.vmdk
D:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 4
Gb -a lsilogic -t 2 "G:\Virtual Machines\Share Disks"\sharedisk03.vmdk
D:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -c -s 4
Gb -a lsilogic -t 2 "G:\Virtual Machines\Share Disks"\sharedisk04.vmdk

附加共享磁盘到虚拟机
disk.locking = "false"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.dataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize = "4096"
diskLib.maxUnsyncedWrites = "0"
scsi1.present = "TRUE"
scsi1.sharedBus = "virtual"
scsi1.virtualDev = "lsilogic"
scsi1:1.deviceType = "disk"
scsi1:1.fileName = "G:\Virtual Machines\Share Disks\sharedisk01.vmdk"
scsi1:1.mode = "independent-persistent"
scsi1:1.present = "TRUE"
scsi1:1.redo = ""
scsi1:2.deviceType = "disk"
scsi1:2.fileName = "G:\Virtual Machines\Share Disks\sharedisk02.vmdk"
scsi1:2.mode = "independent-persistent"
scsi1:2.present = "TRUE"
scsi1:2.redo = ""
scsi1:3.deviceType = "disk"
scsi1:3.fileName = "G:\Virtual Machines\Share Disks\sharedisk03.vmdk"
scsi1:3.mode = "independent-persistent"
scsi1:3.present = "TRUE"
scsi1:3.redo = ""
scsi1:4.deviceType = "disk"
scsi1:4.fileName = "G:\Virtual Machines\Share Disks\sharedisk04.vmdk"
scsi1:4.mode = "independent-persistent"
scsi1:4.present = "TRUE"
scsi1:4.redo = ""

给附加磁盘建立分区表 (n,p,1,回车,回车,w)
[root@rac1 ~]# fdisk /dev/sdb
[root@rac1 ~]# fdisk /dev/sdc
[root@rac1 ~]# fdisk /dev/sdd
[root@rac1 ~]# fdisk /dev/sde

格式化新建分区
[root@rac1 ~]# mkfs -t ext3 /dev/sdb1
[root@rac1 ~]# mkfs -t ext3 /dev/sdc1
[root@rac1 ~]# mkfs -t ext3 /dev/sdd1
[root@rac1 ~]# mkfs -t ext3 /dev/sde1

在每一个节点上添加安装Oracle Grid的用户、组和家目录,并设置权限。
[root@rac1 ~]# groupadd oinstall
[root@rac1 ~]# groupadd asmadmin
[root@rac1 ~]# groupadd asmdba
[root@rac1 ~]# groupadd asmoper
[root@rac1 ~]# groupadd dba
[root@rac1 ~]# groupadd oper
[root@rac1 ~]# useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
[root@rac1 ~]# useradd -g oinstall -G dba,asmdba,oper oracle
[root@rac1 ~]# mkdir -p /usr/app/11.2.0/grid
[root@rac1 ~]# mkdir -p /usr/app/grid
[root@rac1 ~]# chown -R grid:oinstall /usr/app
[root@rac1 ~]# mkdir /usr/app/oracle
[root@rac1 ~]# chown oracle:oinstall /usr/app/oracle
[root@rac1 ~]# chmod -R 775 /usr/app
[root@rac1 ~]# passwd grid
[root@rac1 ~]# passwd oracle

设置环境变量
[grid@rac1 ~]$ vi ~/.bash_profile
export ORACLE_BASE=/usr/app/grid
export ORACLE_HOME=/usr/app/11.2.0/grid
export ORACLE_SID=+ASM1 (rac2上为+ASM2)
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
[grid@rac1 ~]$ source ~/.bash_profile

[oracle@rac1 ~]$ vi ~/.bash_profile
export ORACLE_BASE=/usr/app/oracle
export ORACLE_HOME=/usr/app/oracle/product/11.2.0/db_1
export ORACLE_SID=racdb1 (rac2上为racdb2)
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
[oracle@rac2 ~]$ source ~/.bash_profile

修改/etc/sysctl.conf的内容
[root@rac1 ~]# vi /etc/sysctl.conf
fs.file-max = 6815744
fs.aio-max-nr = 1048576
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 536870912
kernel.shmall = 2097152
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128

[root@rac1 ~]# sysctl -p

修改/etc/hosts的内容
[root@rac1 ~]# vi /etc/hosts
192.168.244.131 rac1
192.168.244.132 rac2
192.168.244.231 rac1-vip
192.168.244.232 rac2-vip
192.168.93.121 rac1-priv
192.168.93.122 rac2-priv
192.168.244.31 rac-scan
192.168.244.32 rac-scan
192.168.244.33 rac-scan

使用yum源安装依赖包
[root@rac1 ~]# yum -y install binutils-*
[root@rac1 ~]# yum -y install compat-lib*
[root@rac1 ~]# yum -y install gcc-*
[root@rac1 ~]# yum -y install glibc-*
[root@rac1 ~]# yum -y install libgcc-*
[root@rac1 ~]# yum -y install libstdc++*
[root@rac1 ~]# yum -y install libaio-*
[root@rac1 ~]# yum -y install make-*
[root@rac1 ~]# yum -y install sysstat-*
[root@rac1 ~]# yum -y install unixODBC*
[root@rac1 ~]# yum -y install elfutils-*

关闭NTPOracle(建议使用Oracle Cluster Time Synchronization Service,因此关闭删除NTP)
[root@rac1 ~]# /sbin/service ntpd stop
[root@rac1 ~]# chkconfig ntpd off
[root@rac1 ~]# rm /etc/ntp.conf
[root@rac1 ~]# rm /var/run/ntpd.pid

设置oracle使用的文件数权限
[root@rac1 ~]# vi /etc/security/limits.conf
oracle           soft      nproc           2047
oracle           hard     nproc           16384
oracle           soft      nofile           1024
oracle           hard     nofile           65536
grid              hard     nproc           16384
grid              hard     nofile            65536

修改安全限制
[root@rac1 ~]# vi /etc/pam.d/login
session    required     /lib/security/pam_limits.so

配置裸设备
[root@rac1 ~]# vi /etc/udev/rules.d/60-raw.rules
ACTION=="add", KERNEL=="/dev/sdb1", RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="17", RUN+="/bin/raw /dev/raw/raw1 %M %m"
ACTION=="add", KERNEL=="/dev/sdc1", RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="33", RUN+="/bin/raw /dev/raw/raw2 %M %m"
ACTION=="add", KERNEL=="/dev/sdd1", RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="49", RUN+="/bin/raw /dev/raw/raw3 %M %m"
ACTION=="add", KERNEL=="/dev/sde1", RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="65", RUN+="/bin/raw /dev/raw/raw4 %M %m"
KERNEL=="raw[1-4]", OWNER="oracle", GROUP="oinstall", MODE="640"
[root@rac1 ~]# start_udev

配置SSH互信(grid和oracle都要配置)
[root@rac1 ~]# su - grid
[grid@rac1~]$ mkdir ~/.ssh
[grid@rac1~]$ chmod 700 ~/.ssh
[grid@rac1~]$ ssh-keygen -t rsa
[grid@rac1~]$ ssh-keygen -t dsa

[grid@rac2~]$ mkdir ~/.ssh
[grid@rac2~]$ chmod 700 ~/.ssh
[grid@rac2~]$ ssh-keygen -t rsa
[grid@rac2~]$ ssh-keygen -t dsa

[grid@rac1~]$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[grid@rac1~]$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

[grid@rac1~]$ ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[grid@rac1~]$ ssh rac2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
[grid@rac1~]$ scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys

[grid@rac1~]$ ssh rac1 date
[grid@rac1~]$ ssh rac2 date
[grid@rac1~]$ ssh rac1-priv date
[grid@rac1~]$ ssh rac2-priv date

[grid@rac2~]$ ssh rac1 date
[grid@rac2~]$ ssh rac2 date
[grid@rac2~]$ ssh rac1-priv date
[grid@rac2~]$ ssh rac2-priv date

安装oracleasmlib程序包
oracleasm-support-2.1.8-1.el5.x86_64.rpm
oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm
oracleasmlib-2.0.4-1.el5.x86_64.rpm

配置ASM
[root@rac1 ~]# /etc/init.d/oracleasm configure -i (grid asadmin y y)
[root@rac1 ~]# /etc/init.d/oracleasm createdisk DATA1 /dev/sdb1
[root@rac1 ~]# /etc/init.d/oracleasm createdisk DATA2 /dev/sdc1
[root@rac1 ~]# /etc/init.d/oracleasm createdisk DATA3 /dev/sdd1
[root@rac1 ~]# /etc/init.d/oracleasm createdisk DATA4 /dev/sde1
[root@rac1 ~]# /etc/init.d/oracleasm scandisks
[root@rac1 ~]# /etc/init.d/oracleasm listdisks
[root@rac2 ~]# /etc/init.d/oracleasm scandisks
[root@rac2 ~]# /etc/init.d/oracleasm listdisks

使用CVU检查各个节点的配置工作(grid为linux_11gR2_grid.zip解压后的目录)
[grid@rac1 grid]$ ./runcluvfy.sh stage -pre crsinst -n rac1,rac2 -fixup -verbose

你可能感兴趣的:(Linux redhat5.5安装Oracle 11g RAC + ASM + RAW 准备工作)