1.安装系统前添加磁盘
(最少要3 个,一个做asm 盘,一个用来存储votingdisk,一个用来存储OCR)
注意****
创建时 选中 allocate all disk space now 提前分配空间
persistent 同步写数据
scsi 通道 跟系统盘不在一个上 如scsi 1:1
2.再添加一个网卡
网卡1 桥接 网卡2 仅主机
eth0 192.168.8.101 eth1 10.0.0.101
3.安装操作系统
4.配置linux环境
4.1 修改虚拟机配置(打开.vmx文件)
disk.locking = "false"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.DataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize = "4096"
diskLib.maxUnsyncedWrites = "0"
scsi1:1.deviceType = "disk"
scsi1:2.deviceType = "disk"
scsi1:3.deviceType = "disk"
scsi1:4.deviceType = "disk"
scsi1:1.shared = "true"
scsi1:2.shared = "true"
scsi1:3.shared = "true"
scsi1:4.shared = "true"
共享磁盘
scsi1.sharedBus = "VIRTUAL"( 把none修改成VIRTUAL)
4.2 编辑/etc/hosts
192.168.8.151 rac1
192.168.8.152 rac2
192.168.8.201 rac1-vip
192.168.8.202 rac2-vip
10.0.0.101 rac1-priv
10.0.0.102 rac2-priv
(8.201,202为指定的虚IP,供CRS 使用,不需要我们配置)
4.3 安装环境包
[root@rac1 ~]# yum -y install binutils compat-db control-center gcc* glibc libXp libstdc++ libstdc++-devel make openmotif sysstat
4.4 创建用户
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle
4.5 用户环境变量
[root@rac1 ~]# vi /home/oracle/.bash_profile
ORACLE_BASE=/oracle/app
ORACLE_HOME=$ORACLE_BASE/oracle/product/10.2.0/db_1
ORACLE_SID=RACDB1
PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
LANG=en_US.UTF-8
TMP=/tmp
TMPDIR=$TMP
ORACLE_TERM=xterm
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBRARY_PATH LANG TMP TMPDIR ORACLE_TERM CLASSPATH
export CRS_HOME=$ORACLE_BASE/oracle/product/10.2.0/db_2
export PATH=$CRS_HOME/bin:$ORACLE_HOME/bin:$PATH
ulimit -u 16384 -n 65536
umask 022
4.6 创建目录
[root@rac1 /]# mkdir -p /oracle/app
[root@rac1 /]# chmod -R 777 /oracle
[root@rac1 /]# chmod 777 /oracle/app
[root@rac1 /]# chown -R oracle.oinstall /oracle
4.7 root用户设置核心参数
vi /etc/sysctl.conf
kernel.shmall = 2097152
kernel.shmmax = 2147483648
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
vi /etc/redhat-release
Red Hat Enterprise Linux Server release 3 (Tikanga)
[root@rac1 /]# sysctl -p
4.8 oracle用户限制
[root@rac1 /]# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
[root@rac1 /]# vi /etc/pam.d/login
session required /lib/security/pam_limits.so
4.9 配置Hangcheck 计时器
[root@rac1 /]# vi /etc/rc.local
modprobe hangcheck-timer hangcheck-tick=30 hangcheck_margin=180
(Hangcheck-timer有三个配置参数:
hangcheck_tick:定义了hangcheck-timer检查节点是否hang的频率,单位是秒,缺省是60秒
hangcheck_margin:定义期望的和真正的scheduling之间允许的误差,单位是秒,缺省值是180秒
hangcheck_reboot:定义了如果内核在hangcheck-tick和hangcheck-margin相加的时间内响应失败的话,hangcheck-timer是否重启节点.)
检查hangcheck是否在运行
[root@rac1 /]# /sbin/lsmod | grep hangcheck
5 磁盘分区
[root@rac1 /]# fdisk /dev/sdb
"n/p/1/回车/回车/w"
重复执行sdc,sdd,sde
6.安装oracleasmlib 程序包
[root@rac1 asmlib11]# rpm -ivh oracleasm-support-2.1.7-1.el5.i386.rpm
[root@rac1 asmlib11]# rpm -ivh oracleasm-2.6.18-92.el5-2.0.5-1.el5.i686.rpm
[root@rac1 asmlib11]# rpm -ivh oracleasm-2.6.18-92.el5-debuginfo-2.0.5-1.el5.i686.rpm
[root@rac1 asmlib11]# rpm -ivh oracleasmlib-2.0.4-1.el5.i386.rpm
http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel5-084877.html
7.配置裸设备
[root@rac1 asmlib11]# vi /etc/udev/rules.d/60-raw.rules
ACTION=="add", KERNEL=="/dev/sdb1",RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="17",RUN+="/bin/raw /dev/raw/raw1 %M %m"
ACTION=="add", KERNEL=="/dev/sdc1",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="33",RUN+="/bin/raw /dev/raw/raw2 %M %m"
ACTION=="add", KERNEL=="/dev/sdd1",RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="49",RUN+="/bin/raw /dev/raw/raw3 %M %m"
ACTION=="add", KERNEL=="/dev/sde1",RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="65",RUN+="/bin/raw /dev/raw/raw4 %M %m"
KERNEL=="raw[1-4]", OWNER="oracle", GROUP="oinstall", MODE="640"
启动服务
[root@rac1 asmlib11]# start_udev
查看
[root@rac1 asmlib11]# ls /dev/raw/ -l
总计 0
crw-r----- 1 oracle oinstall 162, 1 04-25 03:48 raw1
crw-r----- 1 oracle oinstall 162, 2 04-25 03:48 raw2
crw-r----- 1 oracle oinstall 162, 3 04-25 03:48 raw3
crw-r----- 1 oracle oinstall 162, 4 04-25 03:48 raw4
8 配置第2个节点
同样的方式安装节点2
9.配置Clusterware安装环境
9.1 ntp
rac1(服务器)
[root@rac1 ~]# rpm -qa |grep ntp
[root@rac1 ~]# vi /etc/ntp.conf
# the administrative functions.
restrict default nomodify notrap noquery
restrict 10.0.0.0 mask 255.0.0.0 nomodify
restrict 192.168.8.0 mask 255.255.255.0 nomodify
restrict 127.0.0.1 mask 255.0.0.0
server 127.0.0.1 prefer(最优先)
[root@rac1 ~]# service ntpd restart
rac2(客户端)
[root@rac2 ~]# ntpdate 10.0.0.101 (服务器自身同步需要5分钟,耐心等待下)
25 Apr 23:06:45 ntpdate[6751]: step time server 10.0.0.101 offset -36357.170463 sec
rac 对节点间时间较敏感,因此如果此处显示节点单时间不一至,建议同
步(一般相隔超过20 秒就需要同步时间了)。
9.2 设置ssh
在clusterware (CRS) 和Rac Database 安装过程中,Oracle Universal Installer (OUI) 必须能够以oracle的身份自动将软件复制到所有RAC 节点。这里我们通过配置ssh 让oracle 用户拥有不输入密码即可访问各节点的能力。
确定两台能ping通
节点1:oracle 用户身份生成用户的公钥和私钥
[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ mkdir ~/.ssh
[oracle@rac1 ~]$ chmod 700 ~/.ssh
[oracle@rac1 ~]$ ssh-keygen -t rsa (默认回车)
[oracle@rac1 ~]$ ssh-keygen -t dsa (默认回车)
节点2:
[oracle@rac2 ~]$ su - oracle
[oracle@rac2 ~]$ mkdir ~/.ssh
[oracle@rac2 ~]$ chmod 700 ~/.ssh
[oracle@rac2 ~]$ ssh-keygen -t rsa
[oracle@rac2 ~]$ ssh-keygen -t dsa
节点1上:
[oracle@rac1 ~]$ cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
[oracle@rac1 ~]$ cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys
命令会提示你输入node2 的oracle 密码
[oracle@rac1 ~]$ ssh rac2 cat ~/.ssh/id_rsa.pub >>~/.ssh/authorized_keys
[oracle@rac1 ~]$ ssh rac2 cat ~/.ssh/id_dsa.pub >>~/.ssh/authorized_keys
[oracle@rac1 ~]$ scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys
两机相互执行,看看是否还需要输入密码
[oracle@rac1 ~]$ ssh rac1 date
[oracle@rac1 ~]$ ssh rac2 date
[oracle@rac2 ~]$ ssh rac1 date
[oracle@rac2 ~]$ ssh rac2 date
9.3 配置asm
节点1上:
[root@rac1 ~]# /etc/init.d/oracleasm configure
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 ]
节点2上:
[root@rac2 ~]# /etc/init.d/oracleasm configure
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 ]
节点1上:
[root@rac1 ~]# /etc/init.d/oracleasm createdisk VOL1 /dev/sdd1
Marking disk "VOL1" as an ASM disk: [ OK ]
[root@rac1 ~]# /etc/init.d/oracleasm createdisk VOL2 /dev/sde1
Marking disk "VOL2" as an ASM disk: [ OK ]
[root@rac1 ~]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]
查看当前磁盘组
[root@rac1 ~]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
节点2上:
也查看一下当前磁盘组
[root@rac2 ~]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]
[root@rac2 ~]# /etc/init.d/oracleasm listdisks
VOL1
VOL2
9.4 安装Clusterware
[root@rac1 ff]# cp oracle_10201_clusterware_linux32.zip /home/oracle/
[root@rac1 ff]# chmod 777 /home/oracle/oracle_10201_clusterware_linux32.zip
[root@rac1 ff]# su - oracle
[oracle@rac1 ~]$ unzip oracle_10201_clusterware_linux32.zip
图形安装
[oracle@rac1 ~]$ cd clusterware/
[oracle@rac1 clusterware]$ ./runInstaller
(如果出现乱码现象
执行 $ export LANG=en_US.UTF-8)
选择安装目录默认
选择crs 安装目录 默认
环境检查
指定节点(add 添加节点2 :rac2 rac2-priv rac2-vip)
网卡设置(指定eth0 为公共 edit-->public)
指定OCR存储位置
(选择 external redundancy
specify ocr location: /dev/raw/raw2)
voting disk 的存储位置
(选择 external redundancy
specify ocr location: /dev/raw/raw1)
安装信息 install(安装的同时会把文件复制到其它节点)
安装到最后 2个节点上分别以root用户 执行脚本
[root@rac1 ~]# cd /oracle/app/oraInventory/
[root@rac1 oraInventory]# ./orainstRoot.sh
[root@rac2 ~]# cd /oracle/app/oraInventory/
[root@rac2 oraInventory]# ./orainstRoot.sh
[root@rac1 oraInventory]# cd /oracle/app/oracle/product/10.2.0/db_1/
[root@rac1 db_1]# ./root.sh
[root@rac2 oraInventory]# cd /oracle/app/oracle/product/10.2.0/db_1/
[root@rac2 db_1]# ./root.sh
((如果节点2 遇到错误
/oracle/app/oracle/product/10.2.0/db_1/jdk/jre//bin/java: error while loading shared libraries: libpthread.so.0: cannot open shared object file: No such file or directory
解决办法:
[root@rac2 db_1]# vi /oracle/app/oracle/product/10.2.0/db_1/bin/vipca
找到
arch=`uname -m`
if [ "$arch" = "i686" -o "$arch" = "ia64" ]
then
LD_ASSUME_KERNEL=2.4.19
export LD_ASSUME_KERNEL
fi
#End workaround
在fi 后新添加一行:
unset LD_ASSUME_KERNEL
[root@rac2 db_1]# vi /oracle/app/oracle/product/10.2.0/db_1/bin/srvctl
找到如下内容:
LD_ASSUME_KERNEL=2.4.19
export LD_ASSUME_KERNEL
同样在其后新增加一行:
unset LD_ASSUME_KERNEL
重新执行./root.sh
如果重新执行 报CRS总是运行 删除cssfatal文件
[root@rac2 db_1]# rm -rf /etc/oracle/scls_scr/rac1/oracle/cssfatal
[root@rac2 db_1]# ./root.sh (成功)
))
((如果抱错
Error 0(Native: listNetInterfaces:[3])
[Error 0(Native: listNetInterfaces:[3])]
[root@rac2 db_1]# cd bin/
[root@rac2 bin]# ./oifcfg iflist
eth0 192.168.8.0
eth1 10.0.0.0
[root@rac2 bin]# ./oifcfg setif -global eth0/192.168.8.0:public
[root@rac2 bin]# ./oifcfg setif -global eth1/10.0.0.0:cluster_interconnect
[root@rac2 bin]# ./oifcfg getif
eth0 192.168.8.0 global public
eth1 10.0.0.0 global cluster_interconnect
rac2 图形界面
/oracle/app/oracle/product/10.2.0/db_1/bin/vipca
在 setp 2of2 步骤中 添加 rac1-vip rac2-vip
***如果安装时报crs-1006 crs-0215的错误
是节点上 回找网关设备 不能连接到你的网关地址,让节点2能ping通网关ip就可以
crs-0215 错误时,查看/etc/hosts 文件 要有127.0.0.1 rac1 localhost记录
))
脚本执行完成后 点击OK
安装完成 exit
检查环境
[root@rac1 ~]# /oracle/app/oracle/product/10.2.0/db_1/bin/crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip application ONLINE ONLINE rac1
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip application ONLINE ONLINE rac2
10.安装 database 软件
节点1:
[root@rac1 /]# mkdir /oracle1
[root@rac1 /]# chmod 777 /oracle1
[root@rac1 /]# chown -R oracle.oinstall /oracle1
[oracle@rac1 ~]$ unzip oracle_database_linux32.zip
[oracle@rac1 ~]$ cd database/
[oracle@rac1 database]$ ./runInstaller
欢迎画面
选择类型 (企业版)
选择安装目录 (前面安装使用了db_1 name: Oradb10g_home ,path: 改为 ..db_2)
选择安装节点 (两个都选)
环境监测
只安装数据库软件 install database software only
摘要信息
install
[root@rac1 ~]# cd /oracle/app/oracle/product/10.2.0/db_2/
[root@rac1 db_2]# ./root.sh
[root@rac2 /]# cd /oracle/app/oracle/product/10.2.0/db_2/
[root@rac2 db_2]# ./root.sh
安装完成 退出
11.创建数据库和ASM实例
vi /home/oracle/.bash_profile (改为ORACLE_HOME=$ORACLE_BASE/oracle/product/10.2.0/db_2)
重新应用 .bash_profile
[root@rac1 ~]#dbca
选择安装RAC 数据库(clusters database)
创建数据库(create a database)
全选节点(select all)
选择自定义数据库(custom database)
指定数据库标识(RACDB RACDB)
选择是否启动EM(我们不启动)
为管理员帐户设置密码
选择储存(选择第二项 ASM)(listen没有开启 netca)
然后就需要配置asm 的一些参数,(设置asm 实例sys 用户的密码,并选择初始化文件的方式)
开始创建
选择asm 可用的磁盘组(需要点击Create New 来创建一个
Disk Group Name:rac_disk ,DISK path 钩上) 点OK
指定数据库文件位置 (NEXT)
屏蔽掉了所有可选择的数据库组件
数据库服务,这里先不配置,直接next
设置sga,pga,block_size 等
数据库存储配置(next)
选中Create Database,点击finish 开始创建数据库
摘要信息,点击ok
数据库开始创建,这个过程可能不会太快
***终于完成了***
如报错crs 1028 0223 prkp 1001
[oracle@rac2 db_crs]$ cd /oracle/app/oracle/product/10.2.0/db_crs/
关闭所有进程
[oracle@rac2 db_crs]$ bin/crs_stop -all
如有没有正常关闭的进程,单独停止(保证所有都停掉)
bin/crs_stop ora.rac1.ons
bin/crs_stat -t(保证所有都停掉)
bin/crs_start -all(重新开启 发现都启动了)
附件列表