1.创建账户
在所有节点上创建所需账户
#groupadd �Cg 500 dba
#useradd -u 1001 -g oinstall -G dba oracle
#password oracle
nobody用户一般操作系统安装往后就存在,如果没有必须创建,该用户在安装完clusterware或RAC后执行一些扩展任务(extjob)
#id nobody
uid=99(nobody) gid=99(nobody) groups=99(nobody)
2.创建目录
在所有节点上创建所需目录并赋予对应权限
#mkdir �Cp /home/oracle/orabase
#mkdir �Cp /home/oracle/orahome/product/10.2.0/db_1
#mkdir �Cp /home/oracle/orahome/product/10.2.0/crs
#mkdir �Cp /home/oracle/orahome/product/10.2.0/asm
#cd /home/oracle
#chmod �CR 775 *
3、设置三个节点/etc/hosts文件内容相同,如下:
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.12.241 jason1
192.168.12.242 jason2
192.168.12.193 jason3
10.10.10.241 jason1-priv
10.10.10.242 jason2-priv
10.10.10.193 jason3-priv
192.168.12.243 jason1-vip
192.168.12.244 jason2-vip
192.168.12.194 jason3-vip
4、配置ssh认证
节点jason3上执行如下操作
[oracle@jason3 ~]$ mkdir .ssh
[oracle@jason3 ~]$ chmod 700 .ssh
[oracle@jason3 ~]$ cd .ssh
[oracle@jason3 .ssh]$ 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:
a5:dd:4b:79:b7:74:0a:b4:e2:26:36:98:f5:de:95:99 oracle@jason3
[oracle@jason3 .ssh]$ 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:
b2:b8:bd:61:9c:c7:f2:ae:eb:99:36:dd:b5:fd:0a:9e oracle@jason3
节点jason1同步authorized_keys到jason2、jason3
[oracle@jason1 .ssh]$ ssh jason3 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
oracle@jason3's password:
[oracle@jason1 .ssh]$ scp authorized_keys jason2:/home/oracle/.ssh/
authorized_keys 100% 2990 2.9KB/s 00:00 100% 2990 2.9KB/s 00:00
[oracle@jason1 .ssh]$ scp authorized_keys jason3:/home/oracle/.ssh/
authorized_keys 100% 2990 2.9KB/s 00:00
[oracle@jason1 .ssh]$
在三个节点分别执行下列命令,确保jason1、jason2、jason3三个节点彼此互通,无需输入密码。
ssh jason1 date
ssh jason2 date
ssh jason3 date
ssh jason1-priv date
ssh jason2-privdate
ssh jason3-priv date
如节点jason1上执行如下:
[oracle@jason1 admin]$ cd
[oracle@jason1 ~]$ ssh jason1 date
Wed Dec 11 17:47:30 CST 2013
[oracle@jason1 ~]$ ssh jason1-priv date
Wed Dec 11 17:47:34 CST 2013
[oracle@jason1 ~]$ ssh jason2 date
Wed Dec 11 17:47:38 CST 2013
[oracle@jason1 ~]$ ssh jason2-priv date
Wed Dec 11 17:47:42 CST 2013
[oracle@jason1 ~]$ ssh jason3 date
Wed Dec 11 17:47:45 CST 2013
[oracle@jason1 ~]$ ssh jason3-priv date
Wed Dec 11 17:47:49 CST 2013
[oracle@jason1 ~]$
5、建立hangcheck模块加载
在所有节点上检测是否安装了hangcheck模块。
[root@jason3 ~]# find /lib/modules -name "hangcheck-timer.ko"
/lib/modules/2.6.18-238.el5/kernel/drivers/char/hangcheck-timer.ko
方法1:设置模块为自动加载
echo“options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180”>> /etc/modprobe.conf
echo “modprobe hangcheck” >> /etc/rc.local
方法2:在/etc/rc.local增加以下内容:
[root@jason3 ~]# insmod /lib/modules/2.6.18-238.el5/kernel/drivers/char/hangcheck-timer.ko hangcheck_tick=30 hangcheck_margin=180
检测模块是否运行
[root@jason3 ~]# lsmod |grep hangcheck
hangcheck_timer 37465 0
6.配置内核参数
在所有节点编辑sysctl.conf文件,添加如下内容:
#vi /etc/sysctl.conf
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
fs.file-max = 101365
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
要使配置立即生效,执行sysctl �Cp
7.设置Shell对Oracle用户的限制
在每个节点上执行相同的操作,编辑/etc/security/limits.conf,添加如下内容:
#For Oracle
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft memlock 3145728
oracle hard memlock 3145728
编辑/etc/pam.d/login,添加如下内容:
#For Oracle
session required /lib/security/pam_limits.so
8.配置用户资源限制
在每个节点上执行相同的操作,编辑/etc/profile增加以下内容:
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
9.安装配置ASM
[root@jason3 mnt]# rpm -ivh oracleasm-support-2.1.8-1.el5.x86_64.rpm
warning: oracleasm-support-2.1.8-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:oracleasm-support ########################################### [100%]
[root@jason3 mnt]# rpm -ivh oracleasm-2.6.18-238.el5-2.0.5-1.el5.x86_64.rpm
warning: oracleasm-2.6.18-238.el5-2.0.5-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:oracleasm-2.6.18-238.el########################################### [100%]
[root@jason3 mnt]# rpm -ivh oracleasmlib-2.0.4-1.el5.x86_64.rpm
warning: oracleasmlib-2.0.4-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:oracleasmlib ########################################### [100%]
[root@jason3 mnt]# /etc/init.d/oracleasm configure
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting <ENTER> without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: oracle
Default group to own the driver interface []: dba
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
Initializing the Oracle ASMLib driver: [ OK ]
Scanning the system for Oracle ASMLib disks: [ OK ]
[root@jason3 mnt]# cd /etc/init.d/
[root@jason3 init.d]# oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
[root@jason3 init.d]# oracleasm listdisks
VOL1
VOL2
VOL3
[root@jason3 init.d]#