环境介绍:
安装步骤:
资源准备
Oracle_Enterprise-R5-U5-Server-x86_64-dvd.iso
openfiler-2.3-x86_64-disc1.iso
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
– database
linux.x64_11gR2_grid.zip
– Grid Infrastructure
oracleasm-2.6.18-194.el5-2.0.5-1.el5.x86_64.rpm
oracleasmlib-2.0.4-1.el5.x86_64.rpm
oracleasm-support-2.1.7-1.el5.x86_64.rpm
rlwrap-0.37-1.el5.x86_64.rpm
VNC-Viewer
FileZilla or WinSCP
资源下载地址
OEL、GI、DATABASE:
http://www.oracle.com https://support.oracle.com/
Openfiler
http://www.openfiler.com/community/download/
oracleasm相关软件包:
http://www.oracle.com/technetwork/server-storage/linux/downloads/rhel5-084877.html
Rlwrap软件:
http://www.rpmfind.net/linux/rpm2html/search.php?query=rlwrap
VNC-Viewer
http://www.realvnc.com/download/viewer/
FileZilla
http://filezilla-project.org/
WinSCP
http://winscp.net/
安装操作系统
用途 |
DNS服务器 |
数据库节点服务器 |
存储服务器 |
数量 |
1台 |
2台 |
1台 |
操作系统 |
OEL |
OEL |
Openfiler |
空间 |
20G以上 |
40G以上 |
10G以上 |
内存 |
1G |
3G以上 |
1G |
网卡 |
1块 |
5块 |
2块 |
分区 |
默认 |
/boot – 200M Swap – 3072M / – Free |
默认 |
安装包 |
Base |
Base、Gnome相关 |
默认 |
安全设置 |
SELinux Disable Iptables Disable |
SELinux Disable Iptables Disable |
默认 |
各项配置
1)配置DNS服务
以下操作在DNS服务器上进行:
安装bind三个包
# rpm -ivh bind-9.3.6-4.P1.el5_4.2.x86_64.rpm
# rpm -ivh bind-chroot-9.3.6-4.P1.el5_4.2.x86_64.rpm
# rpm -ivh caching-nameserver-9.3.6-4.P1.el5_4.2.x86_64.rpm
配置主区域
# cd /var/named/chroot/etc
# cp -p named.caching-nameserver.conf named.conf
# vi named.conf
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
allow-query-cache { any; };
};
logging {
channel default_debug {
file "data/named.run";
severity dynamic;
};
};
view localhost_resolver {
match-clients { any; };
match-destinations { any; };
recursion yes;
include "/etc/named.zones";
};
# cp -p named.rfc1912.zones named.zones
# vi named.zones
zone “bbk.com" IN {
type master;
file “bbk.com.zone";
allow-update { none; };
};
zone "77.168.192.in-addr.arpa" IN {
type master;
file "77.168.192.local";
allow-update { none; };
};
# cd /var/named/chroot/var/named
# cp -p named.zero bbk.com.zone
# cp -p named.local 77.168.192.local
# vi bbk.com.zone
$TTL 86400
@ IN SOA dns.bbk.com. root.bbk.com. (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS dns.bbk.com.
scan IN A 192.168.77.195
scan IN A 192.168.77.196
scan IN A 192.168.77.197
# vi 77.168.192.local
$TTL 86400
@ IN SOA dns.bbk.com. root.bbk.com. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS dns.bbk.com.
195 IN PTR scan.bbk.com.
196 IN PTR scan.bbk.com.
197 IN PTR scan.bbk.com.
# service named restart
# chkconfig named on
nslookup或 dig检查
2)网络配置
用途 |
DNS服务器 |
数据库节点1 |
数据库节点2 |
存储服务器 |
桥接模式 |
IP:192.168.77.145 GW:192.168.77.250 |
IP:192.168.77.191 GW:192.168.77.250 |
IP:192.168.77.192 GW:192.168.77.250 |
IP:192.168.77.240 GW:192.168.77.250 |
Net模式 |
|
IP:192.168.60.191 |
IP:192.168.60.192 |
|
Host Only 模式 |
|
IP:10.0.60.191 |
IP:10.0.60.192 |
IP:10.0.60.240 |
Name |
Public |
Private |
Vip |
SCAN |
RAC Node1 |
rac1.bbk.com |
rac1-priv.bbk.com |
rac1-vip.bbk.com |
rac-scan |
RAC Node2 |
rac2.bbk.com |
rac2-priv.bbk.com |
rac2-vip.bbk.com |
rac-scan |
IP |
Public |
Private |
Vip |
SCAN |
RAC Node1 |
192.168.77.191 |
192.168.60.191 |
192.168.77.193 |
192.168.77.195\DNS 192.168.77.196\DNS 192.168.77.197\DNS |
RAC Node2 |
192.168.77.192 |
192.168.60.192 |
192.168.77.194 |
网络配置 – 网卡绑定
以下操作RAC每个节点同样进行:
# vi /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.77.191
NETMASK=255.255.255.0
TYPE=Ethernet
USERCTL=no
BONDING_OPTS="mode=1 miimon=100”
# vi /etc/sysconfig/network-scripts/ifcfg-bond1
DEVICE=bond1
BOOTPROTO=none
ONBOOT=yes
IPADDR=192.168.60.191
NETMASK=255.255.255.0
TYPE=Ethernet
USERCTL=no
BONDING_OPTS="mode=1 miimon=100”
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
MASTER=bond0
SLAVE=yes
# vi /etc/sysconfig/network-scripts/ifcfg-eth1
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth1
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
MASTER=bond0
SLAVE=yes
# vi /etc/sysconfig/network-scripts/ifcfg-eth2
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth2
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
MASTER=bond1
SLAVE=yes
# vi /etc/sysconfig/network-scripts/ifcfg-eth3
# Intel Corporation 82545EM Gigabit Ethernet Controller (Copper)
DEVICE=eth3
BOOTPROTO=none
ONBOOT=yes
USERCTL=no
MASTER=bond1
SLAVE=yes
# echo "alias bond0 bonding" >> /etc/modprobe.conf
# echo "alias bond1 bonding" >> /etc/modprobe.conf
# modprobe bonding
# vi /etc/sysconfig/network
添加
GATEWAY=192.168.77.250
# service network restart
# vi /etc/hosts
# For Public
192.168.77.191 rac1.bbk.com rac1
192.168.77.192 rac2.bbk.com rac2
# For VIP
192.168.77.193 rac1-vip.bbk.com rac1-vip
192.168.77.194 rac2-vip.bbk.com rac2-vip
# For Private
192.168.60.191 rac1-priv.bbk.com rac1-priv
192.168.60.192 rac2-priv.bbk.com rac2-priv
# For SCAN IP With DNS
# vi /etc/resolv.conf
search bbk.com
nameserver 192.168.77.145
3)快速配置YUM源,并安装所需软件包
以下操作RAC每个节点同样进行:
# vi /etc/yum.repos.d/my.repo
[Oracle]
name=OEL-$releasever – Media
baseurl=file:///mnt/Server
gpgcheck=0
enabled=1
如果是RHEL或者CentOS,请先将/etc/yum.repos.d下面的文件删除或者移动到别的目录下,RHEL创建方法和OEL一样,CentOS则baseurl=file:///mnt/ 即可,因为CentOS的repodata目录就在光盘根下。
配置好YUM,然后进行所需软件包的安装
# yum -y install compat-libstdc++-33 elfutils-libelf-devel gcc gcc-c++ glibc-devel glibc-headers libaio-devel libstdc++-devel sysstat unixODBC unixODBC-devel
4)参数修改
以下操作RAC每个节点同样进行:
# cat >> /etc/sysctl.conf << EOF
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
EOF
# /sbin/sysctl -p
# cat >> /etc/profile <
if [ \$USER = "oracle" ] || [ \$USER = "grid" ]; then
if [ \$SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
umask 022
fi
EOF
# cat >> /etc/security/limits.conf <
grid soft nofile 1024
grid hard nofile 65536
grid soft nproc 2047
grid hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
EOF
# cat >> /etc/pam.d/login << EOF
session required /lib64/security/pam_limits.so
EOF
5)添加组和用户
以下操作RAC每个节点同样进行:
groupadd -g 1000 oinstall
groupadd -g 1300 dba
groupadd -g 1301 oper
groupadd -g 1201 asmdba
groupadd -g 1200 asmadmin
groupadd -g 1202 asmoper
useradd -m -u 1100 -g oinstall -G asmadmin,asmdba,asmoper -d /home/grid -s /bin/bash -c "Grid Infrastructure Owner" grid
passwd grid
useradd -m -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle
passwd oracle
6)创建目录、授权
以下操作RAC每个节点同样进行:
mkdir -p /u01/app/grid
mkdir -p /u01/app/11.2.0/grid
chown -R grid:oinstall /u01
mkdir -p /u01/app/oracle
chown oracle:oinstall /u01/app/oracle
chmod -R 775 /u01
7)环境变量
NODE1 |
NODE2 |
$ whoami $ whoami alias sqlplus="rlwrap sqlplus" |
$ whoami $ whoami alias sqlplus="rlwrap sqlplus" |
8)Openfiler划分存储空间
以下操作在Openfiler服务器上执行:
CRS1 2G
CRS2 2G
CRS3 2G
DATA 6G
ARCH 5G
9)Iscsi挂载磁盘并fdisk分区
以下操作RAC每个节点同样进行:
# yum -y install iscsi-initiator-utils
# service iscsid start
# chkconfig iscsid on
# iscsiadm -m discovery -t sendtargets -p 10.0.60.240:3260
# service iscsi restart
Stopping iSCSI daemon:
iscsid dead but pid file exists
[ OK ] iSCSI daemon: [ OK ]
[ OK ]
Setting up iSCSI targets: Logging in to [iface: default, target: iqn.2006-01.com.openfiler:tsn.c7002bcb1d62, portal: 10.0.60.240,3260]
Login to [iface: default, target: iqn.2006-01.com.openfiler:tsn.c7002bcb1d62, portal: 10.0.60.240,3260]: successful
[ OK ]
以下操作RAC其中一个节点进行:
# fdisk /dev/sdb
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel. Changes will remain in memory only,
until you decide to write them. After that, of course, the previous
content won't be recoverable.
Warning: invalid flag 0×0000 of partition table 4 will be corrected by w(rite)
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1009, default 1): 10
Last cylinder or +size or +sizeM or +sizeK (10-1009, default 1009):
Using default value 1009
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
Syncing disks.
类似的,其他的磁盘也格式化
# fdisk /dev/sd[b-f]
# partprobe /dev/sd[b-f]
查看
# fdisk -l
10)创建ASM磁盘
以下操作RAC每个节点同样进行:
# rpm –ivh oracleasm*
# /etc/init.d/oracleasm configure
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
以下操作RAC其中一个节点上进行,NODE1:
# /etc/init.d/oracleasm createdisk VOL1 /dev/sdb1
# /etc/init.d/oracleasm createdisk VOL2 /dev/sdc1
# /etc/init.d/oracleasm createdisk VOL3 /dev/sdd1
# /etc/init.d/oracleasm createdisk VOL2 /dev/sde1
# /etc/init.d/oracleasm createdisk VOL3 /dev/sdf1
以下操作RAC另一个节点上进行,NODE2:
# oracleasm scandisks
11)禁用NTP服务
以下操作RAC每个节点同样进行:
# service ntpd stop
# chkconfig ntpd off
# mv /etc/ntp.conf /etc/ntp.conf.bak
12)配置VNC服务
以下操作RAC其中一个节点上进行,NODE1:
# yum -y install vnc-server
启动
# vncserver :1
# vi ~/.vnc/xstartup
#twm & 将此行注释
gnome-session &
停止
# vncserver -kill :1
13)上传软件并解压
用WinSCP将软件上传到服务器上,看演示
以下操作RAC其中一个节点上进行,开启VNC服务的节点,NODE1:
# chown -R grid.oinstall /install/
# su – grid
$ unzip linux.x64_11gR2_grid.zip
# chmod 775 /install
# chown oracle.oinstall /install/linux.x64_11gR2_database_[1,2]of2.zip
# su – oracle
$ unzip linux.x64_11gR2_database_1of2.zip
$ unzip linux.x64_11gR2_database_2of2.zip
各项检查
略。
安装GI和数据库
1)安装GI
打开VNC-Viewer软件,输入服务端IP地址,连接。
以下操作RAC其中一个节点上进行,NODE1:
# xhost +
# su – grid
$ cd /install/grid/
$ ./runInstaller
以下操作RAC每个节点同样进行:
Root用户执行两个脚本
# /u01/app/oraInventory/orainstRoot.sh
# /u01/app/11.2.0/grid/root.sh
2)创建ASM磁盘组
以下操作RAC其中一个节点上进行,NODE1:
# su – grid
$ asmca
3)安装database software
以下操作RAC其中一个节点上进行,NODE1:
# xhost +
# su – oracle
$ cd /install/database/
$ ./runInstaller
以下操作RAC每个节点同样进行:
root用户执行脚本
# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
4)安装database
以下操作RAC其中一个节点上进行,NODE1:
# xhost +
# su – oracle
$ dbca
5)检查
检查crs资源状态
# su – grid
$ crs_stat –t –v
11.2.0.1版本BUG解决
BUG描述:无法通过SCAN连接到数据库,解决方法:
# su – oracle
$ sqlplus / as sysdba
SQL> show parameter local_listener
SQL> show parameter remote_listener
SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.77.193)(PORT = 1521))))' sid='bbk1';
SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.77.194)(PORT = 1521))))' sid='bbk2';
SQL> alter system set remote_listener='scan.bbk.com:1521';
SQL> alter system register;
开启归档
SQL> archive log list
发现没开启归档
SQL> create pfile='/u01/pfile-0802.bak' from spfile;
SQL> alter system set log_archive_dest_1='LOCATION=+ARCH';
# su – grid
$ srvctl stop database -d bbk
$ srvctl start database -d bbk -o mount — 启动到mount模式
NODE1:
SQL> alter database archivelog;
SQL> alter database open;
NODE2:
SQL> alter database open;
测试:
SQL> select name from v$archived_log;
SQL> alter system switch logfile;
SQL> select name from v$archived_log;
客户端连接测试(配置TNS服务)
BBKSCAN =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan.rac.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = bbk)
)
)