RHEL 4 上安装配置 Oracle 10g RAC
转载请注明文章转载自:Dbabc.Net [http://dbabc.net]
本文链接:http://dbabc.net/archives/2011/01/28/oracle10g-rac-on-linux-x64.shtml
Oracle10g RAC Configuration for Linux x86_64bit
目录
一、安装前的准备工作… 2
1.1安装Linux. 2
1.2配置/etc/hosts. 2
1.3Disable SELinux. 2
1.4分区 3
1.5创建组和用户… 4
1.6环境变量配置以及软件包的检查… 6
1.7 ssh配置… 8
1.7.1所有节点创建.ssh目录… 8
1.7.2 生成密钥对… 8
1.7.3所有节点查看相关信息… 9
1.7.4密钥分发… 10
1.7.5测试ssh. 11
二、OCFS的安装及配置… 11
2.1安装 OCFS. 11
2.2格式化分区为OCFS2格式… 12
2.3配置集群节点… 14
2.4配置o2cb. 17
三、ClusterWare 安装… 18
四、Oracle10g 软件安装… 35
六、监听配置以及RAC测试… 48
6.1修改Node1的tnsnames.ora文件… 48
6.2修改Node2的tnsnames.ora文件… 49
6.3修改参数local_listener. 50
6.4重新启动所有实例及监听器… 50
6.5.客户端tnsname.ora设置… 51
6.6.测试RAC.. 51
七、RAC重启命令… 52
八、附:卸载ClusterWare. 52
一、安装前的准备工作
1.1安装Linux
安装过程略,首先确定所安装Linux的版本。 本案例的Linux Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
![clip_image002[12]](http://god.dbabc.net/dbabc.net/img/c51b88e7ccdd_12312/clip_image00212.jpg)
1.2配置/etc/hosts
注:此操作需要在每个个节点都要操作 [root@node1 ~]# vi /etc/hosts
![clip_image004[5]](http://god.dbabc.net/dbabc.net/img/c51b88e7ccdd_12312/clip_image0045.jpg)
注:每个节点都需要一个唯一的公共和专用网际协议 (Internet Protocol, IP) 地址,以及一个附加公共 IP 地址,该附加公共 IP 地址作为客户端连接和连接故障转移的虚拟 IP 地址。虚拟 IP地址必须与公共 IP 属于同一个子网。Hostname 最好用小写 (多个PUBLIC NIC 的时候最好只用一个, hosts 这里我们暂时保留)
1.3Disable SELinux
注:此操作需要在每个个节点都要操作 永久性Disable SELinux: [root@node1 ~]# vi /etc/grub.conf
![clip_image006[5]](http://god.dbabc.net/dbabc.net/img/c51b88e7ccdd_12312/clip_image0065.jpg)
此处需要注意:在grub.conf中
title Red Hat Enterprise Linux AS (2.6.9-42.ELsmp) root (hd0,0) kernel /vmlinuz-2.6.9-42.ELsmp ro root=LABEL=/ rhgb quiet selinux=0 initrd /initrd-2.6.9-42.ELsmp.img title Red Hat Enterprise Linux AS-up (2.6.9-42.EL) root (hd0,0) kernel /vmlinuz-2.6.9-42.EL ro root=LABEL=/ rhgb quiet selinux=0 initrd /initrd-2.6.9-42.EL.imgLinux
其中Linux的版本2.6.9-42.ELsmp 中的ELsmp 表示Red Hat Linux kernel that supports symmetric multiprocessing (multiple processor machines) <—- 对称多处理器机器。2.6.9-42.EL 中的EL表示 Red Hat Linux kernel for uniprocessor machines <—- 支持单处理器机器。 为了安全起见最好将这两个都添加上selinux=0。 重启机子使得selinux 生效。
1.4分区
在分区之前需要安装Powerpath软件。 插入Powerpath 软件光盘 进入光盘的目录 cd /media/cdrom/LINUX/2.6/pp5.0.x/rhel 找到EMCpower.LINUX-5.0.0-157.rhel.x86_64.rpm使用以下命令进行安装
rpm -ivh EMCpower.LINUX-5.0.0-157.rhel.x86_64.rpm emcpreg -install 输入 *24位序列号
安装完毕之后重启机子,重启之后通过powermt display dev=all检查是否安装成功。
![clip_image008[5]](http://god.dbabc.net/dbabc.net/img/c51b88e7ccdd_12312/clip_image0085.jpg)
然后进行分区操作 [root@node1~]#fdisk /dev/emcpowera1
![clip_image010[5]](http://god.dbabc.net/dbabc.net/img/c51b88e7ccdd_12312/clip_image0105.jpg)
其它分区一样 /ocfs_data /ocfs_index /ocfs_log
1.5创建组和用户
注:此操作需要在每个个节点都要操作
[root@node1 ~]# groupadd oinstall [root@node1 ~]# groupadd -g 500 dba [root@node1 ~]# groupadd -g 501 oinstall [root@node1 ~]# useradd -u 500 -g dba -G oinstall oracle [root@node1 ~]# 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.
注:dba是Primary Group Oracle环境变量的设置: 修改oracle用户下的.bash_profile 在.bash_profile 下添加如下信息
if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi # Set Oracle Environment ORACLE_HOME=/u01/product/oracle;export ORACLE_HOME ORACLE_SID=racsid1;export ORACLE_SID ORACLE_OWNER=oracle;export ORACLE_OWNER ORACLE_BASE=/u01/product;export ORACLE_BASE ORACLE_TERM=vt100;export ORACLE_TERM LD_LIBRARY_PATH=$ORACLE_HOME/lib;export LD_LIBRARY_PATH set -u PS1=`hostname`'<$PWD>$';export PS1 EDITOR=/bin/vi; export EDITOR JAVA_HOME=/usr/local/java;export JAVA_HOME ORA_NLS33=/u01/product/oracle/ocommon/nls/admin/data;export ORA_NLS33 CLASSPATH=/u01/product/oracle/jdbc/lib/classesl11.zip:/usr/local/java; export DISPLAY=127.0.0.1:0.0 export LD_ASSUME_KERNEL=2.6.9 PATH=$ORACLE_HOME/bin:$JAVA_HOME/bin:$PATH:/u01/product/crs/bin:.;export PATH cat .bash_profile
![clip_image012[5]](http://god.dbabc.net/dbabc.net/img/c51b88e7ccdd_12312/clip_image0125.jpg)
1.6环境变量配置以及软件包的检查
注:此操作需要在每个个节点都要操作 确定以下软件包必须安装,检查是否安装软件包的命令#rpm -qa|grep compat 如果有没安装的软件请执行 #rpm –ivh xxxx 安装软件包 或者:
rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE} (%{ARCH})\n' \binutils compat-db compat-libstdc++-296 control-center gcc gcc-c++ glibc glibc-common gnome-libs libstdc++ libstdc++-devel make pdksh sysstat xscreensaver setarch
binutils-2.15.92.0.2-21 compat-db-4.1.25-9 control-center-2.8.0-12.rhel4.5 gcc-3.4.6-3 gcc-c++-3.4.6-3 glibc-2.3.4-2.25 glibc-common-2.3.4-2.25 gnome-libs-1.4.1.2.90-44.1 libstdc++-3.4.6-3 libstdc++-3.4.6-3 make-3.80-6.EL4 pdksh-5.2.14-30.3 sysstat-5.0.5-11.rhel4 xscreensaver-4.18-5.rhel4.11 libaio-0.3.105-2 libaio-devel-0.3.105-2
授权
#chown –R oracle.dba /u01 #chmod 755 /u01 #chown –R oracle.dba /ocfs_data #chmod 755 /ocfs_data
修改内核参数 Vi /etc/sysctl.conf,增加以下各行
kernel.shmall = 2097152 kernel.shmmax = 4294967296 # kernel.sem = 250 32000 100 128 fs.file-max = 65536 net.ipv4.ip_local_port_range = 1024 65000 net.core.rmem_default = 262144 net.core.rmem_max = 262144 net.core.wmem_default = 262144 net.core.wmem_max = 262144
修改后运行sysctl -p 命令使得内核改变立即生效 设置/etc/security/limits.conf,
#vi /etc/security/limits.conf
加入:
oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536
修改/etc/pam.d/login 添加
Session required pam_limits.so
1.7 ssh配置
1.7.1所有节点创建.ssh目录
Node1 node1</home/oracle>$pwd /home/oracle node1</home/oracle>$mkdir .ssh node1</home/oracle>$chmod 700 .ssh node1</home/oracle>$ Node2 node2</home/oracle>$pwd /home/oracle node2</home/oracle>$mkdir .ssh node2</home/oracle>$chmod 700 .ssh node2</home/oracle>$
1.7.2 生成密钥对
Node1 node1</home/oracle>$ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/oracle/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/oracle/.ssh/id_rsa. Your public key has been saved in /home/oracle/.ssh/id_rsa.pub. The key fingerprint is: d8:9c:2d:2f:01:45:e7:43:5b:8f:9c:de:26:39:bf:e0 oracle@node1 node1</home/oracle>$ node1</home/oracle>$ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/home/oracle/.ssh/id_dsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/oracle/.ssh/id_dsa. Your public key has been saved in /home/oracle/.ssh/id_dsa.pub. The key fingerprint is: 17:70:f5:02:ab:ce:e5:d9:79:b6:1e:d4:ff:65:33:8b oracle@node1 Node2 node2</home/oracle>$ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/oracle/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/oracle/.ssh/id_rsa. Your public key has been saved in /home/oracle/.ssh/id_rsa.pub. The key fingerprint is: b7:6b:33:7c:04:ea:d5:43:bc:6c:1d:b1:3c:b3:a5:59 oracle@node2 node2</home/oracle>$ node2</home/oracle>$ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/home/oracle/.ssh/id_dsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/oracle/.ssh/id_dsa. Your public key has been saved in /home/oracle/.ssh/id_dsa.pub. The key fingerprint is: ae:0a:a7:a7:4c:d3:50:3f:7e:e8:11:8e:53:ea:97:47 oracle@node2
1.7.3所有节点查看相关信息
Node1 node1</home/oracle/.ssh>$pwd /home/oracle/.ssh node1</home/oracle/.ssh>$ls –alh total 24K drwx------ 2 oracle dba 4.0K Nov 3 10:34 . drwx------ 23 oracle dba 4.0K Nov 3 10:30 .. -rw------- 1 oracle dba 668 Nov 3 10:34 id_dsa -rw-r--r-- 1 oracle dba 602 Nov 3 10:34 id_dsa.pub -rw------- 1 oracle dba 887 Nov 3 10:33 id_rsa -rw-r--r-- 1 oracle dba 222 Nov 3 10:33 id_rsa.pub Node2 node2</home/oracle/.ssh>$pwd /home/oracle/.ssh node2</home/oracle/.ssh>$ls –alh total 24K drwx------ 2 oracle dba 4.0K Nov 3 10:45 . drwx------ 20 oracle dba 4.0K Nov 3 10:31 .. -rw------- 1 oracle dba 672 Nov 3 10:45 id_dsa -rw-r--r-- 1 oracle dba 602 Nov 3 10:45 id_dsa.pub -rw------- 1 oracle dba 887 Nov 3 10:45 id_rsa -rw-r--r-- 1 oracle dba 222 Nov 3 10:45 id_rsa.pub
1.7.4密钥分发
Node1 node1</home/oracle/.ssh>$ssh node1 cat /home/oracle/.ssh/id_rsa.pub >>authorized_keys The authenticity of host 'node1 (192.168.0.25)' can't be established. RSA key fingerprint is f8:93:51:cd:af:ee:81:a0:f6:eb:b5:14:58:f2:a5:0a. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node1,192.168.0.25' (RSA) to the list of known hosts. oracle@node1's password: node1</home/oracle/.ssh>$ssh node1 cat /home/oracle/.ssh/id_dsa.pub >>authorized_keys node1</home/oracle/.ssh>$ssh node2 cat /home/oracle/.ssh/id_rsa.pub >>authorized_keys The authenticity of host 'node2 (192.168.0.26)' can't be established. RSA key fingerprint is 30:84:8c:43:58:a3:0a:8d:07:49:d3:4c:51:37:18:91. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'node2,192.168.0.26' (RSA) to the list of known hosts. oracle@node2's password: node1</home/oracle/.ssh>$ssh node2 cat /home/oracle/.ssh/id_dsa.pub >>authorized_keys oracle@node2's password: node1</home/oracle/.ssh>$ node1</home/oracle/.ssh>$scp authorized_keys node2:/home/oracle/.ssh oracle@node2's password: authorized_keys 100% 1648 1.6KB/s 00:00 Node2 node2</home/oracle/.ssh>$ls –alh total 28K drwx------ 2 oracle dba 4.0K Nov 3 11:08 . drwx------ 20 oracle dba 4.0K Nov 3 10:31 .. -rw-r--r-- 1 oracle dba 1.7K Nov 3 11:08 authorized_keys -rw------- 1 oracle dba 672 Nov 3 10:45 id_dsa -rw-r--r-- 1 oracle dba 602 Nov 3 10:45 id_dsa.pub -rw------- 1 oracle dba 887 Nov 3 10:45 id_rsa -rw-r--r-- 1 oracle dba 222 Nov 3 10:45 id_rsa.pub node2</home/oracle/.ssh>$chmod 600 authorized_keys
1.7.5测试ssh
在node1上:
node1</home/oracle/.ssh>$ssh node2 date Mon Nov 3 11:12:12 CST 2008
同样在node2上:
node2</home/oracle>$ssh node1 date Tue Nov 4 14:05:56 CST 2008
不需要输入密码说明配置ssh OK