1 简介
Oracle 11g rac 基本结构如下图所示:
2 Oracle安装前准备工作
执行自动设置或手动设置完成基本的先决条件。完成所有安装所需的附加设置。
2.1 准备软件包
Oracle 11g Release 2 (11.2.0.4) Software (64 bit)
2.2 自动设置(需要互联网)
按照http://public-yum.oracle.com 的说明安装Oracle yum库,然后执行下面的命令。
# yum install oracle-rdbms-server-11gR2-preinstall
2.3 手动设置
2.3.1 从Centos 6.5的安装光盘上安装以下包
# From Centos 6 DVD
cd /media/cdrom/Server/Packages
#rpm -Uvh binutils-2.*
#rpm -Uvh compat-libstdc++-33*
#rpm -Uvh elfutils-libelf-0.*
#rpm -Uvh libaio-0.*
rpm -Uvh libaio-devel-0.*
#rpm -Uvh sysstat-9.*
#rpm -Uvh glibc-2.*
#rpm -Uvh glibc-common-2.*
#rpm -Uvh glibc-devel-2.* glibc-headers-2.*
rpm -Uvh ksh-2*
#rpm -Uvh make-3.*
#rpm -Uvh libgcc-4.*
#rpm -Uvh libstdc++-4.*
rpm -Uvh libstdc++-4.*.i686*
#rpm -Uvh libstdc++-devel-4.*
#rpm -Uvh gcc-4.*x86_64*
#rpm -Uvh gcc-c++-4.*x86_64*
#rpm -Uvh --allfiles elfutils-libelf-0*x86_64* elfutils-libelf-devel-0*x86_64*
rpm -Uvh elfutils-libelf-0*i686* elfutils-libelf-devel-0*i686*
rpm -Uvh libtool-ltdl*i686*
rpm -Uvh ncurses*i686*
rpm -Uvh readline*i686*
rpm -Uvh unixODBC*
cd /
eject
2.3.2 在 "/etc/sysctl.conf" 文件中增加:
fs.aio-max-nr = 1048576
fs.file-max = 6815744
#kernel.shmall = 2097152
#kernel.shmmax = 1054504960
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
2.3.3 运行命令使内核参数生效
/sbin/sysctl –p
2.3.4 在 "/etc/security/limits.conf" 文件中增加:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 4096
oracle hard nofile 65536
oracle soft stack 10240
grid hard nproc 16384
grid soft nofile 4096
grid hard nofile 65536
grid soft stack 10240
在 "/etc/pam.d/login" 文件中增加:
session required pam_limits.so
2.3.5 创建用户和组:
groupadd -g 54321 oinstall
groupadd -g 54322 dba
useradd -u 54321 -g oinstall -G dba oracle
useradd -u 54322 -g oinstall -G dba grid
2.4 额外的设置
2.4.1 设置 "oracle" 用户的密码.
passwd oracle
2.4.2 设置 "grid" 用户的密码.
passwd grid
2.4.3 从oracle安装介质上安装rpm包
cd /your/path/to/grid/rpm
rpm -Uvh cvuqdisk*
2.4.4 修改hostname
编辑"/etc/sysconfig/network" 文件,第二个节点改成rac-node2
NETWORKING=yes
HOSTNAME=rac-node1
输入命令
hostname rac-node1
2.4.5 如果没有DNS在"/etc/hosts" 文件中增加:
127.0.0.1 localhost.localdomain localhost
# Public
10.115.1.165 rac-node1
10.115.1.166 rac-node2
# Private
192.168.1.111 rac-node1-priv
192.168.1.112 rac-node2-priv
# Virtual
10.115.1.213 rac-node1-vip
10.115.1.214 rac-node2-vip
# SCAN
10.115.1.215 rac-scan
10.115.1.216 rac-scan
10.115.1.217 rac-scan
2.4.6 关闭 SELinux, 修改 "/etc/selinux/config" 文件
SELINUX=disabled
2.4.7 关闭防火墙
# service iptables stop
# chkconfig iptables off
2.4.8 关闭ntp服务
# service ntpd stop
Shutting down ntpd: [ OK ]
# chkconfig ntpd off
# mv /etc/ntp.conf /etc/ntp.conf.orig
# rm /var/run/ntpd.pid
2.4.9 创建安装目录
mkdir -p /g01/app/orabase
mkdir -p /g01/app/grid/product/11.2.0/grid_1
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /u01
chown -R grid:oinstall /g01
chmod -R 775 /u01
2.4.10 登录grid用户,修改 "/home/grid/.bash_profile" 文件
# grid
ORACLE_BASE=/g01/app/orabase; export ORACLE_BASE
ORACLE_HOME=/g01/app/grid/product/11.2.0/grid_1; export ORACLE_HOME
ORACLE_SID=+ASM1; export ORACLE_SID #+ASM1第二个节点改成+ASM2
PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
ulimit -u 16384 -n 65536
2.4.11 登录oracle用户,修改 "/home/oracle/.bash_profile" 文件
# oracle
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_SID=ODS1; export ORACLE_SID # ODS1第二个节点改成ODS2
PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH; export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
ulimit -u 16384 -n 65536
2.4.12 查看有几块共享磁盘
# cd /dev
# ls sd*
sda sda1 sda2 sdb sdc sdd sde sdf
#
2.4.13 配置UDEV配置文件绑定磁盘
for i in b c d e f;
do
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\", RESULT==\"`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"dba\", MODE=\"0660\"" >> /etc/udev/rules.d/99-oracle-asmdevices.rules
done
# /sbin/start_udev
2.4.14 查看绑定后的磁盘
# ls -al /dev/asm*
2.4.15 测试网络
ping -c 3 rac-node1
ping -c 3 rac-node1-priv
ping -c 3 rac-node2
ping -c 3 rac-node2-priv
3 安装 Grid Infrastructure
$ unzip grid.zip
$ cd grid
$ ./runInstaller
选择 "Skip software updates" 选项, 然后点击 "Next" 按钮.
选择 "Install and Configure Oracle Grid Infrastructure for a Cluster" 选项, 然后点击 "Next" 按钮.
选择 "Typical Installation" 选项, 然后点击 "Next" 按钮.
在 "Specify Cluster Configuration" 界面, 输入ods-scan 然后点击 "Add" 按钮.
输入第二个节点的信息, 然后点 "OK" 按钮.
点击 "SSH Connectivity..." 按钮 然后输入"grid" 用户的密码. 点击 "Setup" 按钮配置 SSH connectivity,然后点击 "Test"测试.
点击 "Identify network interfaces..." 按钮然后检查 public and private 网络是正确的.
输入 ASM 密码, 选择 "dba" 组然后点击 "Next" 按钮.
设置 redundancy 为 "External", 点击 "Change Discovery Path" 按钮然后设置路径为 "/dev/asm*". 返回主窗口选择所有盘然后点击 "Next" 按钮.
选择默认的 inventory directory 然后点击 "Next" 按钮.
先等待检查完成。如果有任何问题,修正或选中 "Ignore All" 复选框并单击“Next”按钮。
点击 "Install" 按钮.
等待安装完成.
当提示时,在每个节点上用root用户运行配置脚本.
运行 "orainstRoot.sh" 脚本。
# cd /u01/app/oraInventory
# ./orainstRoot.sh
Changing permissions of /u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oraInventory to oinstall.
The execution of the script is complete.
#
运行 " root.sh" 脚本。
第一个节点
# ./root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/11.2.0/grid
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/11.2.0/grid/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 upstart
CRS-2672: Attempting to start 'ora.mdnsd' on 'ol6-112-rac1'
CRS-2676: Start of 'ora.mdnsd' on 'ol6-112-rac1' succeeded
CRS-2672: Attempting to start 'ora.gpnpd' on 'ol6-112-rac1'
CRS-2676: Start of 'ora.gpnpd' on 'ol6-112-rac1' succeeded
CRS-2672: Attempting to start 'ora.cssdmonitor' on 'ol6-112-rac1'
CRS-2672: Attempting to start 'ora.gipcd' on 'ol6-112-rac1'
CRS-2676: Start of 'ora.cssdmonitor' on 'ol6-112-rac1' succeeded
CRS-2676: Start of 'ora.gipcd' on 'ol6-112-rac1' succeeded
CRS-2672: Attempting to start 'ora.cssd' on 'ol6-112-rac1'
CRS-2672: Attempting to start 'ora.diskmon' on 'ol6-112-rac1'
CRS-2676: Start of 'ora.diskmon' on 'ol6-112-rac1' succeeded
CRS-2676: Start of 'ora.cssd' on 'ol6-112-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 0a287fd11ac74f59bf2edb0bd6d260e5.
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 0a287fd11ac74f59bf2edb0bd6d260e5 (/dev/asm-disk1) [DATA]
Located 1 voting disk(s).
CRS-2672: Attempting to start 'ora.asm' on 'ol6-112-rac1'
CRS-2676: Start of 'ora.asm' on 'ol6-112-rac1' succeeded
CRS-2672: Attempting to start 'ora.DATA.dg' on 'ol6-112-rac1'
CRS-2676: Start of 'ora.DATA.dg' on 'ol6-112-rac1' succeeded
CRS-2672: Attempting to start 'ora.registry.acfs' on 'ol6-112-rac1'
CRS-2676: Start of 'ora.registry.acfs' on 'ol6-112-rac1' succeeded
Configure Oracle Grid Infrastructure for a Cluster ... succeeded
#
第二个节点
# ./root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/11.2.0/grid
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/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
User ignored Prerequisites during installation
OLR initialization - successful
Adding Clusterware entries to upstart
CRS-4402: The CSS daemon was started in exclusive mode but found an active CSS daemon on node ol6-112-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
#
运行完脚本, 返回 "Execute Configuration Scripts" 界面然后点击 "OK" 按钮.
等待 configuration assistants 完成.
如果没有DNS, 验证阶段会报SCAN的失败与错误.
INFO: Checking Single Client Access Name (SCAN)...
INFO: Checking name resolution setup for "rac-scan.localdomain"...
INFO: ERROR:
INFO: PRVF-4664 : Found inconsistent name resolution entries for SCAN name "rac-scan.localdomain"
INFO: ERROR:
INFO: PRVF-4657 : Name resolution setup check for "rac-scan.localdomain" (IP address: 192.168.2.201) failed
INFO: ERROR:
INFO: PRVF-4664 : Found inconsistent name resolution entries for SCAN name "rac-scan.localdomain"
INFO: Verification of SCAN VIP and Listener setup failed
忽略这些错误然后点击 "Next" 按钮.
点击 "Close" 按钮退出安装程序.
grid infrastructure 安装完成.
4 安装 Database
$ unzip database.zip
$ cd database
$ ./runInstaller
取消勾选检查安全更新复选框并单击 "Next" 按钮,警告对话框选择 "Yes"。
选择 "Skip software updates" 复选框,并单击 "Next" 按钮。
选择“Create and configure a database”选项然后单击 "Next" 按钮。
选择 "Server Class" 选项然后单击 "Next" 按钮.
确保两个节点被选中,然后单击 "Next" 按钮。
选择 "Typical install" 选项然后点击 "Next" 按钮。
存储类型应设置为 "Automatic Storage Manager" 。输入相应的密码和数据库名称。
等待检查完成。如果有任何问题,修复他们,或选中 "Ignore All" 复选框并单击 "Next" 按钮。
点击 "Install" 按钮.
等待安装完成。
Once 软件安装完成将自动进入数据库创建界面。
当数据库创建完成点击 "OK" 按钮.
当提示执行脚本时,在每个节点上用root用户执行root.sh脚本,然后单击 "OK" 按钮。
点击 "Close" 按钮退出安装程序。
RAC database 创建完成。
5 检查 RAC 状态
在oracle用户下输入一下命令来检查数据库状态。
$ srvctl config database -d RAC
Database unique name: RAC
Database name: RAC
Oracle home: /u01/app/oracle/product/11.2.0.3/db_1
Oracle user: oracle
Spfile: +DATA/RAC/spfileRAC.ora
Domain: localdomain
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: RAC
Database instances: RAC2,RAC1
Disk Groups: DATA
Mount point paths:
Services:
Type: RAC
Database is administrator managed
$
$ srvctl status database -d RAC
Instance RAC1 is running on node ol6-112-rac1
Instance RAC2 is running on node ol6-112-rac2
$
本文档只作为快捷安装指导,进一步的内容,请查阅oracle官方文档。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12252168/viewspace-2103923/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/12252168/viewspace-2103923/