redhat6.5-oracle11gR2-Grid搭建RAC
软件列表:linux软件:rhel-server-6.5-x86_64-dvd.isolinux.x64_11gR2_grid.ziplinux.x64_11gR2_database_1of2.ziplinux.x64_11gR2_database_2of2.zipWindows软件:Xftp5.exexmgr5_wm.exeXshell_5.0.0.37_se...
软件列表:
linux软件:
rhel-server-6.5-x86_64-dvd.iso
linux.x64_11gR2_grid.zip
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
Windows软件:
Xftp5.exe
xmgr5_wm.exe
Xshell_5.0.0.37_setup.1459931786.exe
RPM包:
yum包:
python-iniparse-0.3.1-2.1.el6.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
yum-3.2.29-40.el6.centos.noarch.rpm
yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
XStart包:
glibc-2.15-60.el6.i686.rpm
glibc-devel-2.15-60.el6.i686.rpm
glibc-utils-2.15-60.el6.x86_64.rpm
glibc-2.15-60.el6.x86_64.rpm
glibc-common-2.15-60.el6.x86_64.rpm
glibc-static-2.15-60.el6.x86_64.rpm
glibc-static-2.15-60.el6.i686.rpm
glibc-devel-2.15-60.el6.x86_64.rpm
glibc-headers-2.15-60.el6.x86_64.rpm
libXaw-1.0.13-4.el7.x86_64.rpm
xterm-253-1.el6.x86_64.rpm
注:以下没有特殊说明,2台机器均进行配置
一、安装redhat6.5.(2台机器)。rac1,rac2.
注意:1.默认英文,hostname=rac1/rac2.
2.每台机器挂2块网卡。
二、本机windows安装xshell,xftp,xmanager(包含有XStart)。
三、规划网络
2台机器,每台机器2块网卡:
rac1 | rac2 | |
scan | 192.168.192.10 | |
public | 192.168.192.11 | 192.168.192.12 |
vip | 192.168.192.13 | 192.168.192.14 |
private | 192.168.220.11 | 192.168.220.12 |
四、检查机器名称是否为rac1,rac2
hostname
vi /etc/sysconfig/network
五、配置网卡地址-根据规划(RAC1-RAC2)-每块网卡都配置上。
vi /etc/sysconfig/network-scripts/ifcfg-eth*
DEVICE=eth0 #网卡对应的设备别名
BOOTPROTO=static #网卡获得ip地址的方式(默认为dhcp,表示自动获取)
HWADDR=00:07:E9:05:E8:B4 #网卡MAC地址(物理地址)
IPADDR=192.168.192.12 #IP地址(配置private ip即可)
NETMASK=255.255.255.0 #子网掩码
ONBOOT=yes #系统启动时是否激活此设备
vi /etc/sysconfig/network
加
GATEWAY=192.168.192.1
六、转换到xshell进行连接使用
七、关闭防火墙和SELINUX
service iptables stop
chkconfig --level 12345 iptables off
chkconfig iptables --list
service iptables status
vi /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
reboot --重启操作系统
八、启用FTP服务。
1.测试ftp软件包是否安装: rpm -qa|grep ftp
查看有没有vsftpd项目,没有进行安装。
2.挂载光驱
把linux redhat 6.5 安装光盘放入光驱 执行下面的命令
cd /mnt
mkdir cdrom
mount -o remount,rw /dev/cdrom /mnt/cdrom
mount /dev/cdrom /mnt/cdrom
cd /mnt/cdrom/Packages
3.安装软件包
cd /mnt/cdrom/Packages
安装ftp服务程序
rpm -ivh ftp-0.17-54.el6.x86_64.rpm
rpm -ivh vsftpd-2.2.2-11.el6_4.1.x86_64.rpm
4.开启ftp服务
service vsftpd start
5.查看状态
service vsftpd status
九、安装yum进行rpm包安装
1.由于redhat6.5的yum在没有注册的情况下不允许使用,现在使用centos的yum。
2.备份原来的yum配置
cd /etc/yum.repos.d/
cp rhel-source.repo rhel-source.repo.bak
3.卸载原来的yum.
rpm -qa | grep yum | xargs rpm -e --nodeps
4.重新安装yum(将文件上传通过配置好的ftp上传到服务器的-/upload目录)
mkdir /upload
##ftp上传到upload
cd /upload
rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
5.文件配置修改
cd /etc/yum.repos.d/
vi rhel-source.repo
--文件内容替换为
[rac-source]
name=Red Hat Enterprise Linux $releasever - $basearch - Source
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
6.重启(可以不重启,如果有问题,可以重启再试一下)
reboot
7.重置缓存
yum clean all
yum makecache
8.如果已经挂载了光驱redhat6.5则不需要再进行操作(即:已经操作了8.2的步骤,否则按照8.2执行一下。重启后需要重新挂载)
9.验证是否成功
yum grouplist | grep Server
十、配置依赖包
yum install -y binutils-* compat-libstdc++-33-* elfutils-libelf-* elfutils-libelf-devel-* gcc-* gcc-c++-* glibc-* glibc-common-* glibc-devel-* glibc-headers-* ksh-* libaio-* libgcc-* libstdc++-* make-* sysstat-* unixODBC-* unixODBC-devel-* compat-libcap*
十一、修改主机HOSTS映射
vi /etc/hosts
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.192.11 rac1
192.168.192.12 rac2
192.168.220.11 rac1priv
192.168.220.12 rac2priv
192.168.192.13 rac1vip
192.168.192.14 rac2vip
192.168.192.10 racscanip
十二、系统参数修改
vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
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
生效:
sysctl -p
vi /etc/security/limits.conf
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
十三、增加组、用户、目录
groupadd -g 1000 oinstall
groupadd -g 1100 asmadmin
groupadd -g 1200 dba
groupadd -g 1300 asmdba
groupadd -g 1301 asmoper
useradd -u 1100 -g oinstall -G asmadmin,asmdba,asmoper -d /home/grid grid
useradd -u 1101 -g oinstall -G dba,asmdba -d /home/oracle oracle
echo grid | passwd --stdin grid
echo oracle | passwd --stdin oracle
mkdir -p /oracle/app/oraInventory
chown -R grid:oinstall /oracle/app/oraInventory
chmod -R 775 /oracle/app/oraInventory
mkdir -p /oracle/11.2.0/grid
mkdir -p /oracle/app/grid
chown -R grid:oinstall /oracle/app/grid
chown -R grid:oinstall /oracle/11.2.0/grid
chmod -R 775 /oracle/11.2.0/grid
mkdir -p /oracle/app/oracle
mkdir /oracle/app/oracle/cfgtoollogs
chown -R oracle:oinstall /oracle/app/oracle
chmod -R 775 /oracle/app/oracle
mkdir -p /oracle/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /oracle/app/oracle/product/11.2.0/db_1
chmod -R 775 /oracle/app/oracle/product/11.2.0/db_1
十四、配置环境变量、互信
rac1
su - grid
vi .bash_profile
export ORACLE_SID=+ASM1
export ORACLE_BASE=/oracle/app/grid
export ORACLE_HOME=/oracle/11.2.0/grid
export PATH=$ORACLE_HOME/bin:$PATH
rac2
su - grid
vi .bash_profile
export ORACLE_SID=+ASM2
export ORACLE_BASE=/oracle/app/grid
export ORACLE_HOME=/oracle/11.2.0/grid
export PATH=$ORACLE_HOME/bin:$PATH
rac1
su - oracle
vi .bash_profile
export ORACLE_SID=racdb1
export ORACLE_BASE=/oracle/app/oracle
export ORACLE_HOME=/oracle/app/oracle/product/11.2.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH
rac2
su - oracle
vi .bash_profile
export ORACLE_SID=racdb2
export ORACLE_BASE=/oracle/app/oracle
export ORACLE_HOME=/oracle/app/oracle/product/11.2.0/db_1
export PATH=$ORACLE_HOME/bin:$PATH
互信配置:
ftp上传文件oracle和grid到upload文件夹中,使用unzip 进行解压。
rac1
root用户执行
/upload/grid/sshsetup/sshUserSetup.sh -user grid -hosts "rac1 rac2" -advanced -noPromptPassphrase
/upload/grid/sshsetup/sshUserSetup.sh -user oracle -hosts "rac1 rac2" -advanced -noPromptPassphrase
rac1&rac2
su - grid
ssh rac1 date
ssh rac2 date
ssh rac1priv date
ssh rac2priv date
su - oracle
ssh rac1 date
ssh rac2 date
ssh rac1priv date
ssh rac2priv date
十五、配置裸设备
1.虚拟机的步骤-创建磁盘,在wmware的安装目录下,打开cmd执行。
vmware-vdiskmanager.exe -c -s 3072Mb -a lsilogic -t 2 "G:\VMwareSpace\RAC\share\ocr_vote.vmdk
vmware-vdiskmanager.exe -c -s 3072Mb -a lsilogic -t 2 "G:\VMwareSpace\RAC\share\fra.vmdk
vmware-vdiskmanager.exe -c -s 10240Mb -a lsilogic -t 2 "G:\VMwareSpace\RAC\share\data.vmdk
2.rac1和rac2节点的虚拟机配置文件(wmx)增加:
scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"
scsi1.sharedBus = "VIRTUAL"
scsi1:1.present = "TRUE"
scsi1:1.mode = "independent-persistent"
scsi1:1.fileName = "G:\VMwareSpace\RAC\share\ocr_vote.vmdk"
scsi1:1.deviceType = "disk"
scsi1:2.present = "TRUE"
scsi1:2.mode = "independent-persistent"
scsi1:2.fileName = "G:\VMwareSpace\RAC\share\fra.vmdk"
scsi1:2.deviceType = "disk"
scsi1:3.present = "TRUE"
scsi1:3.mode = "independent-persistent"
scsi1:3.fileName = "G:\VMwareSpace\RAC\share\data.vmdk"
scsi1:3.deviceType = "disk"
disk.locking = "FALSE"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.dataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize = "4096"
diskLib.maxUnsyncedWrites = "0"
3.查看磁盘
fdisk -l
ls /dev/sd*
4.分区操作:
fdisk /dev/sdb --其他的也一样(按照命令提示进行操作-默认建一个分区即可--只需要在一台机器上执行就可以,另一台机器更新分区表。)
partprobe --更新分区表
5.挂载裸设备
vi /etc/udev/rules.d/60-raw.rules
ACTION=="add", KERNEL=="sdb1",RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", KERNEL=="sdc1",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", KERNEL=="sdd1",RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add",KERNEL=="raw*", OWNER="grid", GROUP="asmadmin", MODE="660"
start_udev --生效
查询
raw -qa
ls -l /dev/raw
十六、开始安装grid(只需在rac1进行安装即可)
1.关闭服务(rac1&rac2)
service iptables stop
chkconfig autofs off
chkconfig acpid off
chkconfig sendmail off
chkconfig cups-config-daemon off
chkconfig cpus off
chkconfig xfs off
chkconfig lm_sensors off
chkconfig gpm off
chkconfig openibd off
chkconfig pcmcia off
chkconfig cpuspeed off
chkconfig nfslock off
chkconfig iptables off
chkconfig ip6tables off
chkconfig rpcidmapd off
chkconfig apmd off
chkconfig sendmail off
chkconfig arptables_jf off
chkconifg microcode_ctl off
chkconfig rpcgssd off
chkconfig ntpd off
2.开始安装(XStart执行:命令:/usr/bin/xterm -ls -display $DISPLAY)--图形化界面安装
cd /upload/grid/
./runInstaller
注:
A.其他问题的解决(提示没有swap分区)
以root用户:
swapoff -a
fdisk 创建swap分区-id->82
mkswap /dev/sda1
swapon /dev/sda1
vi /etc/fstab
增加交换分区配置,具体链接:http://blog.51cto.com/hancj/197915
B.使用xstart安装:
rpm -Uvh glibc-2.15-60.el6.i686.rpm glibc-devel-2.15-60.el6.i686.rpm glibc-utils-2.15-60.el6.x86_64.rpm glibc-2.15-60.el6.x86_64.rpm glibc-common-2.15-60.el6.x86_64.rpm glibc-static-2.15-60.el6.x86_64.rpm glibc-static-2.15-60.el6.i686.rpm glibc-devel-2.15-60.el6.x86_64.rpm glibc-headers-2.15-60.el6.x86_64.rpm --nodeps
rpm -ivh libXaw-1.0.13-4.el7.x86_64.rpm
rpm -ivh xterm-253-1.el6.x86_64.rpm
C.配置xstart的时候要使用grid用户进行登录。
D.其他注意内容
step 5 of 16
SCAN NAME:racscanip
step 6 of 16
rac1 rac1vip
rac2 rac2vip
step 7 of 16
eth0 192.168.192.11 public
eth1 192.168.220.11 private
step 8 of 16
Oracle ASM
step 9 of 16
Disk Group Name:DATA
Redundancy:External
Disk Path:/dev/raw/raw3
step 13 of 16
Oracle Base:/oracle/app/grid
Software Location:/oracle/11.2.0/grid
中间有2个脚本执行,root用户执行,按顺序执行,如果root报错,(oracle11g的一个bug)
执行:/bin/dd if=/var/tmp/.oracle/npohasd of=/dev/nullbs=1024 count=1
帮助连接:http://blog.sina.com.cn/s/blog_49d991b60101p2bl.html
回退执行:/oracle/11.2.0/grid/crs/install/roothas.pl -deconfig -force -verbose
E.查看安装情况
su - grid
crs_stat -t
F.启动CRS
crs_start -all
G.重启后节点crs没有启动,进行执行(等一段时间)
crs_stat -a
/bin/dd if=/var/tmp/.oracle/npohasd of=/dev/nullbs=1024 count=1
crs_start -all
crsctl check has
等一段时间后,则连接成功。
十七、安装数据库软件(只在rac1上操作即可)
1.使用ftp将database-11gR2上传到upload目录,使用unzip进行解压(总共2个文件按顺序进行解压)。
2.xstart使用oracle用户连接登录后进行操作(命令:/usr/bin/xterm -ls -display $DISPLAY)
cd /upload/database
./runInstaller
注意:选择不检查更新,只安装数据库软件,选择所有集群节点,目录等默认(环境变量已经配置)。对于检查时钟的异常:通过date命令查看2台机器的时间,如果一致,则忽略所有即可。
十八、创建数据库(只在rac1上操作即可)-->SID=[racdb]--与前边的环境变量设置一致。
1.使用xstart执行命令dbca创建数据库。
su - oracle
dbca
2.创建过程中可以使用asmca进行创建磁盘组。
su - grid
asmca
注意:创建完成后需要检查,磁盘组是否挂载到所有节点上了,如果没有使用mount按钮重新挂载,防止出现挂载失败。
十九、数据库安装完成并进行连接
1.使用scanip配置连接(TNS配置)。
RACDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.192.10)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = racdb)
)
)
2.hibenate连接的时候直接写ip有可能无法连接可以将连接字符串改为:
(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.192.10)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=racdb)))
二十、配置完成后,发现启动数据库报错(无法连接等相关问题处理)
1.启动数据库
su - oracle
sqlplus /nolog
conn / as sysdba
startup
2.报错LRM-00109(前序环境变量配置的问题,调整后则没有问题了,如果出现检查这个名称是否正确。):
RAC1:LRM-00109: could not open parameter file '/oracle/app/oracle/product/11.2.0/db_1/dbs/init+racdb1.ora'
RAC2:LRM-00109: could not open parameter file '/oracle/app/oracle/product/11.2.0/db_1/dbs/init+racdb2.ora'
经过排查发现目录下没有该文件,将目录下的initracdb1.ora copy 一份 init+racdb1.ora(RAC2同样)
RAC1:
cd /oracle/app/oracle/product/11.2.0/db_1/dbs/
cp initracdb1.ora init+racdb1.ora
RAC2:
cd /oracle/app/oracle/product/11.2.0/db_1/dbs/
cp initracdb2.ora init+racdb2.ora
3.报错:ORA-00845: MEMORY_TARGET not supported on this system
原因具体查看:http://www.linuxidc.com/Linux/2012-12/76976.htm
使用root用户去调整,调整完成后su - oracle重新启动
cat /etc/fstab | grep tmpfs
mount -o remount,size=2G /dev/shm
cat /etc/fstab | grep tmpfs
vi /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=2g 0 0
df -h|grep shm
4查看数据库的相关信息
su - oracle
sqlplus /nolog
conn / as sysdba
set line 300
show parameter spfile;
show parameter instance_name;
show parameter listener;
5.客户端连接RAC:报ORA-12545错误。
参见文章:http://blog.csdn.net/cymm_liu/article/details/40405775
处理:
show parameter spfile;
show parameter instance_name;
show parameter listener;
查看结果:
(address=(protocol=tcp)(host=rac1vip)(port = 1521))
(address=(protocol=tcp)(host=rac2vip)(port = 1521))
由于在科幻端无法进行解析rac1vip,rac2vip是啥,所以要调整为真实ip地址,则可以进行联通。
操作命令:
rac1:
alter system set local_listener='(address=(protocol=tcp)(host=192.168.192.13)(port = 1521))' sid='racdb1';
alter system register;
rac2:
alter system set local_listener='(address=(protocol=tcp)(host=192.168.192.14)(port = 1521))' sid='racdb2';
alter system register;
6.常用命令
a.创建数据库实例:
su - oracle
dbca
b.检查鉴定状态
su - oracle
lsnrctl status
c.grid运行情况
su - grid
crs_stat -t
d.启动CRS--如果没有正常启动,通过该命令进行启动。
su - grid
crs_start -all
e.增加磁盘组
su - grid
asmca
-----------------------------------------------------------------------------------------------------------------
觉得有用打赏作者
更多推荐
所有评论(0)