1. 首页 > 软件安装教程 > 正文

Oracle安装-Oracle11gR2 RAC集群安装配置 FOR AIX6.1详细过程

1. 硬件环境要求

在安装Oracle 11gR2 RAC之前,必须对服务器的硬件环境进行全面检查,确保满足最低要求。更多学习教程www.fgedu.net.cn

# 检查内存大小
# lsattr -El sys0 -a realmem
realmem 67108864 Total amount of real memory in Mbytes

# 检查磁盘空间
# df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 10.00 3.50 65% 34521 12% /
/dev/hd2 20.00 8.00 60% 89000 20% /usr
/dev/hd9var 5.00 2.00 60% 12000 15% /var
/dev/hd3 10.00 5.00 50% 15000 10% /tmp
/dev/hd1 5.00 2.00 60% 5000 10% /home
/dev/oracle 100.00 60.00 40% 200000 30% /oracle
/dev/asm 200.00 100.00 50% 100000 20% /asm

# 检查CPU核心数
# lsdev -C -c processor | wc -l
32

# 检查系统架构
# uname -M
IBM,8233-E8B

# 检查操作系统版本
# oslevel -s
6100-09-05-1917

生产环境建议:最小内存16GB(测试环境),生产环境建议64GB以上。每个节点至少需要16GB内存。共享存储建议使用SAN存储,配置多路径以提高可用性。每个节点至少需要2个网络接口(一个公网,一个私网)。

2. 操作系统准备

Oracle 11gR2 RAC支持AIX 6.1操作系统。本文以AIX 6.1为例。学习交流加群风哥微信: itpux-com

# 检查操作系统版本
# oslevel -s
6100-09-05-1917

# 检查内核版本
# uname -v
6

# 检查系统补丁级别
# instfix -i | grep 6100-09
6100-09 AIX Technology Level 9

# 检查系统参数
# lsattr -El sys0
maxuproc 128 Maximum number of PROCESSES allowed per user True
realmem 67108864 Total amount of real memory in Mbytes

# 配置系统参数
# chdev -l sys0 -a maxuproc=16384
sys0 changed

# 验证配置
# lsattr -El sys0 -a maxuproc
maxuproc 16384 Maximum number of PROCESSES allowed per user True

3. 网络配置

RAC集群需要配置多个网络接口,包括公网、私网和VIP网络。

# 检查网络接口
# lsdev -Cc adapter | grep -i ent
ent0 Available 10/100/1000 Base-TX Ethernet PCI Adapter
ent1 Available 10/100/1000 Base-TX Ethernet PCI Adapter
ent2 Available 10/100/1000 Base-TX Ethernet PCI Adapter

# 检查IP地址配置
# ifconfig -a
en0: flags=1e080863,480
inet 192.168.1.101 netmask 0xffffff00 broadcast 192.168.1.255
inet6 fe80::250:56ff:fe00:101%en0/64
en1: flags=1e080863,480
inet 10.0.0.101 netmask 0xffffff00 broadcast 10.0.0.255
inet6 fe80::250:56ff:fe00:102%en1/64

# 配置网络接口(节点1)
# smitty mktcpip

# 公网配置
en0: 192.168.1.101/24
Gateway: 192.168.1.1

# 私网配置
en1: 10.0.0.101/24

# 配置VIP地址
# smitty chinet
en0: 192.168.1.201/24

# 配置SCAN地址(DNS或hosts文件)
# vi /etc/hosts
192.168.1.101 racnode1
192.168.1.102 racnode2
192.168.1.201 racnode1-vip
192.168.1.202 racnode2-vip
192.168.1.200 rac-scan
10.0.0.101 racnode1-priv
10.0.0.102 racnode2-priv

# 节点2配置
# smitty mktcpip

# 公网配置
en0: 192.168.1.102/24
Gateway: 192.168.1.1

# 私网配置
en1: 10.0.0.102/24

# 配置VIP地址
# smitty chinet
en0: 192.168.1.202/24

# 配置hosts文件
# vi /etc/hosts
192.168.1.101 racnode1
192.168.1.102 racnode2
192.168.1.201 racnode1-vip
192.168.1.202 racnode2-vip
192.168.1.200 rac-scan
10.0.0.101 racnode1-priv
10.0.0.102 racnode2-priv

生产环境建议:RAC集群需要配置三个网络:公网(Public Network)、私网(Private Network/Interconnect)和VIP网络。私网建议使用高速网络(如10GbE),并配置冗余。SCAN地址建议配置3个IP,使用DNS解析。

4. 存储配置

RAC集群需要配置共享存储,用于存储OCR、Voting Disk和数据文件。

# 检查磁盘设备
# lsdev -Cc disk
hdisk0 Available 00-08-00-4,0 16 Bit LVD SCSI Disk Drive
hdisk1 Available 00-08-00-5,0 16 Bit LVD SCSI Disk Drive
hdisk2 Available 00-08-00-6,0 16 Bit LVD SCSI Disk Drive
hdisk3 Available 00-08-00-7,0 16 Bit LVD SCSI Disk Drive

# 检查磁盘大小
# lsattr -El hdisk0 -a size
size 100000 Size in Megabytes

# 配置多路径(如使用SAN存储)
# smitty mpath

# 创建卷组
# mkvg -y oraclevg -s 32 hdisk2 hdisk3
oraclevg

# 检查卷组
# lsvg
rootvg
oraclevg

# 创建逻辑卷
# mklv -y ocrlv oraclevg 2
ocrlv

# mklv -y votinglv oraclevg 2
votinglv

# mklv -y datalv oraclevg 100
datalv

# 检查逻辑卷
# lsvg -l oraclevg
oraclevg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
ocrlv jfs 2 2 2 closed/syncd N/A
votinglv jfs 2 2 2 closed/syncd N/A
datalv jfs 100 100 2 closed/syncd N/A

# 创建文件系统
# crfs -v jfs2 -d ocrlv -m /oracle/ocr -A yes
File system created successfully.

# crfs -v jfs2 -d votinglv -m /oracle/voting -A yes
File system created successfully.

# crfs -v jfs2 -d datalv -m /oracle/data -A yes
File system created successfully.

# 挂载文件系统
# mount /oracle/ocr
# mount /oracle/voting
# mount /oracle/data

# 检查文件系统
# df -g /oracle/ocr
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/oraclevg/ocrlv
1.00 0.80 20% 500 5% /oracle/ocr

# df -g /oracle/voting
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/oraclevg/votinglv
1.00 0.80 20% 500 5% /oracle/voting

# df -g /oracle/data
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/oraclevg/datalv
50.00 40.00 20% 10000 10% /oracle/data

生产环境建议:OCR和Voting Disk需要配置冗余(Normal冗余需要3个磁盘,High冗余需要5个磁盘)。建议使用ASM存储OCR和Voting Disk。数据文件存储建议使用ASM,配置多个磁盘组以提高性能和可用性。

5. 依赖包安装

Oracle 11gR2 RAC需要安装一系列依赖包。

# 检查已安装的软件包
# lslpp -l | grep -i xlC
xlC.aix61.rte 11.1.0.0 COMMITTED XL C/C++ Runtime for AIX 6.1
xlC.cpp 11.1.0.0 COMMITTED XL C/C++ Preprocessor
xlC.msg 11.1.0.0 COMMITTED XL C/C++ Messages

# lslpp -l | grep -i bos.adt
bos.adt.base 6.1.9.0 COMMITTED Base Application Development Toolkit
bos.adt.libm 6.1.9.0 COMMITTED Libm Application Development Toolkit
bos.adt.lib 6.1.9.0 COMMITTED Lib Application Development Toolkit

# lslpp -l | grep -i bos.perf
bos.perf.libperfstat 6.1.9.0 COMMITTED Performance Statistics Library
bos.perf.perfstat 6.1.9.0 COMMITTED Performance Statistics

# 安装缺失的软件包
# smitty install_latest

# 安装以下软件包:
# bos.adt.base
# bos.adt.lib
# bos.adt.libm
# bos.perf.perfstat
# bos.perf.libperfstat
# xlC.aix61.rte
# xlC.cpp
# xlC.msg
# rsct.basic.rte
# rsct.compat.clients.rte
# rsct.core.rte

风哥提示:AIX系统上的软件包安装使用smitty工具,可以通过图形界面或命令行方式安装。学习交流加群风哥QQ113257174

6. 内核参数配置

内核参数对Oracle RAC的性能和稳定性至关重要,需要根据服务器硬件配置进行调整。

# 检查当前内核参数
# lsattr -El sys0 -a maxuproc
maxuproc 16384 Maximum number of PROCESSES allowed per user True

# 配置最大进程数
# chdev -l sys0 -a maxuproc=16384
sys0 changed

# 配置共享内存参数
# vmo -p -o maxperm%=90
# vmo -p -o minperm%=5
# vmo -p -o maxclient%=90

# 配置虚拟内存参数
# vmo -p -o minfree=960
# vmo -p -o maxfree=1088

# 配置网络参数
# no -p -o rfc1323=1
# no -p -o sb_max=1310720
# no -p -o tcp_sendspace=65536
# no -p -o tcp_recvspace=65536
# no -p -o udp_sendspace=65536
# no -p -o udp_recvspace=655360

# 验证内核参数
# lsattr -El sys0 -a maxuproc
maxuproc 16384 Maximum number of PROCESSES allowed per user True

# vmo -a | grep maxperm
maxperm% = 90

# vmo -a | grep minperm
minperm% = 5

# no -a | grep rfc1323
rfc1323 = 1

生产环境内核参数说明:maxuproc设置为16384,支持大量并发进程;maxperm%设置为90,minperm%设置为5,优化内存使用;minfree和maxfree设置确保足够的空闲内存;网络参数优化TCP/UDP性能。

7. 用户和组配置

Oracle RAC需要特定的用户和组来运行,需要提前创建并配置。

# 创建Oracle用户组
# mkgroup -‘A’ id=’54321′ oinstall
# mkgroup -‘A’ id=’54322′ dba
# mkgroup -‘A’ id=’54323′ oper
# mkgroup -‘A’ id=’54324′ asmadmin
# mkgroup -‘A’ id=’54325′ asmdba
# mkgroup -‘A’ id=’54326′ asmoper
# mkgroup -‘A’ id=’54327′ oinstall

# 创建Oracle用户
# mkuser -‘A’ id=’54321′ pgrp=’oinstall’ groups=’dba,oper,asmadmin,asmdba,asmoper’ home=’/home/oracle’ oracle

# 设置Oracle用户密码
# passwd oracle
Changing password for “oracle”
oracle’s New password:
Enter the new password again:

# 验证用户和组
# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(asmadmin),54325(asmdba),54326(asmoper)

# 配置用户资源限制
# vi /etc/security/limits

# 添加以下内容
oracle:
fsize = -1
core = -1
cpu = -1
rss = -1
nofiles = 65536
fsize_hard = -1
nofiles_hard = 65536
data = -1
stack = -1
stack_hard = -1
data_hard = -1
rss_hard = -1
cpu_hard = -1
core_hard = -1
maxuproc = 16384
memlock = 3145728
memlock_hard = 3145728

8. 目录结构配置

按照OFA(Optimal Flexible Architecture)标准创建Oracle目录结构。

# 创建Oracle基础目录
# mkdir -p /oracle/app/oracle
# mkdir -p /oracle/app/oraInventory
# mkdir -p /oracle/app/oracle/product/11.2.0/db_1
# mkdir -p /oracle/app/oracle/product/11.2.0/grid
# mkdir -p /oracle/app/oracle/oradata
# mkdir -p /oracle/app/oracle/fast_recovery_area
# mkdir -p /oracle/app/oracle/admin/fgedudb
# mkdir -p /backup

# 设置目录权限
# chown -R oracle:oinstall /oracle
# chown -R oracle:oinstall /oracle/app/oraInventory
# chmod -R 775 /oracle
# chmod -R 755 /backup

# 验证目录结构
# ls -la /oracle/app/oracle/
total 28
drwxr-xr-x 7 oracle oinstall 4096 Mar 29 10:00 .
drwxr-xr-x 3 oracle oinstall 4096 Mar 29 10:00 ..
drwxr-xr-x 3 oracle oinstall 4096 Mar 29 10:00 admin
drwxr-xr-x 3 oracle oinstall 4096 Mar 29 10:00 fast_recovery_area
drwxr-xr-x 3 oracle oinstall 4096 Mar 29 10:00 oradata
drwxr-xr-x 3 oracle oinstall 4096 Mar 29 10:00 product

风哥提示:OFA目录结构有助于数据库的管理和维护,建议严格按照标准创建。

9. 环境变量配置

配置Oracle用户的环境变量,包括ORACLE_HOME、PATH等。

# 切换到oracle用户
# su – oracle

# 编辑.profile
$ vi ~/.profile

# 添加以下环境变量
export ORACLE_BASE=/oracle/app/oracle
export ORACLE_HOME=/oracle/app/oracle/product/11.2.0/db_1
export ORACLE_SID=fgedudb1
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export NLS_DATE_FORMAT=”YYYY-MM-DD HH24:MI:SS”
export TMP=/tmp
export TMPDIR=/tmp

# 使环境变量生效
$ . ~/.profile

# 验证环境变量
$ echo $ORACLE_HOME
/oracle/app/oracle/product/11.2.0/db_1

$ echo $ORACLE_SID
fgedudb1

$ env | grep ORACLE
ORACLE_BASE=/oracle/app/oracle
ORACLE_HOME=/oracle/app/oracle/product/11.2.0/db_1
ORACLE_SID=fgedudb1

生产环境建议:环境变量配置完成后,建议重新登录验证所有变量是否正确设置。NLS_LANG设置为AL32UTF8以支持中文,NLS_DATE_FORMAT设置为标准日期格式便于日志分析。

10. SSH互信配置

RAC集群需要在所有节点之间配置SSH互信。

# 在节点1上生成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:

$ 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:

# 配置SSH互信
$ cd ~/.ssh
$ cat id_rsa.pub >> authorized_keys
$ cat id_dsa.pub >> authorized_keys

# 复制到节点2
$ ssh racnode2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
$ ssh racnode2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys

# 复制authorized_keys到节点2
$ scp ~/.ssh/authorized_keys racnode2:~/.ssh/authorized_keys

# 测试SSH连接
$ ssh racnode1 date
$ ssh racnode2 date
$ ssh racnode1-priv date
$ ssh racnode2-priv date

生产环境建议:SSH互信配置完成后,建议在每个节点上测试所有连接,确保无需密码即可登录。

11. 时间同步配置

RAC集群需要在所有节点之间配置时间同步。

# 检查NTP服务状态
# lssrc -ls xntpd

# 如果NTP未安装,安装NTP
# smitty install_latest

# 配置NTP服务器
# vi /etc/ntp.conf

# 添加以下内容
server 192.168.1.10 prefer
driftfile /etc/ntp.drift

# 启动NTP服务
# startsrc -s xntpd

# 验证NTP服务
# lssrc -ls xntpd

# 检查时间同步状态
# ntpq -p
remote refid st t when poll reach delay offset disp
=======================================================================
*192.168.1.10 192.168.1.1 2 u 45 64 377 0.123 -0.456 0.123

风哥提示:RAC集群要求所有节点时间同步,建议使用NTP服务。时间偏差过大可能导致集群节点被驱逐。

12. Grid Infrastructure安装

在完成所有准备工作后,开始安装Grid Infrastructure。

# 解压Grid Infrastructure安装介质
$ cd /backup
$ unzip -q p13390677_112040_AIX64-5L_1of2.zip
$ unzip -q p13390677_112040_AIX64-5L_2of2.zip

# 执行图形化安装
$ cd /backup/grid
$ ./runInstaller

# 安装过程中的关键步骤:
1. 选择”Install and Configure Oracle Grid Infrastructure for a Cluster”
2. 选择”Configure a Standard cluster”
3. 选择”Advanced installation”
4. 添加集群节点:
– 节点1:racnode1
– 节点2:racnode2
5. 配置SSH互信
6. 选择网络接口:
– 公网:192.168.1.0/24
– 私网:10.0.0.0/24
– 不要选择:192.168.1.0/24
7. 配置OCR和Voting Disk:
– 选择”Use Oracle Automatic Storage Management”
– 配置ASM磁盘组:OCR(Normal冗余)
8. 设置ASM密码
9. 选择不使用IPMI
10. 配置操作系统组:
– OSDBA组:dba
– OSOPER组:oper
– OSASM组:asmadmin
11. 设置Oracle基目录:/oracle/app/oracle
12. 设置软件位置:/oracle/app/oracle/product/11.2.0/grid
13. 检查先决条件,点击”下一步”
14. 点击”完成”开始安装
15. 安装完成后,运行root脚本

# 以root用户运行配置脚本(节点1)
# /oracle/app/oracle/product/11.2.0/grid/root.sh
Running Oracle 11g root.sh script…

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /oracle/app/oracle/product/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.sh script.
Now product-specific root actions will be performed.
2014-03-29 10:00:00: Checking for super user privileges
2014-03-29 10:00:00: User has super user privileges
2014-03-29 10:00:00: Using configuration parameter file: /oracle/app/oracle/product/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
OLR initialization – successful
root.sh successful.

# 以root用户运行配置脚本(节点2)
# /oracle/app/oracle/product/11.2.0/grid/root.sh
Running Oracle 11g root.sh script…

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /oracle/app/oracle/product/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.sh script.
Now product-specific root actions will be performed.
2014-03-29 10:00:00: Checking for super user privileges
2014-03-29 10:00:00: User has super user privileges
2014-03-29 10:00:00: Using configuration parameter file: /oracle/app/oracle/product/11.2.0/grid/crs/install/crsconfig_params
Creating trace directory
OLR initialization – successful
Adding Clusterware entries to inittab
CRS-2672: Attempting to start ‘ora.mdnsd’ on ‘racnode2’
CRS-2676: Start of ‘ora.mdnsd’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.gpnpd’ on ‘racnode2’
CRS-2676: Start of ‘ora.gpnpd’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.cssdmonitor’ on ‘racnode2’
CRS-2676: Start of ‘ora.cssdmonitor’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.gipcd’ on ‘racnode2’
CRS-2676: Start of ‘ora.gipcd’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.cssd’ on ‘racnode2’
CRS-2676: Start of ‘ora.cssd’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.diskmon’ on ‘racnode2’
CRS-2676: Start of ‘ora.diskmon’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.ctssd’ on ‘racnode2’
CRS-2676: Start of ‘ora.ctssd’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.drivers.acfs’ on ‘racnode2’
CRS-2676: Start of ‘ora.drivers.acfs’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.asm’ on ‘racnode2’
CRS-2676: Start of ‘ora.asm’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.crsd’ on ‘racnode2’
CRS-2676: Start of ‘ora.crsd’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.crf’ on ‘racnode2’
CRS-2676: Start of ‘ora.crf’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.mdnsd’ on ‘racnode2’
CRS-2676: Start of ‘ora.mdnsd’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.gpnpd’ on ‘racnode2’
CRS-2676: Start of ‘ora.gpnpd’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.gipcd’ on ‘racnode2’
CRS-2676: Start of ‘ora.gipcd’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.cssdmonitor’ on ‘racnode2’
CRS-2676: Start of ‘ora.cssdmonitor’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.gipcd’ on ‘racnode2’
CRS-2676: Start of ‘ora.gipcd’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.cssd’ on ‘racnode2’
CRS-2676: Start of ‘ora.cssd’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.diskmon’ on ‘racnode2’
CRS-2676: Start of ‘ora.diskmon’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.ctssd’ on ‘racnode2’
CRS-2676: Start of ‘ora.ctssd’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.asm’ on ‘racnode2’
CRS-2676: Start of ‘ora.asm’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.crsd’ on ‘racnode2’
CRS-2676: Start of ‘ora.crsd’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.crf’ on ‘racnode2’
CRS-2676: Start of ‘ora.crf’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.evmd’ on ‘racnode2’
CRS-2676: Start of ‘ora.evmd’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.asm’ on ‘racnode2’
CRS-2676: Start of ‘ora.asm’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.DATA.dg’ on ‘racnode2’
CRS-2676: Start of ‘ora.DATA.dg’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.OCR.dg’ on ‘racnode2’
CRS-2676: Start of ‘ora.OCR.dg’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.registry.acfs’ on ‘racnode2’
CRS-2676: Start of ‘ora.registry.acfs’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.ons’ on ‘racnode2’
CRS-2676: Start of ‘ora.ons’ on ‘racnode2’ succeeded
CRS-2672: Attempting to start ‘ora.eons’ on ‘racnode2’
CRS-2676: Start of ‘ora.eons’ on ‘racnode2’ succeeded
root.sh successful.

13. ASM配置

配置Oracle ASM,用于存储数据库文件。

# 检查ASM实例状态
$ crsctl status resource -t
——————————————————————————–
Name Target State Server State details
——————————————————————————–
Local Resources
——————————————————————————–
ora.DATA.dg
ONLINE ONLINE racnode1 STABLE
ONLINE ONLINE racnode2 STABLE
ora.OCR.dg
ONLINE ONLINE racnode1 STABLE
ONLINE ONLINE racnode2 STABLE
ora.LISTENER.lsnr
ONLINE ONLINE racnode1 STABLE
ONLINE ONLINE racnode2 STABLE
ora.asm
ONLINE ONLINE racnode1 Started,STABLE
ONLINE ONLINE racnode2 Started,STABLE
ora.gsd
OFFLINE OFFLINE racnode1 STABLE
OFFLINE OFFLINE racnode2 STABLE
ora.net1.network
ONLINE ONLINE racnode1 STABLE
ONLINE ONLINE racnode2 STABLE
ora.ons
ONLINE ONLINE racnode1 STABLE
ONLINE ONLINE racnode2 STABLE
——————————————————————————–
Cluster Resources
——————————————————————————–
ora.cssd
1 ONLINE ONLINE racnode1 STABLE
2 ONLINE ONLINE racnode2 STABLE
ora.diskmon
1 OFFLINE OFFLINE racnode1 STABLE
2 OFFLINE OFFLINE racnode2 STABLE
ora.evmd
1 ONLINE ONLINE racnode1 STABLE
2 ONLINE ONLINE racnode2 STABLE
ora.mdnsd
1 ONLINE ONLINE racnode1 STABLE
2 ONLINE ONLINE racnode2 STABLE
# 创建DATA磁盘组
$ asmca

# 创建DATA磁盘组的关键步骤:
1. 选择”Create”
2. 输入磁盘组名称:DATA
3. 选择冗余级别:External
4. 选择磁盘:hdisk2, hdisk3
5. 点击”OK”

# 检查磁盘组
$ asmcmd lsdg
State Type Rebal Sector Block AU Total_MB Free_MB Req_mir_free_MB Usable_file_MB Offline_disks Voting_files Name
MOUNTED EXTERN N 512 4096 1048576 102400 51200 0 51200 0 N DATA
MOUNTED NORMAL N 512 4096 1048576 2048 1024 0 1024 0 Y OCR

14. Oracle 11gR2安装

在完成Grid Infrastructure安装后,开始安装Oracle 11gR2数据库软件。

# 解压Oracle 11gR2安装介质
$ cd /backup
$ unzip -q p13390677_112040_AIX64-5L_1of2.zip
$ unzip -q p13390677_112040_AIX64-5L_2of2.zip

# 执行图形化安装
$ cd /backup/database
$ ./runInstaller

# 安装过程中的关键步骤:
1. 选择”Install database software only”
2. 选择”Real Application Clusters database installation”
3. 添加集群节点:
– 节点1:racnode1
– 节点2:racnode2
4. 选择企业版
5. 设置Oracle基目录:/oracle/app/oracle
6. 设置软件位置:/oracle/app/oracle/product/11.2.0/db_1
7. 选择”Use Oracle Automatic Storage Management”
8. 选择ASM磁盘组:DATA
9. 设置ASM密码
10. 配置操作系统组:
– OSDBA组:dba
– OSOPER组:oper
11. 检查先决条件,点击”下一步”
12. 点击”完成”开始安装
13. 安装完成后,运行root脚本

# 以root用户运行配置脚本(节点1)
# /oracle/app/oracle/product/11.2.0/db_1/root.sh
Running Oracle 11g root.sh script…

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /oracle/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.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.

# 以root用户运行配置脚本(节点2)
# /oracle/app/oracle/product/11.2.0/db_1/root.sh
Running Oracle 11g root.sh script…

The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /oracle/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.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.

15. 数据库创建

安装完成后,使用DBCA工具创建RAC数据库。

# 使用DBCA创建数据库
$ dbca

# 创建数据库的关键步骤:
1. 选择”Create Database”
2. 选择”Real Application Clusters database”
3. 选择”Advanced Configuration”
4. 数据库标识符:
– 全局数据库名:fgedudb
– 系统标识符(SID):fgedudb
5. 选择”Use Oracle Automatic Storage Management”
6. 选择ASM磁盘组:DATA
7. 配置管理选项:选择”Use Enterprise Manager”
8. 设置数据库密码
9. 选择”File System”
10. 指定数据库文件位置:+DATA
11. 指定快速恢复区:+DATA/FRA
12. 不启用自动维护任务
13. 配置内存参数:
– SGA:20GB
– PGA:4GB
14. 配置字符集:AL32UTF8
15. 配置示例方案
16. 点击”完成”开始创建

16. 安装后配置

安装完成后,需要进行一些必要的配置,包括开启归档、配置监听器等。

— 启动数据库
$ sqlplus / as sysdba

SQL> STARTUP

— 开启归档模式
SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP MOUNT
SQL> ALTER DATABASE ARCHIVELOG;
SQL> ALTER DATABASE OPEN;

— 配置归档日志位置
SQL> ALTER SYSTEM SET log_archive_dest_1=’LOCATION=+DATA/FRA’ SCOPE=SPFILE;

— 配置强制归档
SQL> ALTER SYSTEM SET log_archive_format=’fgedudb_%t_%s_%r.arc’ SCOPE=SPFILE;

— 检查归档模式
SQL> ARCHIVE LOG LIST
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +DATA/FRA
Oldest online log sequence 1
Next log sequence to archive 2
Current log sequence 2

— 配置监听器
$ netca

— 配置监听器的关键步骤:
1. 选择”Listener configuration”
2. 选择”Add”
3. 输入监听器名称:LISTENER
4. 选择协议:TCP
5. 输入端口号:1521
6. 选择”No”
7. 点击”Finish”

— 启动监听器
$ lsnrctl start

— 检查监听器状态
$ lsnrctl status
LSNRCTL for IBM AIX RISC System/6000: Version 11.2.0.4.0 – Production on 29-MAR-2024 10:00:00

Copyright (c) 1991, 2013, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=racnode1-vip)(PORT=1521)))
STATUS of the LISTENER
————————
Alias LISTENER
Version TNSLSNR for IBM AIX RISC System/6000: Version 11.2.0.4.0 – Production
Start Date 29-MAR-2024 10:00:00
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /oracle/app/oracle/diag/tnslsnr/racnode1/listener/alert/log.xml

Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=racnode1-vip)(PORT=1521)))

Services Summary…
Service “fgedudb” has 2 instance(s).
Instance “fgedudb1”, status READY, has 1 handler(s) for this service…
Instance “fgedudb2”, status READY, has 1 handler(s) for this service…
Service “fgedudbXDB” has 2 instance(s).
Instance “fgedudb1”, status READY, has 1 handler(s) for this service…
Instance “fgedudb2”, status READY, has 1 handler(s) for this service…

— 配置TNS
$ vi $ORACLE_HOME/network/admin/tnsnames.ora

FGEDUDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = fgedudb)
)
)

FGEDUDB1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = racnode1-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = fgedudb)
(INSTANCE_NAME = fgedudb1)
)
)

FGEDUDB2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = racnode2-vip)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = fgedudb)
(INSTANCE_NAME = fgedudb2)
)
)

— 测试连接
$ sqlplus system/Oracle123@fgedudb

SQL*Plus: Release 11.2.0.4.0 Production on Fri Mar 29 10:00:00 2024
Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 – 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL>

17. 安装验证

验证Oracle 11gR2 RAC数据库是否安装成功。

— 检查数据库版本
SQL> SELECT * FROM v$version;

BANNER
——————————————————————————–
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 – 64bit Production
PL/SQL Release 11.2.0.4.0 – Production
CORE 11.2.0.4.0 Production
TNS for IBM AIX RISC System/6000: Version 11.2.0.4.0 – Production
NLSRTL Version 11.2.0.4.0 – Production

— 检查数据库状态
SQL> SELECT status FROM v$instance;
STATUS
————
OPEN

— 检查RAC实例
SQL> SELECT instance_name, status FROM gv$instance;
INSTANCE_NAME STATUS
—————- ————
fgedudb1 OPEN
fgedudb2 OPEN

— 检查数据文件状态
SQL> SELECT name, status FROM v$datafile;

NAME STATUS
————————————————– ——–
+DATA/fgedudb/system01.dbf SYSTEM
+DATA/fgedudb/sysaux01.dbf ONLINE
+DATA/fgedudb/undotbs01.dbf ONLINE
+DATA/fgedudb/undotbs02.dbf ONLINE
+DATA/fgedudb/users01.dbf ONLINE

— 检查表空间状态
SQL> SELECT tablespace_name, status FROM dba_tablespaces;

TABLESPACE_NAME STATUS
—————————— ——–
SYSTEM ONLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
UNDOTBS2 ONLINE
TEMP ONLINE
USERS ONLINE

— 检查ASM磁盘组
SQL> SELECT name, total_mb, free_mb FROM v$asm_diskgroup;

NAME TOTAL_MB FREE_MB
———- ———- ———-
DATA 102400 51200
OCR 2048 1024

— 检查ASM磁盘
SQL> SELECT name, path, total_mb FROM v$asm_disk;

NAME PATH TOTAL_MB
——– ————- ———-
DATA_0000 ORCL:DATA_0000 51200
DATA_0001 ORCL:DATA_0001 51200
OCR_0000 ORCL:OCR_0000 512
OCR_0001 ORCL:OCR_0001 512
OCR_0002 ORCL:OCR_0002 512

— 检查归档日志
SQL> SELECT name, sequence#, first_change# FROM v$archived_log ORDER BY sequence#;

NAME SEQUENCE# FIRST_CHANGE#
—————————————— ———- ————–
+DATA/FRA/fgedudb_1_1_123456789.arc 1 123456789
+DATA/FRA/fgedudb_1_2_123456789.arc 2 123456790

— 检查集群资源
$ crsctl status resource -t
——————————————————————————–
Name Target State Server State details
——————————————————————————–
Local Resources
——————————————————————————–
ora.DATA.dg
ONLINE ONLINE racnode1 STABLE
ONLINE ONLINE racnode2 STABLE
ora.OCR.dg
ONLINE ONLINE racnode1 STABLE
ONLINE ONLINE racnode2 STABLE
ora.LISTENER.lsnr
ONLINE ONLINE racnode1 STABLE
ONLINE ONLINE racnode2 STABLE
ora.asm
ONLINE ONLINE racnode1 Started,STABLE
ONLINE ONLINE racnode2 Started,STABLE
ora.gsd
OFFLINE OFFLINE racnode1 STABLE
OFFLINE OFFLINE racnode2 STABLE
ora.net1.network
ONLINE ONLINE racnode1 STABLE
ONLINE ONLINE racnode2 STABLE
ora.ons
ONLINE ONLINE racnode1 STABLE
ONLINE ONLINE racnode2 STABLE
——————————————————————————–
Cluster Resources
——————————————————————————–
ora.cssd
1 ONLINE ONLINE racnode1 STABLE
2 ONLINE ONLINE racnode2 STABLE
ora.diskmon
1 OFFLINE OFFLINE racnode1 STABLE
2 OFFLINE OFFLINE racnode2 STABLE
ora.evmd
1 ONLINE ONLINE racnode1 STABLE
2 ONLINE ONLINE racnode2 STABLE
ora.fgedudb.db
1 ONLINE ONLINE racnode1 Open,STABLE
2 ONLINE ONLINE racnode2 Open,STABLE
ora.mdnsd
1 ONLINE ONLINE racnode1 STABLE
2 ONLINE ONLINE racnode2 STABLE
生产环境建议:安装后建议进行全面的测试,包括功能测试、性能测试、安全测试等,确保RAC集群能够正常运行。from:www.itpux.com

18. 生产环境建议

以下是Oracle 11gR2 RAC集群安装的生产环境建议。

1. 内存配置:
– 每个节点SGA大小建议设置为物理内存的40%-60%
– 每个节点PGA大小建议设置为物理内存的10%-20%
– 配置适当的SGA_TARGET和PGA_AGGREGATE_TARGET
– 确保每个节点有足够的内存

2. ASM配置:
– 使用独立的物理磁盘或SAN存储
– 配置多个ASM磁盘组
– OCR和Voting Disk使用Normal或High冗余
– 定期检查ASM磁盘状态

3. 网络配置:
– 配置监听器使用VIP地址
– 使用SCAN地址简化连接
– 私网建议使用高速网络(如10GbE)
– 配置网络冗余

4. 安全配置:
– 定期修改数据库密码
– 限制SYSDBA权限
– 开启审计功能
– 定期应用安全补丁

5. 维护计划:
– 定期收集统计信息
– 定期重建索引
– 定期清理归档日志
– 定期检查表空间使用情况
– 定期进行数据库备份

6. 监控配置:
– 配置Enterprise Manager进行监控
– 设置告警阈值
– 监控集群资源状态
– 监控数据库性能指标
– 定期检查AWR报告

风哥提示:Oracle 11gR2 RAC是一个成熟稳定的高可用解决方案,适合生产环境使用。建议定期应用补丁,保持集群的安全性和稳定性。

本文由风哥教程整理发布,仅用于学习测试使用,转载注明出处:http://www.fgedu.net.cn/10327.html

联系我们

在线咨询:点击这里给我发消息

微信号:itpux-com

工作日:9:30-18:30,节假日休息