ITPub博客

首页 > 数据库 > Oracle > oracle 11G RAC 建立详细过程

oracle 11G RAC 建立详细过程

Oracle 作者:yhj20041128001 时间:2014-12-28 21:31:52 0 删除 编辑
虚拟机设置硬盘如下:

 注意: 在磁盘外面添加共享磁盘 需要配置比例1:1:1 ,1:2,1:3 设置
 然后在RAC2 上添加磁盘为 已经选择存在虚拟磁盘主机增加三个空间4/4/12G 进入系统显示为dev/sdb sdc sdd  通过fdisk -l查找
然后进行分区
文件修改 txt 打开rac1.vmx 和rac2.vmx  增加
disk.locking="false"
scsi1.sharedBus="virtual"

以下文档测试环境如下:
vmware workstation 9.0
linux 5.5 redhat 64bit
oracle 11g R2  64bit

1,设置网络环境(各节点配置)
[root@rac1 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1        localhost.localdomain localhost
#::1            localhost6.localdomain6 localhost6

#public
192.168.1.61     rac1
192.168.1.62     rac2
#vip
192.168.1.161   rac1-vip
192.168.1.162   rac2-vip
#priv
9.9.9.61    rac1-priv
9.9.9.61    rac2-priv

#scan
192.168.1.65     rac-scan

2,添加组和用户 (各节点配置)
[root@rac3 /]# groupadd -g 501 dba
[root@rac3 /]# useradd -u 500 -g dba oracle
[root@rac3 /]# useradd -u 502 -g dba grid

[root@rac3 ~]# passwd oracle
[root@rac3 ~]# passwd grid

配置相关路径 (各节点配置)
[root@rac3 ~]# cd /
[root@rac3 /]# mkdir u01
[root@rac3 /]# mkdir -p /u01/app/grid
[root@rac3 /]# mkdir -p /u01/app/11.2.0/grid
[root@rac3 /]# mkdir -p /u01/app/oracle
[root@rac3 /]# chown -R grid:dba /u01
[root@rac3 /]# chown -R oracle:dba /u01/app/oracle
[root@rac3 /]# chmod 775 /u01

3,ASMLib套件安装
  查询OS版本 并下载ASMLib
 [root@rac3 ~]# cat /etc/redhat-release
 Red Hat Enterprise Linux Server release 5.5 (Tikanga)
 [root@rac3 ~]# uname -a
 Linux rac3 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

 

[root@rac3 ~]# 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@rac3 ~]# rpm -ivh oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm
warning: oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing...                ########################################### [100%]
   1:oracleasm-2.6.18-194.el########################################### [100%]
[root@rac3 ~]# 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@rac2 ~]# /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 without typing an
answer will keep that current value.  Ctrl-C will abort.

Default user to own the driver interface []: grid
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  ]

 注意: 在磁盘外面添加共享磁盘 需要配置比例1:1:1 ,1:2,1:3 设置
 然后在RAC2 上添加磁盘为 已经选择存在虚拟磁盘主机增加三个空间4/4/12G 进入系统显示为dev/sdb sdc sdd  通过fdisk -l查找
然后进行分区

注意点:节点2要显示出来,需要重启动系统

系统启动后 设置自动加载 ASMLib相关设置
[root@rac2 ~]# vi /etc/inittab
id:5:initdefault:
[root@rac2 rc5.d]# cd /etc/rc5.d/ 
[root@rac2 rc5.d]# ln -s /etc/init.d/oracleasm S99oracleasm
[root@rac2 rc5.d]# ln -s /etc/init.d/oracleasm K01oracleasm

3 配置ASM磁盘


[root@rac2 ~]# fdisk  /dev/sdb
 n->p->1,2,3,4->+4096M->w
 [root@rac2 ~]# fdisk -l

Disk /dev/sda: 42.9 GB, 42949672960 bytes
255 heads, 63 sectors/track, 5221 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        5221    41833260   8e  Linux LVM

Disk /dev/sdb: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         522     4192933+  83  Linux

Disk /dev/sdc: 4294 MB, 4294967296 bytes
255 heads, 63 sectors/track, 522 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1         522     4192933+  83  Linux

Disk /dev/sdd: 12.8 GB, 12884901888 bytes
255 heads, 63 sectors/track, 1566 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1        1566    12578863+  83  Linux


[root@rac2 ~]# /etc/init.d/oracleasm createdisk ASM1 /dev/sdb1
Marking disk "ASM1" as an ASM disk:                        [  OK  ]
[root@rac2 ~]# /etc/init.d/oracleasm createdisk ASM2 /dev/sdc1
Marking disk "ASM2" as an ASM disk:                        [  OK  ]
[root@rac2 ~]# /etc/init.d/oracleasm createdisk ASM3 /dev/sdd1
Marking disk "ASM3" as an ASM disk:                        [  OK  ]

[root@rac2 ~]# /etc/init.d//oracleasm scandisks

[root@rac2 ~]# /etc/init.d//oracleasm listdisks
ASM1
ASM2
ASM3

4,配置 RAC2 和RAC3 操作系统互相信任
 grid 用户
 两台机子运行
[grid@rac2 ~]$ mkdir ~/.ssh
[grid@rac2 ~]$ chmod 755 ~/.ssh
[grid@rac2 ~]$ ssh-keygen -t rsa
[grid@rac2 ~]$ ssh-keygen -t dsa
使用Grid 帐号在RAC2 产生授权KEY
[grid@rac2 ~]$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[grid@rac2 ~]$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
[grid@rac2 ~]$ ssh rac1 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
grid@rac3's password:
[grid@rac2 ~]$ ssh rac1 cat  ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
grid@rac3's password:
[grid@rac2 ~]$ scp  ~/.ssh/authorized_keys rac1:~/.ssh/authorized_keys
grid@rac3's password:
authorized_keys                               100% 1980     1.9KB/s   00:00

注意一:记得chmod 755 /home/grid 两个节点权限一样。

注意二:解压Grid infrastructure 在 /home/grid/grid目录  执行认出共享磁盘

[grid@rac2 grid]$  ./runcluvfy.sh stage -pre crsinst -n rac1,rac2 -fixup -verbose
 
[grid@rac3 grid]$  ./runcluvfy.sh stage -pre crsinst -n rac2,rac3 -fixup -verbose

对时间

[root@rac1 client]# /u01/app/11.2.0/grid/root.sh
[root@rac2 oracle]# date
2013年 10月 19日 星期六 16:44:34 CST
[root@rac2 oracle]# hwclock
2013年10月19日 星期六 16时44分50秒  -0.870728 seconds
[root@rac2 oracle]# clock --systohc
[root@rac2 oracle]# hwclock

grid@rac2 grid]$  ./runcluvfy.sh stage -pre crsinst -n rac2,rac3 -fixup -verbose

结果:"ntpd" 的活动性检查失败
PRVF-5415 : 检查以确定 NTP 守护程序是否运行失败
结果:使用网络时间协议 (NTP) 进行时钟同步检查失败
gird时间同步所需要的设置(11gR2新增检查项)

#Network Time Protocol Setting
/sbin/service ntpd stop
chkconfig ntpd off

mv /etc/ntp.conf to /etc/ntp.conf.org
rm /etc/ntp.conf

  CTSS时间同步服务配置
11gR2版本中,Oracle推出了自己的时间同步服务,这只是在一个RAC的所有节点中有效,与其他系统的时间并不同步。如果要使用CTSS同步时间,除了要停止、禁止自动重启NTP服务外,/etc/ntp.conf配置文件也不允许存在,执行以下的步骤清除NTP服务。
(1)停止NTP服务
/sbin/service ntpd stop
(2)禁用NTP服务器自启动
chkconfig ntpd off
(3)删除或重命名NTP配置文件
rm /etc/ntp.conf
或者:
mv /etc/ntp.conf /etc/ntp.conf.bak
这样就彻底清除了NTP,在安装Grid Infrastructure的时候会自动创建CTSS。

注意三, 使用 CVU 验证硬件和操作系统设置
[grid@rac2 grid]$./runcluvfy.sh stage -post hwos -n rac2,rac3 -verbose

5 安装Grid infrastructure
 编辑 grid 下的.bash_profile文件
[grid@rac2 ~]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
TMP=/tmp;export TMP
TMPDIR=$TMP;export TMPDIR
ORACLE_HOSTNAME=rac1; export ORACLE_HOSTNAME
ORACLE_BASE=/u01/app/grid; export ORACLE_BASE
ORACLE_HOME=/u01/app/11.2.0/grid; export ORACLE_HOME
#ORACLE_PATH=/u01/app/oracle/common/oracle/sql; export ORACLE_PATH
ORACLE_SID=+ASM1; export ORACLE_SID
ORACLE_UNQNAME=ractx; export ORACLE_UNQNAME
ORACLE_TERM=xterm; export ORACLE_TERM
PATH=/user/bin:$PATH;export PATH
PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/bin;export LD_LIBARRY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;export CLASSPATH

if [ $user="oracle" ];then
  if [ $SHELL="bin/ksh" ];then
    ulimit -p 16384
    ulimit -n 65536
  else
    ulimit -u 16384 -n 65536
  fi
fi

[grid@rac2 ~]$ source .bash_profile ~~使生效
 安装时候 注意:
  1,grid 执行安装报错
 Xlib: connection to ":0.0" refused by server
 Xlib: No protocol specified
 Error: Can't open display: :0.0
 解决办法:用root登陆,在#提示符后输入:
 xhost local:grid non-network local connections being added to access control list

  1,安装类型选择”高级“
  2,网格即插即用 SCAN 名称 ”rac-scan" 输入/etc/hosts 配置的scan名称
  3,  输入数据库密码时候,需要点提示 more 然后再输入 Boxwei3590

 验证CRS状态
 [grid@rac1 ~]$ crsctl check crs
 CRS-4638: Oracle High Availability Services is online
 CRS-4537: Cluster Ready Services is online
 CRS-4529: Cluster Synchronization Services is online
 CRS-4533: Event Manager is online
确认集群所有节点
[grid@rac1 ~]$ olsnodes -n
rac1    1
rac2    2
确认集群各项资源和服务
[grid@rac2 ~]$ crs_stat -t -v
确认集群的监听状态
[grid@rac1 ~]$ srvctl status listener
监听程序 LISTENER 已启用
监听程序 LISTENER 正在节点上运行: rac1,rac2

确认ASM 在各节点运行状态
[grid@rac1 ~]$ srvctl status asm -a
ASM 正在 rac1,rac2 上运行
ASM 已启用。

确认OCR 注册状态
[grid@rac1 ~]$ ocrcheck
Status of Oracle Cluster Registry is as follows :

确认Voting Disk 的状态
[grid@rac2 ~]$ crsctl query css votedisk
##  STATE    File Universal Id                File Name Disk group
--  -----    -----------------                --------- ---------
 1. ONLINE   5f4f2506461f4f21bfbd25696cd8bbd8 (ORCL:ASM1) [CRS]
Located 1 voting disk(s).

设置ASM
grid@rac1 ~]$ asmca


6 安装 数据库软件
 配置环境变量
[oracle@rac1 ~]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

ORACLE_HOSTNAME=rac1;export ORACLE_HOSTNAME
ORACLE_BASE=/u01/app/oracle;export ORACLE_BASE
ORACLE_HOME=/u01/app/oracle/11.2.0;export ORACLE_HOME
ORACLE_SID=RACDB1;export ORACLE_SID
ORACLE_UNQNAME=RACDB;export ORACLE_UNQNAME
ORACLE_TERM=xterm;export ORACLE_TERM
PATTH=/usr/sbin:$PATH;export PATH
PATH=$ORACLE_HOME/bin:$PATH;export PATH

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/23757700/viewspace-1383075/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2010-09-17

  • 博文量
    162
  • 访问量
    355787