一、 安装linux系统
1、 集群安装环境
? OS : Centos6.5 x86_64 ? Oracle: Oracle 11g 11.3.0 ? Grid:
Oracle 11g
2、 系统安装要求
? ? ? ? ? ?
搭建双节点集群,需两台服务器,主机名分别为rac1和rac2 内存大小按需
两个网卡,一个作为公有网络,一个作为私有网络。 提前规划好IP地址(公网IP,私网IP,VIP和scan ip)。 系统盘、/u01、ASM数据盘,请按需规划
由于资源有限,没有光纤存储设备,使用ISCIS软件实现共享存储,利用其中一个节点的本地磁盘作为共享盘
二、 系统配置
注意:以下操作需要在两个节点中完成,文档只演示rac1!
1、 编辑/etc/hosts,添加需要的IP地址
[root@rac1 ~]# vi /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.77.13 rac1 192.168.77.14 rac2
10.0.0.13 rac1-priv 10.0.0.14 rac2-priv
192.168.77.17 rac1-vip 192.168.77.18 rac2-vip
192.168.77.19 rac-scan --注意不要用下划线
2、 编辑/etc/sysctl.conf,修改内核参数
(1)修改内核参数,--标红部分只需修改原来的参数值,其他的则需在文件后面添加。 [root@rac1 ~]# vi /etc/sysctl.conf
# Controls the maximum shared segment size, in bytes kernel.shmmax = 4398046511104
# Controls the maximum number of shared memory segments, in pages kernel.shmall = 4294967296 fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmmni = 4096
kernel.sem = 250 32000 100 142
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
(2)使内核参数生效 [root@rac1 ~]# sysctl -p 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.bridge.bridge-nf-call-ip6tables = 0 net.bridge.bridge-nf-call-iptables = 0 net.bridge.bridge-nf-call-arptables = 0 kernel.msgmnb = 65536 kernel.msgmax = 65536
kernel.shmmax = 4398046511104 kernel.shmall = 4294967296 fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmmni = 4096
kernel.sem = 250 32000 100 142
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
3、 建立需要的用户和组
[root@rac1 ~]# vi mkuser.sh groupadd -g 200 oinstall groupadd -g 201 dba groupadd -g 202 oper
groupadd -g 203 asmadmin groupadd -g 204 asmoper groupadd -g 205 asmdba
useradd -u 200 -g oinstall -G dba,asmdba,oper oracle
useradd -u 201 -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid [root@rac1 ~]# sh mkuser.sh [root@rac1 ~]# id oracle
uid=200(oracle) gid=200(oinstall) groups=200(oinstall),201(dba),202(oper),205(asmdba) [root@rac1 ~]# id grid uid=201(grid) gid=200(oinstall) groups=200(oinstall),201(dba),202(oper),203(asmadmin),204(asmoper),205(asmdba) [root@rac1 ~]# passwd oracle [root@rac1 ~]# passwd grid
4、 修改用户的shell限制
[root@rac1 ~]# vi /etc/security/limits.conf
--以下是新添内容:
oracle soft nproc oracle hard nproc oracle soft nofile oracle hard nofile oracle soft stack grid soft nproc grid hard nproc grid soft nofile grid hard nofile grid soft stack
[root@rac1 ~]# vi /etc/pam.d/login
--以下是新添内容:
session required /lib/security/pam_limits.so
[root@rac1~]# vi /etc/profile --以下是新添内容:
if [ $USER = \ if [ $SHELL = \ ulimit -p 16384 ulimit -n 65536 else
ulimit -u 16384 -n 65536 fi fi
[root@rac1 ~]# source /etc/profile
5、 配置用户环境变量
(1)配置oracle用户环境变量
2047
16384 1024 65536 10240 2047 16384 1024 65536 10240 [root@rac1 ~]# su – oracle
[oracle@rac1 ~]$ vi .bash_profile --以下是新添内容: export EDITOR=vi
export ORACLE_SID=prod1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin umask 0022
(2)配置grid用户环境变量 [oracle@rac1 ~]$ su - grid
[grid@rac1 ~]$ vi .bash_profile
--以下是新添内容: export EDITOR=vi
export ORACLE_SID=+ASM1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 export GRID_HOME=/u01/grid
export LD_LIBRARY_PATH=$ORACLE_HOME/lib export THREADS_FLAG=native export PATH=$GRID_HOME /bin :$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin umask 0022
6、 对数据库磁盘进行分区
(1)查看磁盘
[root@rac1 ~]# fdisk -l
Disk /dev/vda: 107.4 GB, 107374182400 bytes –系统盘 16 heads, 63 sectors/track, 208050 cylinders Units = cylinders of 1008 * 512 = 516096 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00036309
Disk /dev/sda: 32.2 GB, 32212254720 bytes –数据库盘 255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000
Disk /dev/sdb: 107.4 GB, 107374182400 bytes—共享盘
255 heads, 63 sectors/track, 13054 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0xb4bdbd7d
(2)对数据库磁盘/dev/sda进行分区,创建文件系统/u01 [root@rac1 ~]# fdisk /dev/sda
[root@rac1 ~]# mkfs -t ext4 /dev/sda1 [root@rac1 ~]# mkdir /u01
[root@rac1 ~]# mount /dev/sda1 /u01 [root@rac1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_lyz1-LogVol00 20G 9.9G 8.5G 54% /
tmpfs 2.0G 72K 2.0G 1% /dev/shm /dev/vda1 194M 35M 149M 19% /boot /dev/sda1 30G 172M 28G 1% /u01 [root@rac1 ~]# vi /etc/fstab --添加以下内容
/dev/sda1 /u01 ext4 defaults 0 2 [root@rac1 ~]# umount /u01 [root@rac1 ~]# mount /u01
7、 检查内存需求
(1)物理内存大小至少1300M,虚拟内存大小,一般为物理内存的1.5-2倍 [root@rac1 ~]# free -m
total used free shared buffers cached
Mem: 3959 372 3587 0 49 127 -/+ buffers/cache: 195 3763 Swap: 8191 0 8191
8、 检查磁盘空间需求
(1)查看临时文件系统大小,至少需要1G。 [root@rac1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on /dev/mapper/vg_lyz1-LogVol00 20G 9.9G 8.5G 54% /
tmpfs 2.0G 72K 2.0G 1% /dev/shm /dev/vda1 194M 35M 149M 19% /boot /dev/sda1 30G 172M 28G 1% /u01
9、 创建需要的目录,并修改所有者和权限
[root@rac1 ~]# vi mkdir.sh
mkdir -p /u01/app/oraInventory
chown -R grid:oinstall /u01/app/oraInventory/ chmod -R 775 /u01/app/oraInventory/