这篇文章给大家分享的是有关Oracle RAC之环境准备的示例分析的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

本次安装选择VMmare Workstation10.0.1 ,创建四台虚拟机。如下:

Openfiler (openfileresa-2.99.1-x86_64)

机器名IP地址openfiler.localdomain.com192.168.199.219

RAC节点 (OracleLinux-R6-U4-Server-x86_64)

机器名Public-IPPrivate-IPVIP11grac1192.168.199.10192.168.10.10192.168.199.2011grac2192.168.199.11192.168.10.11192.168.199.2111grac3192.168.199.12192.168.10.12192.168.199.22

三台机器都配置/etc/hosts,内容如下

#node1192.168.199.1011grac1.localdomain.com11grac1192.168.199.2011grac1-vip.localdomain.com11grac1-vip192.168.10.1011grac1-priv.localdomain.com11grac1-priv#node2192.168.199.1111grac2.localdomain.com11grac2192.168.199.2111grac2-vip.localdomain.com11grac2-vip192.168.10.1111grac2-priv.localdomain.com11grac2-priv#node3192.168.199.1211grac3.localdomain.com11grac3192.168.199.2211grac3-vip.localdomain.com11grac3-vip192.168.10.1211grac3-priv.localdomain.com11grac3-priv#scanip192.168.199.30scan-cluster.localdomain.comscan-cluster

2.三台机器都关闭防火墙

chkconfigiptablesoffserviceiptablesstop

3.关闭SeLinux

vi/etc/sysconfig/selinuxSELINUX=enforcing改为SELINUX=disabled

4.配置DNS服务器(在11grac3服务器上)

4.1 安装rpm包

[root@localhostPackages]#rpm-ivhbind-9.8.2-0.17.rc1.0.2.el6.x86_64.rpmwarning:bind-9.8.2-0.17.rc1.0.2.el6.x86_64.rpm:HeaderV3RSA/SHA256Signature,keyIDec551f03:NOKEYPreparing...###########################################[100%]1:bind###########################################[100%]

4.2 编辑/etc/named.conf,替换成如下内容

options{directory"/var/named";};zone"."IN{typehint;file"named.ca";};zone"localhost"IN{typemaster;file"named.loopback";};zone"0.0.127.in-addr.apra"IN{typemaster;file"named.localhost";};zone"localdomain.com"IN{typemaster;file"localdomain.com.zone";};

4.3 在/var/named/目录下,新建localdomain.com.zone文件,内容如下

$TTL1D$ORIGINlocaldomain.com.@INSOAns.localdomain.com.admin(0;serial1D;refresh1H;retry1W;expire3H);minimumINNSnsnsINA172.168.199.1211grac3INA192.168.199.1211grac1INA192.168.199.1011grac2INA192.168.199.11scan-clusterINA192.168.199.30

4.4 启动DNS服务器

[root@11grac3etc]#chkconfignamedon[root@localhostnamed]#servicenamedrestartStoppingnamed:[OK]Startingnamed:[OK]

如果发生了错误,尝试执行如下命令试试

[root@localhostnamed]#rndc-confgen-r/dev/urandom-awrotekeyfile"/etc/rndc.key"

4.5 修改各服务器dns指向

[root@localhostnamed]#vi/etc/resolv.conf

添加如下内容

searchlocaldomain.comnameserver192.168.199.12

注意:这样设置完DNS后,网络重启后就失效啦。使用如下方法

vi/etc/sysconfig/network-scripts/ifcfg-eth0#添加如下两行DNS1=192.168.199.12DOMAIN=localdomain.com

重启网络,/etc/resolv.conf中将自动完成DNS的设置。

4.6 验证dns

[root@localhostnamed]#nslookup11grac1Server:192.168.199.12Address:192.168.199.12#53Name:11grac1.localdomain.comAddress:192.168.199.10[root@localhostnamed]#nslookup11grac2Server:192.168.199.12Address:192.168.199.12#53Name:11grac2.localdomain.comAddress:192.168.199.11[root@localhostnamed]#nslookup11grac3Server:192.168.199.12Address:192.168.199.12#53Name:11grac3.localdomain.comAddress:192.168.199.12[root@localhostnamed]#nslookupscan-clusterServer:192.168.199.12Address:192.168.199.12#53Name:scan-cluster.localdomain.comAddress:192.168.199.30

5. 建立用户、建立目录、修改参数文件等 (脚本见附件)

[root@localhostscripts]#./1preusers.sh[root@localhostscripts]#./2predir.sh[root@localhostscripts]#./3prelimits.sh[root@localhostscripts]#./4prelogin.sh[root@localhostscripts]#./5preprofile.sh[root@localhostscripts]#./6presysctl.sh

6. 建立grid、oracle用户的无密码登录

6.1 在三台机器上都执行如下命令

[root@11grac1scripts]#su-oracle11grac1->ssh-keygen-trsa#后面都直接回车Generatingpublic/privatersakeypair.Enterfileinwhichtosavethekey(/home/oracle/.ssh/id_rsa):Createddirectory'/home/oracle/.ssh'.Enterpassphrase(emptyfornopassphrase):Entersamepassphraseagain:Youridentificationhasbeensavedin/home/oracle/.ssh/id_rsa.Yourpublickeyhasbeensavedin/home/oracle/.ssh/id_rsa.pub.Thekeyfingerprintis:31:43:2d:7e:30:bb:c9:d9:d9:8a:01:a2:51:bc:8b:2doracle@11grac1.localdomain.comThekey'srandomartp_w_picpathis:+--[RSA2048]----+|...||o.+.||...+=||.o.o+.||=ooS*o||Eo*o.||.o.||..|||+-----------------+

6.2 在三台机器上执行如下命令

11grac1->ssh-copy-id-i.ssh/id_rsa.pub11grac1Theauthenticityofhost'11grac1(192.168.199.10)'can'tbeestablished.RSAkeyfingerprintiscc:d0:c3:de:37:33:a7:cb:91:40:c5:5f:18:07:06:9f.Areyousureyouwanttocontinueconnecting(yes/no)?yesWarning:Permanentlyadded'11grac1,192.168.199.10'(RSA)tothelistofknownhosts.oracle@11grac1'spassword:Nowtryloggingintothemachine,with"ssh'11grac1'",andcheckin:.ssh/authorized_keystomakesurewehaven'taddedextrakeysthatyouweren'texpecting.11grac2->ssh-copy-id-i.ssh/id_rsa.pub11grac1Theauthenticityofhost'11grac1(192.168.199.10)'can'tbeestablished.RSAkeyfingerprintiscc:d0:c3:de:37:33:a7:cb:91:40:c5:5f:18:07:06:9f.Areyousureyouwanttocontinueconnecting(yes/no)?yesWarning:Permanentlyadded'11grac1,192.168.199.10'(RSA)tothelistofknownhosts.oracle@11grac1'spassword:Nowtryloggingintothemachine,with"ssh'11grac1'",andcheckin:.ssh/authorized_keystomakesurewehaven'taddedextrakeysthatyouweren'texpecting.11grac3->ssh-copy-id-i.ssh/id_rsa.pub11grac1Theauthenticityofhost'11grac1(192.168.199.10)'can'tbeestablished.RSAkeyfingerprintiscc:d0:c3:de:37:33:a7:cb:91:40:c5:5f:18:07:06:9f.Areyousureyouwanttocontinueconnecting(yes/no)?yesWarning:Permanentlyadded'11grac1,192.168.199.10'(RSA)tothelistofknownhosts.oracle@11grac1'spassword:Nowtryloggingintothemachine,with"ssh'11grac1'",andcheckin:.ssh/authorized_keystomakesurewehaven'taddedextrakeysthatyouweren'texpecting.

6.3 以上命令会在11grac1的/home/oracle/.ssh目录下生成authorized_keys,将该文件copy到其他两机器上

11grac1->scpauthorized_keys11grac2:/home/oracle/.ssh/11grac1->scpauthorized_keys11grac3:/home/oracle/.ssh/

6.4 重复6.1~6.3步骤,生成grid用户的无密码验证。

7. 验证各节点必须直接是否能无密码登录

ssh11grac1datessh11grac2datessh11grac3datessh11grac3-privdatessh11grac2-privdatessh11grac1-privdatessh11grac1.localdomain.comdatessh11grac2.localdomain.comdatessh11grac3.localdomain.comdatessh11grac3-priv.localdomain.comdatessh11grac2-priv.localdomain.comdatessh11grac1-priv.localdomain.comdate

8. 挂载iscsi硬盘(每台机器上都执行)

8.1 查找iscsi硬盘

[root@11grac1scripts]#iscsiadm-mdiscovery-tsendtargets-p192.168.199.219192.168.199.219:3260,1iqn.2006-01.com.openfiler:fast_recover_area01192.168.199.219:3260,1iqn.2006-01.com.openfiler:rac_oradata01192.168.199.219:3260,1iqn.2006-01.com.openfiler:rac_ocrdisk03192.168.199.219:3260,1iqn.2006-01.com.openfiler:rac_ocrdisk02192.168.199.219:3260,1iqn.2006-01.com.openfiler:rac_ocrdisk01

8.2 设置开机自动挂载iscsi盘

iscsiadm-mnode-Tiqn.2006-01.com.openfiler:rac_oradata01-p192.168.199.219--opupdate-nnode.startup-vautomaticiscsiadm-mnode-Tiqn.2006-01.com.openfiler:fast_recover_area01-p192.168.199.219--opupdate-nnode.startup-vautomaticiscsiadm-mnode-Tiqn.2006-01.com.openfiler:rac_ocrdisk01-p192.168.199.219--opupdate-nnode.startup-vautomaticiscsiadm-mnode-Tiqn.2006-01.com.openfiler:rac_ocrdisk02-p192.168.199.219--opupdate-nnode.startup-vautomaticiscsiadm-mnode-Tiqn.2006-01.com.openfiler:rac_ocrdisk03-p192.168.199.219--opupdate-nnode.startup-vautomatic

9.创建asm磁盘

9.1 安装oracleasm-support、oracleasmlib (三台机器都执行)

注:因oracle linux已经将oracleasm内置到内核中了,所以无需安装oracleasm的rpm包。如果使用非oracle Linux操作系统。请按装kmod-oracleasm-2.0.6.rh2-2.el6.x86_64.rpm 包。

[root@11grac2/]#rpm-ivhoracleasm-support-2.1.8-1.el6.x86_64.rpmwarning:oracleasm-support-2.1.8-1.el6.x86_64.rpm:HeaderV3RSA/SHA256Signature,keyIDec551f03:NOKEYPreparing...###########################################[100%]1:oracleasm-support###########################################[100%][root@11grac2/]#rpm-ivhoracleasmlib-2.0.4-1.el6.x86_64.rpmwarning:oracleasmlib-2.0.4-1.el6.x86_64.rpm:HeaderV3RSA/SHA256Signature,keyIDec551f03:NOKEYPreparing...###########################################[100%]1:oracleasmlib###########################################[100%]

[root@11grac1Packages]#oracleasmconfigure-iConfiguringtheOracleASMlibrarydriver.Thiswillconfiguretheon-bootpropertiesoftheOracleASMlibrarydriver.Thefollowingquestionswilldeterminewhetherthedriverisloadedonbootandwhatpermissionsitwillhave.Thecurrentvalueswillbeshowninbrackets('[]').Hitting<ENTER>withouttypingananswerwillkeepthatcurrentvalue.Ctrl-Cwillabort.Defaultusertoownthedriverinterface[]:gridDefaultgrouptoownthedriverinterface[]:asmdbaStartOracleASMlibrarydriveronboot(y/n)[n]:yScanforOracleASMdisksonboot(y/n)[y]:yWritingOracleASMlibrarydriverconfiguration:done

9.2 将磁盘分区(只需单节点执行)

9.3 创建asm磁盘

[root@11grac1~]#ll/dev/disk/by-path/ip-192.168.199.219:3260-iscsi-iqn.2006-01.com.openfiler:fast_recover_area01-lun-0->../../sdeip-192.168.199.219:3260-iscsi-iqn.2006-01.com.openfiler:fast_recover_area01-lun-0-part1->../../sde1ip-192.168.199.219:3260-iscsi-iqn.2006-01.com.openfiler:rac_ocrdisk01-lun-0->../../sdbip-192.168.199.219:3260-iscsi-iqn.2006-01.com.openfiler:rac_ocrdisk01-lun-0-part1->../../sdb1ip-192.168.199.219:3260-iscsi-iqn.2006-01.com.openfiler:rac_ocrdisk02-lun-0->../../sddip-192.168.199.219:3260-iscsi-iqn.2006-01.com.openfiler:rac_ocrdisk02-lun-0-part1->../../sdd1ip-192.168.199.219:3260-iscsi-iqn.2006-01.com.openfiler:rac_ocrdisk03-lun-0->../../sdcip-192.168.199.219:3260-iscsi-iqn.2006-01.com.openfiler:rac_ocrdisk03-lun-0-part1->../../sdc1ip-192.168.199.219:3260-iscsi-iqn.2006-01.com.openfiler:rac_oradata01-lun-0->../../sdfip-192.168.199.219:3260-iscsi-iqn.2006-01.com.openfiler:rac_oradata01-lun-0-part1->../../sdf1

注意以上iscsi磁盘与/dev/sd*的对应关系。

[root@11grac1~]#oracleasmcreatediskoradata/dev/sdf1Writingdiskheader:doneInstantiatingdisk:done[root@11grac1~]#oracleasmcreatediskfra/dev/sde1Writingdiskheader:doneInstantiatingdisk:done[root@11grac1~]#oracleasmcreatediskocr01/dev/sdb1Writingdiskheader:doneInstantiatingdisk:done[root@11grac1~]#oracleasmcreatediskocr02/dev/sdd1Writingdiskheader:doneInstantiatingdisk:done[root@11grac1~]#oracleasmcreatediskocr03/dev/sdc1

查看磁盘

[root@11grac1~]#oracleasmlistdisksFRAOCR01OCR02OCR03ORADATA[root@11grac1~]#

在另外两台机器上执行磁盘扫描操作

[root@11grac3~]#oracleasmscandisksReloadingdiskpartitions:doneCleaninganystaleASMdisks...ScanningsystemforASMdisks...Instantiatingdisk"OCR01"Instantiatingdisk"OCR03"Instantiatingdisk"OCR02"Instantiatingdisk"FRA"Instantiatingdisk"ORADATA"

10. 禁用ntp时间同步服务

因为11g Clusterware中已经提供了时间同步服务,所以需要禁用ntp服务。

[root@11grac3~]#cd/etc/[root@11grac3etc]#mvntp.confntp.conf.bak

感谢各位的阅读!关于“Oracle RAC之环境准备的示例分析”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!