
为提高公司现有oracle数据库的高可用性,提高系统数据处理效率,提供持续高效的数据库支持,把oracle环境做成rac,实现双机功能。
文档属性:
属性内容
文档主题ORACLE_RAC部署方案版本
文档编号作者状态错误!
未找到
引用
源。
文档变更:
版本修订日期修订人描述
0.1 2013.1.16 吴春阳目录
1部署环境要求 (5)
1.1硬件环境: (5)
1.2软件环境 (5)
1.3网络环境 (5)
1.3.1网络结构图 (5)
1.4IP地址划分 (6)
1.5共享磁盘划分 (6)
2实施步骤 (7)
2.1系统环境准备 (7)
2.1.1配置主机解析文件 (7)
2.1.2检查所需软件包 (8)
2.1.3配置系统内核参数 (8)
2.1.4设置Shell对Oracle用户的 (9)
2.1.5配置hangcheck-timer内核模块 (10)
2.1.6配置系统安全设置 (10)
2.1.7配置NTP .......................................................................................... 错误!未定义书签。
2.1.8创建Oracle用户和组 (11)
2.1.9设置Oracle用户环境(.bash_profile)变量 (13)
2.1.10在各节点上创建目录 (13)
2.1.11配置节点间SSH信任 (16)
2.1.12创建共享磁盘 .......................................................................... 错误!未定义书签。
2.1.13建立和配置raw设备 .............................................................. 错误!未定义书签。
2.1.14解压软件包 (22)
2.2安装Oracle grid集群件 (22)
2.3安装Oracle数据库 (38)2.4配置Oracle Net ........................................................................................ 错误!未定义书签。
2.5创建RAC数据库 (46)
2.6确认TNS配置 (59)
2.7测试RAC ................................................................................................. 错误!未定义书签。
1 部署环境要求
1.1硬件环境:
服务器:DELL R210、DELL R610
客户端:PC
1.2软件环境
操作系统:CentOS-5.5-x86_
软件应用:
linux.x_11gR2_database_1of2.zip
linux.x_11gR2_database_2of2.zip
linux.x_11gR2_grid.zip
oracleasmlib-2.0.4-1.el5.x86_.rpm
oracleasm-support-2.1.7-1.el5.x86_.rpm
oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_.rpm
1.3网络环境
1.3.1网络结构图
1.3.2IP地址划分
db1:主数据库服务器
db2:备数据库服务器
硬件基本情况
主机: 2台服务器,内存8G,硬盘450G
存储:采用ASM自动管理,MD3000I分出三个分区
节点1 节点2
操作系统CentOS release 5.5_X (Final) CentOS release 5.5_X (Final) 主机名db1 db2
内存8G 8G
本地磁盘123G 442G
共享磁盘OCR_VOTE 2G
共享磁盘DA TA 800G
共享磁盘FRA 600G
公共IP 192.168.0.40 192.168.0.44
虚拟IP 192.168.0.140 192.168.0.144
专用IP 117.79.157.40 117.79.157.44
Scan IP 1 192.168.0.151
数据库版本Oracle11g.11.2.0.1
Oracle RAC SID db1 db2
数据库名称db
1.3.3共享磁盘划分
磁盘名称磁盘大小磁盘用途说明
OCR_VOTE 2G Ocr磁盘,即集群注册磁盘,用于存储集群配置信息,oracle要求磁盘最小空间为256M Voting disk(表决磁盘),用于记录集群节点信息,oracle要求磁盘最小空间为256M
DATA 800G 存放oracle数据文件
FRA 600G 用于存放日志文件,归档日志,
闪回数据等。
2 实施步骤
2.1系统环境准备
2.1.1配置主机解析文件
主数据库节点:
[root@db1 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 smtp.hiboxinc.com localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6
#public ip
192.168.0.40 db1
192.168.0.44 db2
#priv ip
117.79.157.40 db1-priv
117.79.157.44 db2-priv
#vip
192.168.0.140 db1-vip
192.168.0.144 db2-vip
#scan ip
192.168.0.151 db-scan1
#NAS
192.168.0.43 nas1
备数据库节点:
[root@db2 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 smtp.hiboxinc.com localhost.localdomain localhost ::1 localhost6.localdomain6 localhost6
#public ip
192.168.0.40 db1
192.168.0.44 db2
#priv ip
117.79.157.40 db1-priv
117.79.157.44 db2-priv
#vip
192.168.0.140 db1-vip192.168.0.144 db2-vip
#scan ip
192.168.0.151 db-scan1
#NAS
192.168.0.43 nas1
修改完hosts文件以后,重起network服务
2.1.2检查所需软件包
在每个节点上做以下配置信息,查看依赖的rpm包是否安装: binutils-2.*
compat-libstdc++-33* elfutils-libelf-0.* libaio-0.* libaio-devel-0.* sysstat-9.* glibc-2.* glibc-commo n-2.* glibc-devel-2.*glibc-headers-2.* ksh-2* make-3.* libgcc-4.* libstdc++-4.* libstdc++-4.*.i686* libstdc++-devel-4.* gcc-4.*x86_* gcc-c++-4.*x86_* elfutils-libelf-0*x86_*
elfutils-libelf-devel-0*x86_* elfutils-libelf-0*i686* elfutils-libelf-devel-0*i686* libtool-ltdl*i686* nc urses*i686* readline*i686* unixODBC*,这里unixODBC,libaio,libaio-devel等还需要安装32位的包
yum install binutils compat-libstdc++ elfutils-libelf libaio libaio-devel sysstat glibc glibc-common glibc-devel glibc-headers ksh make libgcc libstdc++ libstdc++-devel gcc gcc-c++ elfutils-libelf elfutils-libelf-devel elfutils-libelf elfutils-libelf-devel libtool-ltdl ncurses readline unixODBC smartmontools
2.1.3配置系统内核参数
使用文本编辑器将下面列出的行添加到/etc/sysctl.conf。要使更改立即生效,请执行sysctl –p。
(如果参数项存在,则核对数值)kernel.shmmax大小根据实际情况设置按照规划分配给oracle SGA大小计算,如sga=10G,则kernel.shmmax=10*1024*1024*1024=10737418240
[root@db1 ~]# tail -n 20 /etc/sysctl.conffs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 5737418240
kernel.shmmni = 4096
# semaphores: semmsl, semmns, semopm, semmni
kernel.sem = 250 32000 100 128
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
[root@db1 ~]#sysctl –p
2.1.4设置Shell对Oracle用户的 以root用户身份,在每个节点上执行相同的操作:
首先,修改/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
最后,修改/etc/profile,在文件最后添加如下内容:
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
所有修改完毕,重启所有Linux系统。
2.1.5配置ntp模块
以root用户身份执行,在所有节点上做如下配置:
# service ntpd stop
Shutting down ntpd: [ OK ]
# chkconfig ntpd off
# mv /etc/ntp.conf /etc/ntp.conf.org
# rm /var/run/ntpd.pid
编辑/etc/sysconfig/ntpd,在行中添加-x选项
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"
然后
# service ntpd restart
# chkconfig --level 35 ntpd on
# service ntpd start
[root@db2 ~]# crontab –e
15 1 * * * /usr/sbin/ntpdate 210.72.145.44;/usr/sbin/hwclock -w > /dev/null 2>&1
2.1.6配置系统安全设置
关闭iptables,可以直接执行如下命令:
[root@db1 ~]# iptables –F
[root@db1 ~]# /etc/init.d/iptables save
最后,将selinux禁用即可,也就是修改/etc/selinux/config文件,修改后的内容为:SELINUX=disabled
SELINUXTYPE=targeted2.1.7创建Oracle用户和组
在安装进行之前,需要创建组和2个用户,分别用于grid安装和oracle安装
管理,在两个节点执行相同的操作,操作如下:
节点1
[root@db1 ~]#groupadd –g 2531 dba
[root@db1 ~]#groupadd –g 2530 oinstall
[root@db1 ~]#groupadd –g 2532 oper
[root@db1 ~]#groupadd –g 2533 asmadmin
[root@db1 ~]#groupadd –g 2534 asmoper
[root@db1 ~]#groupadd –g 2535 asmdba
[root@db1 ~]#useradd -u 2530 -g oinstall -G dba,asmdba,oper oracle
[root@db1 ~]#useradd –u 2531 -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
然后,给oracle,grid用户设置密码:
[root@db1 ~]# passwd oracle
Changing password for user oracle.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@db1 ~]# passwd grid
Changing password for user grid.
New UNIX password:
Retype new UNIX password:passwd: all authentication tokens updated successfully.
节点2
[root@db2 ~]#groupadd –g 2531 dba
[root@db2 ~]#groupadd –g 2530 oinstall
[root@db2 ~]#groupadd –g 2532 oper
[root@db2 ~]#groupadd –g 2533 asmadmin
[root@db2 ~]#groupadd –g 2534 asmoper
[root@db2 ~]#groupadd –g 2535 asmdba
[root@db2 ~]#useradd -u 2530 -g oinstall -G dba,asmdba,oper oracle
[root@db2 ~]#useradd –u 2531 -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
然后,给oracle,grid用户设置密码:
[root@db2 ~]# passwd oracle
Changing password for user oracle.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
[root@db2 ~]# passwd grid
Changing password for user grid.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
最后,确认匿名用户nobody是否存在于系统中,因为在安装完成后nobody用户需
要执行一些扩展任务:
[root@db1 ~]# id nobody
uid=99(nobody) gid=99(nobody) groups=99(nobody)
[root@db2 ~]# id nobody
uid=99(nobody) gid=99(nobody) groups=99(nobody)
2.1.8在各节点上创建目录
节点1
[root@db1 ~]# mkdir -p /u01/app/grid
[root@db1 ~]#chown –R grid:oinstall /u01/app/grid
[root@db1 ~]#chmod –R 775 /u01/app/grid
节点2
[root@db2 ~]# mkdir -p /u01/app/grid
[root@db2 ~]#chown –R grid:oinstall /u01/app/grid
[root@db2 ~]#chmod –R 775 /u01/app/grid
切换到grid用户
[grid@db1 app]$ mkdir -p /u01/app/grid
[grid@db1 app]$ mkdir -p /u01/app/oracle
[grid@db1 app]$ mkdir -p /u01/app/oraInventory
[grid@db2 app]$ mkdir -p /u01/app/grid
[grid@db2 app]$ mkdir -p /u01/app/oracle
[grid@db2 app]$ mkdir -p /u01/app/oraInventory切换到root用户
[root@db1 u01]# chown -R oracle:oinstall /u01/app/oracle/
[root@db2 u01]# chown -R oracle:oinstall /u01/app/oracle/
2.1.9设置grid,Oracle用户环境(.bash_profile)变量
[grid@db1 ~]$ vi .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PA TH:$HOME/bin
export PA TH
export ORACLE_SID=+ASM1
export ORACLE_BASE=/u01/app/grid/crs_base
export ORACLE_HOME=/u01/app/grid/product/11.2.0/crs_1
export JA VA_HOME=$ORACLE_HOME/jdk
export
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib:/lib:/usr/lib:$ORACLE_HOME/o racm/lib
export PA TH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
export
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_ HOME/network/jlib
[grid@db2 ~]$ vi .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi# User specific environment and startup programs
PATH=$PA TH:$HOME/bin
export PA TH
export ORACLE_SID=+ASM2
export ORACLE_BASE=/u01/app/grid/crs_base
export ORACLE_HOME=/u01/app/grid/product/11.2.0/crs_1
export JA VA_HOME=$ORACLE_HOME/jdk
export
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib:/lib:/usr/lib:$ORACLE_HOME/o racm/lib
export PA TH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
export
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_ HOME/network/jlib
[oracle@db1 ~]$ vi .bash_porfile
export ORACLE_SID=db1
export ORACLE_BASE=/u01/app/oracle/
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export JA VA_HOME=$ORACLE_HOME/jdk
export
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib:/lib:/usr/lib:$ORACLE_HOME/o racm/lib
export PA TH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
export
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_ HOME/network/jlib
[oracle@db2 ~]$ vi .bash_porfile
export ORACLE_SID=db2
export ORACLE_BASE=/u01/app/oracle/
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export JA VA_HOME=$ORACLE_HOME/jdk
export
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib:/lib:/usr/lib:$ORACLE_HOME/o racm/lib
export PA TH=$ORACLE_HOME/bin:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
export
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_ HOME/network/jlib创建grid、oracle用户 base、home目录
[grid@rac1 ~]$ mkdir -p $ORACLE_BASE
[grid@rac1 ~]$ mkdir -p $ORACLE_HOME
[grid@rac2 ~]$ mkdir -p $ORACLE_BASE
[grid@rac2 ~]$ mkdir -p $ORACLE_HOME
[oracle@rac1 ~]$ mkdir -p $ORACLE_HOME
[oracle@rac2 ~]$ mkdir -p $ORACLE_HOME
2.1.10配置节点间SSH信任
在每个节点上创建RSA密钥和公钥
以oracle 用户登录在oracle用户的根目录内创建.ssh目录并设置读取权限
[oracle@db1 ~]$ mkdir ~/.ssh
[oracle@db1 ~]$ chmod 700 ~/.ssh
使用ssh-keygen命令生成基于SSH协议的RSA密钥
节点1
[oracle@db1 ~]$ cd ~/.ssh
[oracle@db1 .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:2b:ce:41:fc:95:9f:ce:25:e4:57:c7:af:fd:75:f0:c0 oracle@db1
[oracle@db1 .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:
a0:b1:5d:5f:e9:ab:f1:ca:e6:39:b0:e5:b8:17:b9:7c oracle@db1
节点2
[root@db2 ~]# su - oracle
[oracle@db2 ~]$ mkdir ~/.ssh
[oracle@db2 ~]$ chmod 700 ~/.ssh
[oracle@db2 ~]$ cd .ssh/
[oracle@db2 .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:c0:70:b3:c3:eb:c0:30:06:d2:99:a4:15:61:8b:ab:b3 oracle@db2
[oracle@db2 .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:
c1:05:51:dd:e5:45:d3:5b:31:0f:58:18:30:1e:ec:67 oracle@db2
节点1,
[oracle@db1 .ssh]$ cat id_rsa.pub >>authorized_keys
[oracle@db1 .ssh]$ cat id_dsa.pub >>authorized_keys
[oracle@db1 .ssh]$ ssh db2 cat ~/.ssh/id_rs.pub >>authorized_keys
The authenticity of host 'db2 (192.168.0.44)' can't be established.
RSA key fingerprint is 2f:a6:8d:09:9a:f4:cf:34:aa:bf:5c:5d:7a:3f:91:9c.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'db2,192.168.0.44' (RSA) to the list of known hosts. oracle@db2's password:
cat: /home/oracle/.ssh/id_rs.pub: 没有那个文件或目录
[oracle@db1 .ssh]$ ssh db2 cat ~/.ssh/id_rsa.pub >>authorized_keys
oracle@db2's password:
[oracle@db1 .ssh]$ ssh db2 cat ~/.ssh/id_dsa.pub >>authorized_keys
oracle@db2's password:
[oracle@db1 .ssh]$ scp authorized_keys rac2:~/.ssh/authorized_keys
ssh: rac2: Name or service not known
lost connection
[oracle@db1 .ssh]$ scp authorized_keys db2:~/.ssh/authorized_keys
oracle@db2's password:
authorized_keys 100% 1984 1.9KB/s 00:00
[oracle@db1 .ssh]$
在提示保存私钥(key)和公钥(public key)的位置时,选择使用默认值,然后依次直接回车即可。
整合公钥文件
以Oracle 用户登录在要执行Oracle安装程序的节点db1 上执行如下操作:
[oracle@db1 ~] $ cd ~/.ssh
[oracle@db1 .ssh]$ ssh db1 cat /home/oracle/.ssh/id_rsa.pub >> authorized_keys
[oracle@db1 .ssh]$ ssh db2 cat /home/oracle/.ssh/id_rsa.pub >> authorized_keys
[oracle@db1 .ssh]$ chmod 600 ~/.ssh/authorized_keys
[oracle@db1 .ssh]$scp authorized_keys db2:/home/oracle/.ssh/
这个操作过程是将两个节点生成的公钥文件整合为一个authorized_keys文件,然后进行授权,并将authorized_keys拷贝到另一个节点。
测试SSH互信
首先在db1节点上执行:
[oracle@db1 ~]$ ssh db1 date
[oracle@db1 ~]$ ssh db2 date
然后在db2节点上执行
[oracle@db2 ~]$ ssh db1 date[oracle@db2 ~]$ ssh db2 date
2.1.11配置oracle自动存储管理(ASM)
Oracle ASM 与 Oracle 数据库紧密集成在一起,并与 Oracle 的数据管理工具套件配合工作。它可以简化数据库存储管理,并提供原始磁盘 I/O 的性能。
[root@db1 u02]# rpm -Uvh oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_.rpm \
oracleasmlib-2.0.4-1.el5.x86_.rpm\
oracleasm-support-2.1.7-1.el5.x86_.rpm
Preparing... ########################################### [100%] 1:oracleasmlib ########################################### [100%]
2:oracleasm ########################################### [100%]
3:oracleasm-support ########################################### [100%]
[root@db2 u02]# rpm -Uvh oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_.rpm \
oracleasmlib-2.0.4-1.el5.x86_.rpm\
oracleasm-support-2.1.7-1.el5.x86_.rpm
Preparing... ########################################### [100%] 1:oracleasmlib ########################################### [100%]
2:oracleasm ########################################### [100%]
3:oracleasm-support ########################################### [100%]
配置 ASMLib。以 root 用户身份在两个节点上配置 ASMLib。
[root@db1 app]# /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 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 []: asmadmin Start Oracle ASM library driver on boot (y/n) [n]: yScan 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@db2 ~]# /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 Default user to own the driver interface []: grid Default group to own the driver interface []: asmadmin 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 ] 创建 ASM 磁盘。以 root 用户身份在任何一个节点上创建 ASM 磁盘。 [root@db1 app]# /etc/init.d/oracleasm createdisk OCR_VOTE /dev/sdb1 Marking disk "OCR_VOTE" as an ASM disk: [ OK ] [root@db1 app]# /etc/init.d/oracleasm createdisk DATA /dev/sdb2 Marking disk "DATA" as an ASM disk: [ OK ] [root@db1 app]# /etc/init.d/oracleasm createdisk FRA /dev/sdb3 Marking disk "FRA" as an ASM disk: [ OK ] [root@db1 app]# /etc/init.d/oracleasm scandisks Scanning the system for Oracle ASMLib disks: [ OK ] [root@db2 ~]# /etc/init.d/oracleasm scandisks Scanning the system for Oracle ASMLib disks: [ OK ] [root@rdb1 app]# /etc/init.d/oracleasm listdisks OCR_VOTE DATA FRA [root@db2 ~]# /etc/init.d/oracleasm listdisks OCR_VOTE DATA FRA2.1.12解压软件包 远程工具这里采用vnc,启动服务器上vnc服务端,并在本地用客户端连接(这部分略) 将数据库所有软件放在了/home/oracle目录下,首先需要解压Oracle的两个软件包,操作如下:[root@db1 opt]#ls linux.x_11gR2_database_1of2.zip linux.x_11gR2_database_2of2.zip linux.x_11gR2_grid.zip [root@db1 rac]#unzip linux.x_11gR2_database_1of2.zip [root@db1 rac]#unzip linux.x_11gR2_database_2of2.zip [root@db1 rac]#unzip linux.x_11gR2_grid.zip 安装补丁包:在各节点上按顺序安装以下补丁包 /home/oracle/grid/rpm/cvuqdisk-1.0.7-1.rpm 2.1.13验证安装环境 以oracle身份登录系统,执行如下命令: [oracle@db1~]$/home/oracle/grid/runcluvfy.sh stage -pre crsinst -n db1, db1 -verbose 2.2安装Oracle grid集群件 先用root用户登录图形界面,执行以下命令: 由于是远程安装,安装过程中需要用图形化界面,这里我们选择vnc工具 在db1上以grid身份执行 [grid@db1 grid]$ ./runInstaller 点击fix&check again ,上述内核参数以及软件包依赖修复(可以参考more details ) 根据安装向导提示,以root用户身份在所有节点上分别执行上述两个脚本,要一个节点一个节点地执行,执行orainstRoot.sh时的信息如下: [root@db1 ~]# /u01/app/grid/oraInventory/orainstRoot.sh Changing permissions of /u01/app/grid/oraInventory. Adding read,write permissions for group. Removing read,write,execute permissions for world. Changing groupname of /u01/app/grid/oraInventory to oinstall. The execution of the script is complete. 节点2 [root@db2 ~]# /u01/app/grid/oraInventory/orainstRoot.sh Changing permissions of /u01/app/grid/oraInventory. Adding read,write permissions for group. Removing read,write,execute permissions for world. Changing groupname of /u01/app/grid/oraInventory to oinstall. The execution of the script is complete. 节点1 [root@db1 ~]# /u01/app/grid/product/11.2.0/crs_1/root.sh Performing root user operation for Oracle 11gThe following environment variables are set as: ORACLE_OWNER= grid ORACLE_HOME= /u01/app/grid/product/11.2.0/crs_1 Enter the full pathname of the local bin directory: [/usr/local/bin]: Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Creating /etc/oratab file... Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root script. Now product-specific root actions will be performed. Using configuration parameter file: /u01/app/grid/product/11.2.0/crs_1/crs/install/crsconfig_params Creating trace directory User ignored Prerequisites during installation OLR initialization - successful root wallet root wallet cert root cert export peer wallet profile reader wallet pa wallet peer wallet keys pa wallet keys peer cert request pa cert request peer cert pa cert peer root cert TP profile reader root cert TP pa root cert TP peer pa cert TP pa peer cert TP profile reader pa cert TP profile reader peer cert TP peer user cert pa user cert Adding Clusterware entries to inittab CRS-2672: Attempting to start 'ora.mdnsd' on 'rac1'CRS-2676: Start of 'ora.mdnsd' on 'rac1' succeeded CRS-2672: Attempting to start 'ora.gpnpd' on 'rac1' CRS-2676: Start of 'ora.gpnpd' on 'rac1' succeeded CRS-2672: Attempting to start 'ora.cssdmonitor' on 'rac1' CRS-2672: Attempting to start 'ora.gipcd' on 'rac1' CRS-2676: Start of 'ora.gipcd' on 'rac1' succeeded CRS-2676: Start of 'ora.cssdmonitor' on 'rac1' succeeded CRS-2672: Attempting to start 'ora.cssd' on 'rac1' CRS-2672: Attempting to start 'ora.diskmon' on 'rac1' CRS-2676: Start of 'ora.diskmon' on 'rac1' succeeded CRS-2676: Start of 'ora.cssd' on 'rac1' succeeded ASM created and started successfully. Disk Group DATA created successfully. clscfg: -install mode specified Successfully accumulated necessary OCR keys. Creating OCR keys for user 'root', privgrp 'root'.. Operation successful. CRS-4256: Updating the profile Successful addition of voting disk a032b7eed14f06bfd4afe175083487. Successful addition of voting disk 7237ca3ca4084fecbf3a9ce22690c3. Successful addition of voting disk 3bd80b71929f4ff8bf8b0780f30fa97f. Successfully replaced voting disk group with +DATA. CRS-4256: Updating the profile CRS-4266: Voting file(s) successfully replaced ## STATE File Universal Id File Name Disk group -- ----- ----------------- --------- --------- 1. ONLINE a032b7eed14f06bfd4afe175083487 (DB:OCR_VOTE) [DATA] Located 1 voting disk(s). CRS-2672: Attempting to start 'ora.asm' on 'rac1' CRS-2676: Start of 'ora.asm' on 'rac1' succeeded CRS-2672: Attempting to start 'ora.DATA.dg' on 'rac1' CRS-2676: Start of 'ora.DATA.dg' on 'rac1' succeeded CRS-2672: Attempting to start 'ora.registry.acfs' on 'rac1' CRS-2676: Start of 'ora.registry.acfs' on 'rac1' succeeded Configure Oracle Grid Infrastructure for a Cluster ... succeeded 节点2 [root@db2 ~]# /u01/app/grid/product/11.2.0/crs_1/root.sh Performing root user operation for Oracle 11gThe following environment variables are set as: ORACLE_OWNER= grid ORACLE_HOME= /u01/app/grid/product/11.2.0/crs_1 Enter the full pathname of the local bin directory: [/usr/local/bin]: Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Creating /etc/oratab file... Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root script. Now product-specific root actions will be performed. Using configuration parameter file: /u01/app/grid/product/11.2.0/crs_1/crs/install/crsconfig_params Creating trace directory User ignored Prerequisites during installation 在 db1 上以 root 用户身份执行 [root@db1 ~]# /u01/clusterware/rootpre/rootpre.sh OLR initialization - successful Adding Clusterware entries to inittab CRS-4402: The CSS daemon was started in exclusive mode but found an active CSS daemon on node rac1, number 1, and is terminating An active cluster was found during exclusive startup, restarting to join the cluster Configure Oracle Grid Infrastructure for a Cluster ... succeeded 脚本执行完毕后点“OK” 查看Clusterware 启动状态 至此,Clusterware安装完成。 2.3安装Oracle数据库软件 在Oracle ClusterWare安装成功后,开始进入Oracle数据库的安装,以oracle用户身份登录到任意一个集群节点,执行如下命令开始安装: [root@db1 oracle]# chown -R oracle.oinstall /home/oracle/database/ [oracle@db1 database]$ /home/oracle/database/runInstaller 接着就会弹出图形安装向导界面: 选择create and configure a database。 选择只安装数据库软件,安装完后手动创建数据库 1. 指定详细内容: o Oracle base :/u01/app/oracle 节点1 [root@rac1 app]# /u01/app/oracle/product/11.2.0/db_1/root.sh Performing root user operation for Oracle 11g The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/app/oracle/product/11.2.0/db_1 Enter the full pathname of the local bin directory: [/usr/local/bin]: The contents of "dbhome" have not changed. No need to overwrite. The contents of "oraenv" have not changed. No need to overwrite. The contents of "coraenv" have not changed. No need to overwrite. Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root script. Now product-specific root actions will be performed. Finished product-specific root actions. 节点2 [root@rac2 ~]# /u01/app/oracle/product/11.2.0/db_1/root.sh Performing root user operation for Oracle 11gThe following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /u01/app/oracle/product/11.2.0/db_1 Enter the full pathname of the local bin directory: [/usr/local/bin]: The contents of "dbhome" have not changed. No need to overwrite. The contents of "oraenv" have not changed. No need to overwrite. The contents of "coraenv" have not changed. No need to overwrite. Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root script. Now product-specific root actions will be performed. Finished product-specific root actions. 所有节点上脚本执行完毕之后,点OK完成数据库软件安装。 2.4创建ASM实例和db实例[oracle@rac1 Disk1]$ dbca 1.进入配置助手欢迎页面,选择Oracle集群数据库,Next。 2.选择配置ASM,NEXT。 3.选择所有节点,NEXT。 4.设置ASM sys密码,选择ASM实例参数类型,NEXT。 5.开始ASM实例创建。 6.实例创建完毕后,选择Create New 开始创建磁盘组。 7.选择磁盘组,将磁盘组命令为DA TA,点OK开始磁盘组创建。 8.磁盘组创建完毕后,ASM实例会主动Mount。 9.点Finish,提示是否需要执行其他操作,选Yes开始DB实例的创建。 10.选择Create a Database,NEXT。 11.选择所有节点,NEXT。 12.选择General Perpose模板,NEXT。 13.执行全局数据库名和SID,NEXT。
