RedHat5.5+Openfiler2.9+Oracle11gR2 RAC+ASM
RedHat5.5+Openfiler2.9+Oracle11gR2 RAC+ASM
作者 阿九【转载时请务必以超链接形式标明文章原始出处和作者信息】
一、硬件环境
3台 DELL T410塔式服务器
共享存储
其中一台安装openfiler系统,作为共享存储使用。
二、软件环境
操作系统:
RedHat 5.5
数据库:
Oracle11gR2
存储环境:
openfiler2.9
三、安装目录规划
grid用户:
ORACLE_BASE=/u01/app/base
ORACLE_HOME=/u01/app/grid
oracle用户
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/db11g
ASM实例SID:+ASM1 \ +ASM2
集群数据库:rac1 \ rac2
集群UNIQUE_NAME:rac
四、IP地址规划
公网IP: | IP地址 |
节点1: | 192.168.4.210 |
节点2: | 192.168.4.220 |
私有网络: |
|
节点1: | 172.10.10.10 |
节点2: | 172.10.10.20 |
VIP: |
|
节点1: | 192.168.4.101 |
节点2: | 192.168.4.102 |
SCAN: | 192.168.4.103 |
共享存储: | 192.168.4.230 |
五、配置openfiler共享存储
openfiler安装及磁盘配置,请参照文档《51CTO下载-Openfiler2.3.pdf》
六、在linux上配置共享存储
6.1、安装iscsi包
[root@rac1 ~]# rpm -Uvh iscsi-initiator-utils-6.2.0.871-0.10.el5.x86_64.rpm warning: iscsi-initiator-utils-6.2.0.871-0.10.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID e8562897 Preparing... ########################################### [100%] 1:iscsi-initiator-utils ########################################### [100%] |
6.2、配置iscsi服务启动
[root@rac1 ~]# service iscsid start [ OK ]off network shutdown. Starting iSCSI daemon: [ OK ] [ OK ] [root@centos ~]# chkconfig iscsid on [root@centos ~]# chkconfig iscsi on |
6.3、查找网络上可用的iscsi磁盘
[root@rac01 vsftpd]# iscsiadm -m discovery -t sendtargets -p 192.168.4.230 192.168.4.230:3260,1 iqn.2006-01.com.openfiler:tsn.bd8633ac148e [root@rac01 vsftpd]# |
6.4、手动添加设备到本地
[root@rac02 by-path]# fdisk -l
Disk /dev/sda: 499.5 GB, 499558383616 bytes 255 heads, 63 sectors/track, 60734 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 26121 209712510 83 Linux /dev/sda3 26122 26643 4192965 82 Linux swap / Solaris
[root@rac02 by-path]#
[root@centos ~]# iscsiadm -m node -T iqn.2006-01.com.openfiler:tsn.bd8633ac148e -p 192.168.4.230 -l Logging in to [iface: default, target: iqn.2006-01.com.openfiler:tsn.bd8633ac148e, portal: 192.168.4.230,3260] Login to [iface: default, target: iqn.2006-01.com.openfiler:tsn.bd8633ac148e, portal: 192.168.4.230,3260] successful.
[root@rac02 by-path]# fdisk -l
Disk /dev/sda: 499.5 GB, 499558383616 bytes 255 heads, 63 sectors/track, 60734 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 26121 209712510 83 Linux /dev/sda3 26122 26643 4192965 82 Linux swap / Solaris
Disk /dev/sdb: 204.9 GB, 204950470656 bytes 255 heads, 63 sectors/track, 24917 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table [root@rac02 by-path]# |
至此、openfiler共享存储配置完毕。
七、Oracle安装前配置
7.1、检查所需软件包
以root用户登录,在两节点上执行如下操作
在RedHat5.5上安装Oracle11gR2需要如下软件包
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
numactl-devel-0.9.8.i386
sysstat-7.0.2
unixODBC-2.2.11-7.1.i386.rpm
unixODBC-devel-2.2.11-7.1.i386.rpm
执行命令rpm –qa 来查看软件包是否安装
[root@rac01 ~]# rpm -qa binutils* compat-libstdc* elfutils-libelf* elfutils-libelf-devel* elfutils-libelf-devel-static* gcc* gcc-c++* glibc* glibc-common* glibc-devel* glibc-headers* kernel-headers* ksh* libaio* libaio-devel* libgcc* libgomp* libstdc++* libstdc++-devel* make* numactl-devel* sysstat* elfutils-libelf-0.137-3.el5 numactl-devel-0.9.8-11.el5 glibc-2.5-49 compat-libstdc++-33-3.2.3-61 glibc-devel-2.5-49 elfutils-libelf-devel-static-0.137-3.el5 gcc44-4.4.0-6.el5 libgcc-4.1.2-48.el5 compat-libstdc++-296-2.96-138 glibc-headers-2.5-49 gcc-c++-4.1.2-48.el5 elfutils-libelf-devel-0.137-3.el5 gcc-gnat-4.1.2-48.el5 glibc-common-2.5-49 binutils-2.17.50.0.6-14.el5 libstdc++-devel-4.1.2-48.el5 libstdc++44-devel-4.4.0-6.el5 gcc44-gfortran-4.4.0-6.el5 sysstat-7.0.2-3.el5 kernel-headers-2.6.18-194.el5 make-3.81-3.el5 libaio-0.3.106-5 ksh-20100202-1.el5 libgomp-4.4.0-6.el5 gcc-4.1.2-48.el5 gcc44-c++-4.4.0-6.el5 libstdc++-4.1.2-48.el5 gcc-gfortran-4.1.2-48.el5 gcc-java-4.1.2-48.el5 gcc-objc-4.1.2-48.el5 libaio-devel-0.3.106-5 [root@rac01 ~]# |
如果没有软件包,则在安装CD中找到安装
挂载光驱的命令为:mount -o ro /dev/cdrom /mnt/cdrom
[root@rac01 by-path]# mount -o ro /dev/cdrom /mnt/cdrom [root@rac01 by-path]# |
安装rpm软件包
[root@rac01 Server]# rpm -Uvh sysstat-7.0.2-3.el5.i386.rpm warning: sysstat-7.0.2-3.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing... ########################################### [100%] 1:sysstat ########################################### [100%] [root@rac01 Server]# |
7.2、更改网络UDP和TCP的临时端口的其实范围(非必须)
以root用户登录,在两节点上执行
[root@rac02 by-path]# cat /proc/sys/net/ipv4/ip_local_port_range 32768 61000 [root@rac02 by-path]# echo 9000 65500 > /proc/sys/net/ipv4/ip_local_port_range [root@rac02 by-path]# cat /proc/sys/net/ipv4/ip_local_port_range 9000 65500 [root@rac02 by-path]# |
7.3、创建操作系统用户组及用户
以root用户登录,在两节点上执行
创建用户组
[root@rac01 Server]# groupadd -g 501 oinstall [root@rac01 Server]# groupadd -g 502 dba |
创建grid用户
[root@rac01 Server]# useradd -u 8001 -g oinstall -G dba grid [root@rac01 Server]# passwd grid Changing password for user grid. New UNIX password: BAD PASSWORD: it is based on a dictionary word Retype new UNIX password: passwd: all authentication tokens updated successfully. [root@rac01 ~]# |
创建oracle用户
[root@rac01 Server]# useradd -u 501 -g oinstall -G dba oracle [root@rac02 Server]# passwd oracle Changing password for user oracle. New UNIX password: BAD PASSWORD: it is based on a dictionary word Retype new UNIX password: passwd: all authentication tokens updated successfully. [root@rac02 Server]# |
7.4、提高grid及oracle用户的shell权限
以root用户登录,在两节点上的 /etc/security/limits.conf、/etc/pam.d/login和 /etc/profile文件中添加如下内容:
/etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
/etc/pam.d/login
session required /lib/security/pam_limits.so
/etc/profile
if [ $USER = "oracle" ] || [ $USER = "grid" ] ; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
7.5、配置host文件
以root用户登录,在两节点上执行
[root@rac01 ~]# cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 rac01 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6 [root@rac01 ~]# |
修改host文件添加入下内容
######### public ######## 192.168.4.210 rac01 192.168.4.220 rac02
######### private ######## 172.10.10.10 rac01-priv 172.10.10.20 rac02-priv
######### public ######## 192.168.4.101 rac01-vip 192.168.4.102 rac02-vip
######### scan ######## 192.168.4.103 rac-scan |
修改后的文件为:
[root@rac01 ~]# cat /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 rac01 localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6
######### public ######## 192.168.4.210 rac01 192.168.4.220 rac02
######### private ######## 172.10.10.10 rac01-priv 172.10.10.20 rac02-priv
######### public ######## 192.168.4.101 rac01-vip 192.168.4.102 rac02-vip
######### scan ######## 192.168.4.103 rac-scan [root@rac01 ~]# |
7.6、修改内核参数
以root用户登录,在两节点上执行
在/etc/sysctl.conf
文件中添加如下内容
fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 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 = 1048586 |
执行命令/sbin/sysctl -p使修改立即生效
7.7、配置用户等效性
grid
在两节点上执行如下命令:
[grid@rac01 ~]$ mkdir ~/.ssh [grid@rac01 ~]$ chmod 700 ~/.ssh [grid@rac01 ~]$ ssh-keygen -t rsa ssh-keygen -t dsaGenerating public/private rsa key pair. Enter file in which to save the key (/home/grid/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in ssh-keygen -t dsa. Your public key has been saved in ssh-keygen -t dsa.pub. The key fingerprint is: 11:d2:c0:13:d6:e0:50:40:0e:98:41:1c:be:3c:8e:61 grid@rac01 [grid@rac01 ~]$ [grid@rac01 ~]$ ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/home/grid/.ssh/id_dsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/grid/.ssh/id_dsa. Your public key has been saved in /home/grid/.ssh/id_dsa.pub. The key fingerprint is: 76:1d:67:f8:20:41:21:16:43:a8:ca:5a:ac:55:a2:c2 grid@rac01 [grid@rac01 ~]$ [grid@rac01 ~]$ |
在节点一上执行
[grid@rac01 .ssh]$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys [grid@rac01 .ssh]$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys [grid@rac01 .ssh]$ ssh rac02 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys The authenticity of host 'rac02 (192.168.4.220)' can't be established. RSA key fingerprint is f4:4c:d3:34:d8:3e:42:21:95:99:14:73:36:4a:75:a5. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'rac02,192.168.4.220' (RSA) to the list of known hosts. grid@rac02's password: [grid@rac01 .ssh]$ ssh rac02 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys grid@rac02's password: [grid@rac01 .ssh]$ scp ~/.ssh/authorized_keys rac02:~/.ssh/authorized_keys grid@rac02's password: authorized_keys 100% 1984 1.9KB/s 00:00 [grid@rac01 .ssh]$ |
在节点二上执行
[root@rac02 Server]# passwd oracle Changing password for user oracle. New UNIX password: BAD PASSWORD: it is based on a dictionary word Retype new UNIX password: passwd: all authentication tokens updated successfully. [root@rac02 Server]# su - grid [grid@rac02 ~]$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys [grid@rac02 ~]$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys [grid@rac02 ~]$ ssh rac01 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys The authenticity of host 'rac01 (192.168.4.210)' can't be established. RSA key fingerprint is d9:bc:92:0b:c2:3f:15:8e:10:fb:0e:a0:40:11:53:5a. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'rac01,192.168.4.210' (RSA) to the list of known hosts. [grid@rac02 ~]$ ssh rac01 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys [grid@rac02 ~]$ |
在两节点上执行如下命令
ssh rac01 date
ssh rac01-priv date
ssh rac02 date
ssh rac02-priv date
如果不要求输入密码则配置成功。
oracle
以oracle用户登录,重复以上操作
7.8、配置安装用户的环境变量
grid
以grid用户登录,在两节点上编辑 /home/grid/.bash_profile文件
节点一:
export ORACLE_SID=+ASM1 export ORACLE_BASE=/u01/app/base export ORACLE_HOME=/u01/app/grid export LD_LIBRARY_PATH=$ORACLE_HOME/lib export NLS_LANG='Simplified Chinese_China'.ZHS16GBK export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin |
节点二:
export ORACLE_SID=+ASM2 export ORACLE_BASE=/u01/app/base export ORACLE_HOME=/u01/app/grid export LD_LIBRARY_PATH=$ORACLE_HOME/lib export NLS_LANG='Simplified Chinese_China'.ZHS16GBK export PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin |
oracle
以oracle用户登录,在两节点上编辑 /home/oracle/.bash_profile文件
节点一:
export ORACLE_SID=rac1 export ORACLE_UNQNAME=rac export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/db11g export ORA_CRS_HOME=/u01/app/grid export LD_LIBRARY_PATH=$ORACLE_HOME/lib export NLS_LANG='Simplified Chinese_China'.ZHS16GBK export PATH=$ORA_CRS_HOME/bin:$ORACLE_HOME/bin:$PATH:$HOME/bin
umask 022 |
节点二:
export ORACLE_SID=rac2 export ORACLE_UNQNAME=rac export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/db11g export ORA_CRS_HOME=/u01/app/grid export LD_LIBRARY_PATH=$ORACLE_HOME/lib export NLS_LANG='Simplified Chinese_China'.ZHS16GBK export PATH=$ORA_CRS_HOME/bin:$ORACLE_HOME/bin:$PATH:$HOME/bin
umask 022 |
7.9、创建安装目录
以root用户登录,在两节点上执行如下命令
[root@rac02 Server]# mkdir -p /u01/app/grid [root@rac02 Server]# mkdir -p /u01/app/oracle [root@rac02 Server]# chown –R oracle:oinstall /u01 [root@rac02 Server]# chmod –R 775 /u01 [root@rac02 Server]# chown grid:oinstall /u01/app/grid |
7.10、配置ASM使用的磁盘
以root用户登录任一节点。
查看现有磁盘分区
[root@rac01 app]# fdisk -l
Disk /dev/sda: 499.5 GB, 499558383616 bytes 255 heads, 63 sectors/track, 60734 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 26121 209712510 83 Linux /dev/sda3 26122 26643 4192965 82 Linux swap / Solaris
Disk /dev/sdb: 204.9 GB, 204950470656 bytes 255 heads, 63 sectors/track, 24917 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/sdb doesn't contain a valid partition table [root@rac01 app]# |
对磁盘分区
[root@rac01 app]# fdisk /dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel Building a new DOS disklabel. Changes will remain in memory only, until you decide to write them. After that, of course, the previous content won't be recoverable.
The number of cylinders for this disk is set to 24917. There is nothing wrong with that, but this is larger than 1024, and could in certain setups cause problems with: 1) software that runs at boot time (e.g., old versions of LILO) 2) booting and partitioning software from other OSs (e.g., DOS FDISK, OS/2 FDISK) Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-24917, default 1): Using default value 1 Last cylinder or +size or +sizeM or +sizeK (1-24917, default 24917): Using default value 24917
Command (m for help): w The partition table has been altered!
Calling ioctl() to re-read partition table. Syncing disks. [root@rac01 app]# |
查看分区后的磁盘情况
[root@rac01 app]# fdisk -l
Disk /dev/sda: 499.5 GB, 499558383616 bytes
255 heads, 63 sectors/track, 60734 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 26121 209712510 83 Linux
/dev/sda3 26122 26643 4192965 82 Linux swap / Solaris
目录 返回
首页