本文讲述了在Redhat 6.5 上安装Oracle 11.2 RAC的详细步骤,是一篇step by step指南,全文没有什么技术难度,只要一步步跟着做就一定能安装成功。
分类 | 项目 | 说明 |
虚拟环境 | 配置 | virtual box创建的两台虚拟机,3G内存1核 |
具体网络IP地址 |
#public ip #virtaul ip #private ip 10.0.0.4 vastdata4 #vastdata-scan |
|
数据库 | Oracle版本 | Oracle 11.2 64位 |
运行模式 | RAC | |
ORACLE ASM |
DATA 5G * 1 |
|
数据库软件 |
p10404530_112030_LINUX_1of7.zip |
1.搭建RAC架构前的准备工作
1.1安装VirtualBox自带的增强功能(与VMware虚拟机的VM Tools功能相仿)
当前系统无法建立内核模块,运行Linux内核头文件:
yum install kernel-devel-2.6.32-431.el6.x86_64
特别注意:设置共享剪切板和拖放的选项是双向,重启虚拟机后,即可复制粘贴文本,拖放文件。
1.2关闭一系列服务
关闭防火墙
service iptables stop(当前关闭,重启无效) chkconfig iptables off(更改文件,重启生效)
关闭网络管理服务
service NetworkManager stop chkconfig NetworkManager off
1.3修改配置文件信息
修改selinux设置
vim /etc/selinux/config
修改内核设置
vim /etc/grub.conf
1.4配置网络:绑定网卡
1.4.1相关概念
Bonding(绑定)是一种Linux系统下的网卡绑定技术,可以把服务器上n个物理网卡在系统内部抽象(绑定)成一个逻辑上的网卡,能够提升网络吞吐量、实现网络冗余、负载等功能,有很多优势。 Bonding 技术是 Linux 系统内核层面实现的,它是一个内核模块(驱动)。使用它需要系统有这个模块,我们可以modinfo命令查看下这个模块的信息,一般来说都支持。
1.4.2工作模式
Bonding提供了7种工作模式,在使用的时候需要指定一种,每种有各自的优缺点。在这里仅粗略介绍3种工作模式:
mode=0 balance-rr 默认。有高可用(容错)和负载均衡的功能,需要交换机的配置,每块网卡轮询发包(流量分发比较均衡)
mode=1 active-backup 只有高可用功能,不需要交换机配置,这种模式只有一块网卡工作,对外只有一个MAC地址。缺点是端利用口率比较低
mode=6 balance-alb 有高可用 ( 容错 ) 和负载均衡的功能,不需要交换机配置 ( 流量分发到每个接口不是特别均衡 )
1.4.3绑定步骤
关闭虚拟机,添加一块物理网卡设备,重启虚拟机。
1.4.4.1加载Bonding模块
[root@vastdata3 Desktop]# modprobe --first-time bonding
1.4.4.2查看模块是否被加载
[root@vastdata3 Desktop]# lsmod | grep bonding
1.4.4.3创建基于bond0接口的配置文件
[root@vastdata4 named]# cat /etc/sysconfig/network-scripts/ifcfg-bond0 DEVICE=bond0 TYPE=Bond IPADDR=192.168.0.12 NETMASK=255.255.255.0 USERCTL=no BOOTPROTO=none ONBOOT=yes BONDING_MASTER=yes BONDING_OPTS="mode=0 miimon=100" ---工作模式、监视网络链接的频度(毫秒)
1.4.4.4修改eth0接口的配置文件
[root@vastdata4 named]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 USERCTL=no ONBOOT=yes MASTER=bond0 SLAVE=yes BOOTPROTO=none
1.4.4.5修改eth1接口的配置文件
[root@vastdata4 named]# cat /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE=eth1 USERCTL=no ONBOOT=yes MASTER=bond0 SLAVE=yes BOOTPROTO=none
1.4.4.6追加dist.conf配置文件
[root@vastdata4 named]# vim /etc/modprobe.d/dist.conf alias bond0 bonding options bonding miimon=100 mode=0
1.4.4.7测试
重启网络服务
[root@vastdata3 Desktop]# service network restart
查看bond0接口的状态信息
[root@vastdata4 named]# cat /proc/net/bonding/bond0 Ethernet Channel Bonding Driver: v3.6.0 (September 26, 2009) Bonding Mode: load balancing (round-robin) MII Status: up MII Polling Interval (ms): 100 Up Delay (ms): 0 Down Delay (ms): 0 Slave Interface: eth0 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 0 Permanent HW addr: 08:00:27:ef:f6:15 Slave queue ID: 0 Slave Interface: eth1 MII Status: up Speed: 1000 Mbps Duplex: full Link Failure Count: 1 Permanent HW addr: 08:00:27:82:3a:57 Slave queue ID: 0
1.4.4.8查看网卡信息
[root@vastdata4 named]# ifconfig bond0 Link encap:Ethernet HWaddr 08:00:27:EF:F6:15 inet addr:192.168.0.12 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:feef:f615/64 Scope:Link UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1 RX packets:348 errors:0 dropped:0 overruns:0 frame:0 TX packets:376 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:32868 (32.0 KiB) TX bytes:25441 (24.8 KiB) eth0 Link encap:Ethernet HWaddr 08:00:27:EF:F6:15 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:321 errors:0 dropped:0 overruns:0 frame:0 TX packets:188 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:31248 (30.5 KiB) TX bytes:12386 (12.0 KiB) eth1 Link encap:Ethernet HWaddr 08:00:27:EF:F6:15 UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1 RX packets:27 errors:0 dropped:0 overruns:0 frame:0 TX packets:188 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:1620 (1.5 KiB) TX bytes:13055 (12.7 KiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:177 errors:0 dropped:0 overruns:0 frame:0 TX packets:177 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:16325 (15.9 KiB) TX bytes:16325 (15.9 KiB)
1.5添加private私网物理网卡设备
添加两块物理网卡设备,桥接网络,10.0.0.0网段,修改配置文件,重启网络服务。
1.6配置DNS
1.6.1配置主域名解析服务器
1.6.1.1通过yum安装
[root@vastdata3 Desktop]# yum install bind bind-chroot -y
1.6.1.2修改DNS主配置文件
[root@vastdata3 Desktop]# cd /etc/ [root@vastdata3 etc]# vim named.conf [root@vastdata3 etc]# cp -p named.conf named.conf.bak [root@vastdata3 Desktop]# cat /etc/named.conf // // named.conf // // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS // server as a caching only nameserver (as a localhost DNS resolver only). // // See /usr/share/doc/bind*/sample/ for example named configuration files. // options { listen-on port 53 { any; }; directory "/var/named"; allow-query { any; }; allow-query-cache { any; }; recursion no; }; zone "." IN { type hint; file "named.ca"; }; zone "us.oracle.com" IN { type master; file "us.oracle.com.zone"; } zone "0.168.192.in-addr.arpa" IN { type master; file "192.168.0.local"; };
1.6.1.3配置正向域名解析文件
[root@vastdata3 Desktop]# cd /var/named/ [root@vastdata3 named]# cp -p named.localhost us.oracle.com.zone [root@vastdata3 named]# cp -p us.oracle.com.zone 192.0.2.local [root@vastdata3 Desktop]# cat /var/named/us.oracle.com.zone $TTL 1D @ IN SOA vastdata3.us.oracle.com. root.us.oracle.com. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS dns.us.oracle.com. vastdata3 A 192.168.0.11 vastdata4 A 192.168.0.12 vastdata-scan A 192.168.0.33 vastdata-scan A 192.168.0.34 vastdata-scan A 192.168.0.35 dns A 192.168.0.44 vastdata3-vip A 192.168.0.22 vastdata4-vip A 192.168.0.23 vastdata3-priv1 A 10.0.0.2 vastdata3-priv2 A 10.0.0.3 vastdata4-priv1 A 10.0.0.4 vastdata4-priv2 A 10.0.0.5
1.6.1.4配置反向域名解析文件
[root@vastdata3 Desktop]# cat /var/named/192.168.0.local $TTL 1D @ IN SOA vastdata3.us.oracle.com. root.us.oracle.com. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum IN NS dns.us.oracle.com. 11 IN PTR vastdata3.us.oracle.com. 12 IN PTR vastdata4.us.oracle.com. 33 IN PTR vastdata-scan.us.oracle.com. 34 IN PTR vastdata-scan.us.oracle.com. 35 IN PTR vastdata-scan.us.oracle.com. 44 IN PTR dns 22 IN PTR vastdata-vip.us.oracle.com. 23 IN PTR vastdata-vip.us.oracle.com.
1.6.1.5重启网络服务
[root@vastdata3 Desktop]# service network restart
1.6.1.6重启named服务并设置为开机启动
[root@vastdata3 Desktop]# service named restart [root@vastdata3 Desktop]# chkconfig named on [root@vastdata3 Desktop]# chkconfig named --list
1.6.1.7解析测试
[root@vastdata3 Desktop]# nslookup vastdata-scan.us.oracle.com Server: 192.168.0.12 Address: 192.168.0.12#53 Name: vastdata-scan.us.oracle.com Address: 192.168.0.34 Name: vastdata-scan.us.oracle.com Address: 192.168.0.35 Name: vastdata-scan.us.oracle.com Address: 192.168.0.33
1.6.2配置从域名解析服务器
它作为主域名解析服务器的辅助和备份服务器,自身不建立区域文件,而是从主域名解析服务器中查询并保存域名信息。
它可以与主域名解析服务器提供相同的解析服务,须在不同于主域名解析服务器的主机中构建。
1.6.2.1修改从域名解析服务器的主配置文件
[root@vastdata4 ~]# cd /etc/ [root@vastdata4 etc]# cat named.conf // // named.conf // // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS // server as a caching only nameserver (as a localhost DNS resolver only). // // See /usr/share/doc/bind*/sample/ for example named configuration files. // options { directory "/var/named"; allow-query { any; }; recursion no; }; zone "us.oracle.com" IN { type slave; file "slave/us.oracle.com.zone"; masters { 192.168.0.11; }; allow-transfer { none; }; }; zone "0.168.192.in-addr.arpa" IN { type slave; file "slave/192.168.0.rev"; masters { 192.168.0.11; }; };
type设置为"slave",代表当前DNS服务器是该域的从域名服务器类型,区域文件应从主域名解析服务器中获取,并保存在"slaves"子目录中,为便于管理,尽量使用与主服务器相同的区域文件名。使用master设置主域名解析服务器的IP地址。
1.6.2.2修改 resolv.conf配置文件
[root@vastdata4 ~]# cat /etc/resolv.conf # Generated by NetworkManager search us.oracle.com # No nameservers found; try putting DNS servers into your # ifcfg files in /etc/sysconfig/network-scripts like so: # # DNS1=xxx.xxx.xxx.xxx # DNS2=xxx.xxx.xxx.xxx # DOMAIN=lab.foo.com bar.foo.com nameserver 192.168.0.11
1.6.2.3启动named服务
[root@vastdata3 Desktop]# service named start
1.6.2.4解析测试
[root@vastdata4 ~]# service named restart Stopping named: [ OK ] Starting named: [ OK ] [root@vastdata4 ~]# nslookup vastdata-scan.us.oracle.com Server: 192.168.0.11 Address: 192.168.0.11#53 Name: vastdata-scan.us.oracle.com Address: 192.168.0.33 Name: vastdata-scan.us.oracle.com Address: 192.168.0.34 Name: vastdata-scan.us.oracle.com Address: 192.168.0.35
1.7配置操作环境
1.7.1配置yum源
[oel6] name=OEL6.5 baseurl=file:///media/OL6.5 x86_64 Disc 1 20131125 gpgcheck=0 enabled=1
1.7.2安装RPM包
[root@vastdata3 Desktop]# yum install binutils compat-libcap1 compat-libstdc++-33 iptraf gcc gcc-c++ glibc-devel glibc elfutils-libelf-devel compat-libcap1 compat-libstdc++-33 libaio-devel ksh libgcc libstdc libstdc++ libstdc++-devel libaio libaio-devel make sysstat unixODBC unixODBC-devel -y
1.7.3配置hosts文件
[root@vastdata3 Desktop]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.0.11 vastdata3.us.oracle.com vastdata3 192.168.0.12 vastdata4.us.oracle.com vastdata4 # vastdata3 192.168.0.11 vastdata3.us.oracle.com vastdata3 192.168.0.22 vastdata3-vip.us.oracle.com vastdata3-vip 10.0.0.2 vastdata3-priv1.us.oracle.com vastdata3-priv1 10.0.0.3 vastdata3-priv2.us.oracle.com vastdata3-priv2 # vastdata4 192.168.0.12 vastdata4.us.oracle.com vastdata4 192.168.0.23 vastdata4-vip.us.oracle.com vastdata4-vip 10.0.0.4 vastdata4-priv1.us.oracle.com vastdata4-priv1 10.0.0.5 vastdata4-priv2.us.oracle.com vastdata4-priv2
1.7.4内核参数
[root@vastdata3 Desktop]# vim /etc/sysctl.conf kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 net.ipv4.ip_local_port_range = 9000 65500 fs.file-max = 6815744 fs.aio-max-nr = 1048576
sysctl -p
1.7.5资源限制
[root@vastdata3 Desktop]# vim /etc/security/limits.conf grid soft nproc 2047 grid hard nproc 16384 grid soft nofile 1024 grid hard nofile 65536 grid soft stack 10240 grid hard stack 32768 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 oracle hard stack 32768
1.7.6添加用户组
groupadd -g 1000 oinstall groupadd -g 1001 dba groupadd -g 1002 oper groupadd -g 1003 asmadmin groupadd -g 1004 asmoper groupadd -g 1005 asmdba
1.7.7添加用户
useradd -u 1100 -g oinstall -G dba,oper,asmadmin,asmdba,asmoper grid useradd -u 1101 -g oinstall -G dba,oper,asmdba oracle echo "oracle" | passwd --stdin oracle echo "grid" | passwd --stdin grid id oracle id grid
1.7.8创建目录结构
mkdir -p /u01/app/grid mkdir -p /u01/app/11.2.0/grid mkdir -p /u01/app/oracle chown -R oracle:oinstall /u01 chown -R grid:oinstall /u01/app/grid chown -R grid:oinstall /u01/app/11.2.0 chmod -R 775 /u01
1.7.9 grid环境变量
export TMP=/tmp export TMPDIR=$TMP export ORACLE_HOSTNAME=vastdata3.us.oracle.com export ORACLE_SID=+ASM1 export ORACLE_BASE=/u01/app/grid export ORACLE_HOME=/u01/app/11.2.0/grid export NLS_DATE_FORMAT="yy-mm-dd hh24:mi:ss" export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK umask 022
1.7.10 oracle环境变量
export TMP=/tmp export TMPDIR=$TMP export ORACLE_HOSTNAME=vastdata3.us.oracle.com export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1 export ORACLE_UNQNAME=PROD export ORACLE_SID=PROD1 export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss" export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK umask 022
1.8配置共享存储
关闭虚拟机vastdata3,添加三块新硬盘,并设置为共享模式。
1.9配置裸设备
Linux LVM磁盘管理---添加新LVM卷
借鉴博客: https://dengqsintyt.iteye.com/blog/2067682
查看卷组信息
[root@vastdata3 Desktop]# fdisk -l
[root@vastdata3 Desktop]# vim 1.sh for i in b c d ; 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="asmadmin", MODE="0660"" >> /etc/udev/rules.d/99-oracle-asmdevices.rules done
[root@vastdata3 Desktop]# ./1.sh [root@vastdata3 Desktop]# cd /etc/udev/rules.d/ [root@vastdata3 rules.d]# cat 99-oracle-asmdevices.rules KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB2680d530-c583f8b5", NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VBe77d7ca0-4aa70692", NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB310ff0af-753c18fd", NAME="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660" [root@vastdata3 rules.d]# start_udev Starting udev: [ OK ] [root@vastdata3 rules.d]# ls -al /dev/asm-disk* brw-rw---- 1 grid asmadmin 8, 16 Feb 23 13:33 /dev/asm-diskb brw-rw---- 1 grid asmadmin 8, 32 Feb 23 13:33 /dev/asm-diskc brw-rw---- 1 grid asmadmin 8, 48 Feb 23 13:33 /dev/asm-diskd
1.10配置互信
root、grid、oracle,这三个用户都需要配置互信,以及与自己配置互信
[root@vastdata3 .ssh]# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: ad:42:c0:ec:fe:ff:2d:65:7c:e7:15:8d:d0:2e:b6:38 root@vastdata3.us.oracle.com The key's randomart image is: +--[ RSA 2048]----+ | . | | o . . | | + o ..| | . . . o o..| | . . S .+ o .| | . . .E = . o| | . . . + . o.| | . . .. .| | ....... | +-----------------+ [root@vastdata3 .ssh]# vim authorized_keys [root@vastdata3 .ssh]# ls id_rsa id_rsa.pub [root@vastdata3 .ssh]# cat id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA4XqACcwy7PFGTrTASe+GT7fAWs05qXSm9QnW3JaW6e13tmmqqJq0yw2GEXEDQX3r435QHCWtkSpV20pzPBNowD4UrypBeQZ2VzQf9lC1KGmpk2I9t+0F2jMPXr5ja1pqkSUdfE3JdjJ9CS52mgrAB22/NVLeJcka1XVvACERPjtiJRkhEA6ZLxO1bZdKbI1U7Eylb48JMgYieYugpob9NIzi0x9Ea70XXOMl/DnTYLeWIvfzofIg0bDoRRdbzxZ7PaDAdHKv5uXxQCj7IGiM6q5uFlJ7P+ArL6NkJ1+nGc701k6I6yenYGbsdue8MeCOJMVE6vwLuv7c1ZtgDfaxmQ== root@vastdata3.us.oracle.com [root@vastdata3 .ssh]# cat id_rsa.pub >> authorized_keys [root@vastdata3 .ssh]# vim id_rsa.pub [root@vastdata3 .ssh]# service sshd restart Stopping sshd: [ OK ] Starting sshd: [ OK ] [root@vastdata3 .ssh]# ssh vastdata4 The authenticity of host 'vastdata4 (192.168.0.12)' can't be established. RSA key fingerprint is 7e:6e:17:ad:83:5d:a4:45:5b:9d:08:9a:dc:1a:ef:97. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'vastdata4,192.168.0.12' (RSA) to the list of known hosts. Last login: Sun Feb 24 03:05:45 2019 from 192.168.0.11 [root@vastdata4 ~]# exit logout [root@vastdata4 .ssh]# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: 91:fc:e4:40:6e:f3:7a:6d:b8:10:24:f9:af:5d:4a:53 root@vastdata4.us.oracle.com The key's randomart image is: +--[ RSA 2048]----+ | . | | = . | | o X . | | = O | | S + E | | + + | | o * + | | * * | | . + | +-----------------+ [root@vastdata4 .ssh]# cat id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAsCfzE90pETKTJZKnIuXT/E27P16AEeejAvZzhySB03f7N75ck6YDlnwbJDn/R+mEU4y4+sBof6lX6QemIZx71NZMUM1W7Si9U2Ugi7vkDtSrXaPTmLGxTOFUhWOD6dMru0FvL+e19GYexWDppGzLdVi7JlaPQzK3DVWWKEzPl3RXsjmtRrApJNjvj62zeq7sU9jBbgP1eDeB59ooda6VAY5mWq7vrBROhLtMiEEfHb34ooVvzc8lU3dZLfVVtklvSE+119f9Fvu6N0pIXPko415oTkIS7NwEGghs0AUXcdy9aM/mj44qkZF88xcm/FwiSHGShvNQcEUJoVP8yxU6Vw== root@vastdata4.us.oracle.com [root@vastdata4 .ssh]# cat id_rsa.pub >> authorized_keys [root@vastdata4 .ssh]# vim authorized_keys [root@vastdata4 .ssh]# service sshd restart Stopping sshd: [ OK ] Starting sshd: [ OK ] [root@vastdata4 .ssh]# ssh vastdata3 The authenticity of host 'vastdata3 (192.168.0.11)' can't be established. RSA key fingerprint is f1:32:75:99:4a:b0:50:25:2f:74:44:fb:fa:b2:08:c9. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'vastdata3,192.168.0.11' (RSA) to the list of known hosts. root@vastdata3's password: Last login: Sun Feb 24 01:53:39 2019 from 192.168.0.11 [root@vastdata3 ~]# exit logout Connection to vastdata3 closed.
2.正式搭建RAC架构
2.1安装GI前,检测环境是否准备妥当
[grid@vastdata3 grid]$ ./runcluvfy.sh stage -pre crsinst -n vastdata4,vastdata3 -fixup -verbose Performing pre-checks for cluster services setup Checking node reachability... Check: Node reachability from node "vastdata3" Destination Node Reachable? ------------------------------------ ------------------------ vastdata4 yes vastdata3 yes Result: Node reachability check passed from node "vastdata3" Checking user equivalence... Check: User equivalence for user "grid" Node Name Status ------------------------------------ ------------------------ vastdata4 passed vastdata3 passed Result: User equivalence check passed for user "grid" ... ... Checking DNS response time for an unreachable node Node Name Status ------------------------------------ ------------------------ vastdata4 passed vastdata3 passed The DNS response time for an unreachable node is within acceptable limit on all nodes File "/etc/resolv.conf" is consistent across nodes Check: Time zone consistency Result: Time zone consistency check passed Pre-check for cluster services setup was unsuccessful on all the nodes.
2.2安装GI
[grid@vastdata3 grid]$ ./runInstaller
2.2.1查看集群资源,除gsd未加载外,其余功能均已加载
[grid@vastdata3 ~]$ crsctl stat res -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATA.dg ONLINE ONLINE vastdata3 ONLINE ONLINE vastdata4 ora.LISTENER.lsnr ONLINE ONLINE vastdata3 ONLINE ONLINE vastdata4 ora.asm ONLINE ONLINE vastdata3 Started ONLINE ONLINE vastdata4 Started ora.gsd OFFLINE OFFLINE vastdata3 OFFLINE OFFLINE vastdata4 ora.net1.network ONLINE ONLINE vastdata3 ONLINE ONLINE vastdata4 ora.ons ONLINE ONLINE vastdata3 ONLINE ONLINE vastdata4 ora.registry.acfs ONLINE ONLINE vastdata3 ONLINE ONLINE vastdata4 -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE vastdata4 ora.LISTENER_SCAN2.lsnr 1 ONLINE ONLINE vastdata3 ora.LISTENER_SCAN3.lsnr 1 ONLINE ONLINE vastdata3 ora.cvu 1 ONLINE ONLINE vastdata3 ora.oc4j 1 ONLINE ONLINE vastdata3 ora.scan1.vip 1 ONLINE ONLINE vastdata4 ora.scan2.vip 1 ONLINE ONLINE vastdata3 ora.scan3.vip 1 ONLINE ONLINE vastdata3 ora.vastdata3.vip 1 ONLINE ONLINE vastdata3 ora.vastdata4.vip 1 ONLINE ONLINE vastdata4 [grid@vastdata3 ~]$ crsctl stat res -t -init -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.asm 1 ONLINE ONLINE vastdata3 Started ora.cluster_interconnect.haip 1 ONLINE ONLINE vastdata3 ora.crf 1 ONLINE ONLINE vastdata3 ora.crsd 1 ONLINE ONLINE vastdata3 ora.cssd 1 ONLINE ONLINE vastdata3 ora.cssdmonitor 1 ONLINE ONLINE vastdata3 ora.ctssd 1 ONLINE ONLINE vastdata3 OBSERVER ora.diskmon 1 OFFLINE OFFLINE ora.drivers.acfs 1 ONLINE ONLINE vastdata3 ora.evmd 1 ONLINE ONLINE vastdata3 ora.gipcd 1 ONLINE ONLINE vastdata3 ora.gpnpd 1 ONLINE ONLINE vastdata3 ora.mdnsd 1 ONLINE ONLINE vastdata3
1.2.2在主DNS服务器重启后则变成active,否则就是观望者(observer)
关闭两台机器的时间同步功能:
rm -rf /etc/ntp.conf rm -rf /etc/sysconfig/ntpd
1.2.3查看ASM磁盘组的状况
[grid@vastdata3 ~]$ sqlplus / as sysasm SQL*Plus: Release 11.2.0.4.0 Production on Sun Feb 24 10:44:47 2019 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 Real Application Clusters and Automatic Storage Management options SQL> select instance_name from v$instance; INSTANCE_NAME -------------------------------- +ASM1 SQL> select instance_name from gv$instance; INSTANCE_NAME -------------------------------- +ASM1 +ASM2
3.仅安装数据库软件
4.配置ASM磁盘
5.安装RAC数据库
6.检查集群和数据库运行状态
[grid@vastdata3 ~]$ crsctl stat res -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATA.dg ONLINE ONLINE vastdata3 ONLINE ONLINE vastdata4 ora.FRA.dg ONLINE ONLINE vastdata3 ONLINE ONLINE vastdata4 ora.LISTENER.lsnr ONLINE ONLINE vastdata3 ONLINE ONLINE vastdata4 ora.asm ONLINE ONLINE vastdata3 Started ONLINE ONLINE vastdata4 Started ora.gsd OFFLINE OFFLINE vastdata3 OFFLINE OFFLINE vastdata4 ora.net1.network ONLINE ONLINE vastdata3 ONLINE ONLINE vastdata4 ora.ons ONLINE ONLINE vastdata3 ONLINE ONLINE vastdata4 ora.registry.acfs ONLINE ONLINE vastdata3 ONLINE ONLINE vastdata4 -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE vastdata4 ora.LISTENER_SCAN2.lsnr 1 ONLINE ONLINE vastdata3 ora.LISTENER_SCAN3.lsnr 1 ONLINE ONLINE vastdata3 ora.cvu 1 ONLINE ONLINE vastdata3 ora.oc4j 1 ONLINE ONLINE vastdata3 ora.prod.db 1 ONLINE ONLINE vastdata3 Open 2 ONLINE ONLINE vastdata4 Open ora.scan1.vip 1 ONLINE ONLINE vastdata4 ora.scan2.vip 1 ONLINE ONLINE vastdata3 ora.scan3.vip 1 ONLINE ONLINE vastdata3 ora.vastdata3.vip 1 ONLINE ONLINE vastdata3 ora.vastdata4.vip 1 ONLINE ONLINE vastdata4 [grid@vastdata3 ~]$ [oracle@vastdata3 ~]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Sun Feb 24 12:12:40 2019 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> select instance_name,status from gv$instance; INSTANCE_NAME STATUS -------------------------------- ------------------------ PROD1 OPEN PROD2 OPEN
至此,Oracle RAC架构搭建完成。
如有转载,请标明出处。