ITPub博客

首页 > 数据库 > Oracle > RHEL6.5 ORACLE 11G RAC

RHEL6.5 ORACLE 11G RAC

原创 Oracle 作者:Aeon37 时间:2019-03-17 20:12:08 0 删除 编辑

物理机IP:192.168.0.108

NAT子网IP:10.10.10.0


--配置公网IP和私网IP(双节点root执行)

以下为节点一配置,节点二配置修改同理。

vi /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

HWADDR=00:0C:29:24:1E:D9

TYPE=Ethernet

UUID=7c0bf950-b20b-45eb-b5be-7b92696f2eb7

ONBOOT=yes

#NM_CONTROLLED=yes

BOOTPROTO=static

IPADDR=192.168.0.201

NETMASK=255.255.255.0

GATEWAY=192.168.0.1

DNS1=192.168.0.1


vi /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

HWADDR=00:0C:29:24:1E:E3

TYPE=Ethernet

UUID=1a28394f-7cdc-4123-acea-bc6ced835d66

ONBOOT=yes

#NM_CONTROLLED=yes

BOOTPROTO=static

IPADDR=10.10.10.201

NETMASK=255.255.255.0



--关闭防火墙(双节点root执行)

service iptables stop

chkconfig iptables off

chkconfig iptables --list



--修改主机名(双节点root执行)

以下为节点一配置,节点二配置修改同理。

vi /etc/sysconfig/network

#NETWORKING=yes

HOSTNAME=rac1



--修改hosts文件(双节点root执行)

vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

#public ip

192.168.0.201  rac1

192.168.0.202  rac2

#priv ip

10.10.10.201    rac1-priv

10.10.10.202    rac2-priv

#vip ip

192.168.0.203   rac1-vip

192.168.0.204   rac2-vip

#scan ip

192.168.0.205   rac-scan



--配置内核参数(双节点root执行)

建议值算法,如果计算kernel.shmall的值小于2097152,建议配置2097152。

kernel.shmmax == 4*1024*1024*1024*90% = 3865470566

kernel.shmall == 3865470566/4096 = 943718


vi /etc/sysctl.conf

kernel.shmmax = 3865470566

kernel.shmall = 2097152

fs.aio-max-nr =1048576

fs.file-max =6815744

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 =1048576



--参数生效(双节点root执行)

sysctl -p



--修改limits文件(双节点root执行)

vi /etc/security/limits.conf

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

oracle soft stack 10240

grid soft nproc 2047

grid hard nproc 16384

grid soft nofile 1024

grid hard nofile 65536

grid soft stack 10240



--修改/etc/pam.d/login文件(双节点root执行)

vi /etc/pam.d/login

session required pam_limits.so



--修改/etc/profile文件(双节点root执行)

vi /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



--禁用selinux(双节点root执行)

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.



--停止ntp服务(双节点root执行)

service ntpd stop

mv /etc/ntp.conf /etc/ntp.conf.bak

chkconfig ntpd off



--shm配置(双节点root执行)

mount -o size=4G -o nr_inodes=1000000 -o noatime,nodiratime -o remount /dev/shm

vi /etc/fstab

tmpfs                   /dev/shm                tmpfs   defaults,size=4G        0 0



--添加组和用户(双节点root执行)

groupadd -g 501 oinstall

groupadd -g 502 dba

groupadd -g 503 oper

groupadd -g 504 asmadmin

groupadd -g 505 asmoper

groupadd -g 506 asmdba

useradd -g oinstall -G dba,asmdba,oper oracle

useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid



--为oracle和grid用户设密码(双节点root执行)

passwd oracle

passwd grid



--检查(双节点root执行)

id oracle

uid=500(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),503(oper),506(asmdba)


id grid

uid=501(grid) gid=501(oinstall) groups=501(oinstall),502(dba),503(oper),504(asmadmin),505(asmoper),506(asmdba)



--创建目录(双节点root执行)

mkdir -p /u01/app/oracle

mkdir -p /u01/app/grid

mkdir -p /u01/app/11.2.0/grid

chown -R grid:oinstall /u01/app/grid

chown -R grid:oinstall /u01/app/11.2.0

chown -R oracle:oinstall /u01/app/oracle

chmod -R 775 /u01

mkdir -p /u01/app/oraInventory

chown -R grid:oinstall /u01/app/oraInventory

chmod -R 775 /u01/app/oraInventory



--修改grid用户环境变量(双节点grid执行)

以下为节点一配置,节点二配置修改同理。

vi ~/.bash_profile

export ORACLE_SID=+ASM1

export ORACLE_BASE=/u01/app/grid

export ORACLE_HOME=/u01/app/11.2.0/grid

export LD_LIBRARY_PATH=$ORACLE_HOME/lib

export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"

export PATH=$ORACLE_HOME/bin:$PATH



--修改oracle用户环境变量(双节点oracle执行)

以下为节点一配置,节点二配置修改同理。

vi ~/.bash_profile

export ORACLE_SID=rac1

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1

export LD_LIBRARY_PATH=$ORACLE_HOME/lib

export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"

export TMP=/tmp

export TMPDIR=$TMP

export PATH=$PATH:$ORACLE_HOME/bin

alias sqlplus='rlwrap sqlplus'

alias rman='rlwrap rman'



--挂载系统镜像(双节点root执行)

mount /dev/cdrom /mnt

vi /etc/yum.conf

[EL]

name=Linux5.5DVD

baseurl=file:///mnt/Server/

gpgcheck=0

enabled=1



--安装依赖包(双节点root执行)

yum install -y binutils-* compat-db* compat-db-* control-center* gcc-* gcc-c++-* glibc-* glibc-common-* gnome-libs-* make-* sysstat-* xscreensaver-* make-* gdb-6.1post-* glibc-* glibc-common-* glibc-devel-* glibc-devel-* compat-gcc-* compat-gcc-c++-* compat-libstdc++-* compat-libstdc++-devel-* gnome-libs-* libstdc++-* libstdc++-devel-* openmotif-* sysstat-* setarch-* libaio-* libaio-devel-* libXp* libXp-devel* elfutils-libelf-devel* unixODBC-* unixODBC-devel-* compat-libcap1.x86_64  libcap.so.1 sg3_utils readline*

yum install -y compat-libstdc++-33-3.2.3-69.el6.i686 glibc-devel-2.12-1.132.el6.i686 libaio-devel-0.3.107-10.el6.i686 libstdc++-4.4.7-4.el6.i686 unixODBC-2.2.14-12.el6_3.i686 unixODBC-devel-2.2.14-12.el6_3.i686 libaio-0.3.107-10.el6.i686


--安装pdksh(双节点root执行)

rpm -ivh pdksh-5.2.14-37.el5_8.1.i386.rpm

rpm -ivh pdksh-5.2.14-37.el5_8.1.x86_64.rpm


--安装xhost(一节点root执行)

yum install -y xhost



--关闭不需要的服务(双节点root执行)

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



--关闭虚拟机(双节点root执行)

poweroff



--添加共享磁盘(物理机cmd cd到VMware安装目录下)

vmware-vdiskmanager.exe -c -s 2GB -a lsilogic -t 2 F:\ShareDisk\ORACLE11GRAC\ocr_vote.vmdk

vmware-vdiskmanager.exe -c -s 5GB -a lsilogic -t 2 F:\ShareDisk\ORACLE11GRAC\data_1.vmdk

vmware-vdiskmanager.exe -c -s 5GB -a lsilogic -t 2 F:\ShareDisk\ORACLE11GRAC\arch_1.vmdk


--修改虚拟机配置文件(虚拟机文件保存目录下)

ORACLE 11G RAC1.vmx

ORACLE 11G RAC2.vmx


#shared disks configure

disk.EnableUUID="TRUE"

disk.locking = "FALSE"

scsi1.shared = "TRUE"

diskLib.dataCacheMaxSize = "0"

diskLib.dataCacheMaxReadAheadSize = "0"

diskLib.dataCacheMinReadAheadSize = "0"

diskLib.dataCachePageSize= "4096"

diskLib.maxUnsyncedWrites = "0"

scsi1.present = "TRUE"

scsi1.virtualDev = "lsilogic"

scsil.sharedBus = "VIRTUAL"

scsi1:0.present = "TRUE"

scsi1:0.mode = "independent-persistent"

scsi1:0.fileName = "F:\ShareDisk\ORACLE11GRAC\ocr_vote.vmdk"

scsi1:0.deviceType = "disk"

scsi1:0.redo = ""

scsi1:1.present = "TRUE"

scsi1:1.mode = "independent-persistent"

scsi1:1.fileName = "F:\ShareDisk\ORACLE11GRAC\data_1.vmdk"

scsi1:1.deviceType = "disk"

scsi1:1.redo = ""

scsi1:2.present = "TRUE"

scsi1:2.mode = "independent-persistent"

scsi1:2.fileName = "F:\ShareDisk\ORACLE11GRAC\arch_1.vmdk"

scsi1:2.deviceType = "disk"

scsi1:2.redo = ""



--开机查看共享磁盘是否添加成功(sdb/sdc/sdd)(双节点root执行)

fdisk -l



--配置scsi(双节点root执行)

vi /etc/scsi_id.config

options=--whitelisted --replace-whitespace



--获取scsi_id(双节点root执行)

scsi_id --whitelisted --replace-whitespace --device=/dev/sdb

scsi_id --whitelisted --replace-whitespace --device=/dev/sdc

scsi_id --whitelisted --replace-whitespace --device=/dev/sdd


36000c2935b9d8e89ca0ee1c6632b4edd

36000c2904a64ad83059af84cdf3ef835

36000c295812b65ac3ab09250a86039ce



--创建并配置udev rules文件,根据获取到的scsi_id替换RESULT值。(双节点root执行)

vi /etc/udev/rules.d/99-oracle-asmdevices.rules

KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c2935b9d8e89ca0ee1c6632b4edd", NAME="asm-diskb", OWNER="grid",GROUP="asmadmin", MODE="0660"

KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c2904a64ad83059af84cdf3ef835", NAME="asm-diskc", OWNER="grid",GROUP="asmadmin", MODE="0660"

KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c295812b65ac3ab09250a86039ce", NAME="asm-diskd", OWNER="grid",GROUP="asmadmin", MODE="0660"



--重启udev并查看绑定的asm是否成功(双节点root执行)

start_udev

ll /dev/asm*



--解压软件(软件已上传到/tmp目录)(节点一root执行)

p10404530_112030_Linux-x86-64_1of7.zip

p10404530_112030_Linux-x86-64_2of7.zip

p10404530_112030_Linux-x86-64_3of7.zip


unzip 'p10404530_112030_Linux-x86-64_*'



--安装补丁包 cvuqdisk(双节点root执行)

节点一:

cd /tmp/grid/rpm/

rpm -ivh cvuqdisk-1.0.9-1.rpm

scp cvuqdisk-1.0.9-1.rpm rac2:/tmp


节点二:

cd /tmp

rpm -ivh cvuqdisk-1.0.9-1.rpm



--安装集群软件(节点一grid执行)

打开Xmanager - Passive

export DISPLAY=192.168.0.108:0.0

xhost +

显示:"access control disabled, clients can connect from any host" 为成功


cd /tmp/grid/

./runInstaller


1.Skip software updates

2.Install and COnfigure Oracle Grid Infrastructure for a Cluster

3.Advanced Installation

4.下一步

5.SCAN Name输入rac-scan

取消勾选Configure GNS

6.Add添加rac2/rac2-vip

SSH Connectivity输入grid密码 Setup配置互信

7.eth0 Public/eth1 Private

8.Oracle Automatic Storage Management(Oracle ASM)

9.Change Discovery Path输入/dev/*

Disk Group Name输入CRS

Redundancy选择External

10.输入密码

11.Do not use Intelligent...

12.asmdba/asmoper/asmadmin

13.下一步

14.下一步

15.忽略检测

16.下一步


76%弹出执行脚本,按顺序执行(双节点root执行)

节点一:

/u01/app/oraInventory/orainstRoot.sh

节点二:

/u01/app/oraInventory/orainstRoot.sh

节点一:

/u01/app/11.2.0/grid/root.sh

节点二:

/u01/app/11.2.0/grid/root.sh


脚本结束返回Configure Oracle Grid Infrastructure for a Cluster ... succeeded



--安装完成查看集群状态是否正常(节点一grid执行)

crsctl stat res -t

--------------------------------------------------------------------------------

NAME           TARGET  STATE        SERVER                   STATE_DETAILS       

--------------------------------------------------------------------------------

Local Resources

--------------------------------------------------------------------------------

ora.CRS.dg

               ONLINE  ONLINE       rac1                                         

               ONLINE  ONLINE       rac2                                         

ora.LISTENER.lsnr

               ONLINE  ONLINE       rac1                                         

               ONLINE  ONLINE       rac2                                         

ora.asm

               ONLINE  ONLINE       rac1                     Started             

               ONLINE  ONLINE       rac2                     Started             

ora.gsd

               OFFLINE OFFLINE      rac1                                         

               OFFLINE OFFLINE      rac2                                         

ora.net1.network

               ONLINE  ONLINE       rac1                                         

               ONLINE  ONLINE       rac2                                         

ora.ons

               ONLINE  ONLINE       rac1                                         

               ONLINE  ONLINE       rac2                                         

--------------------------------------------------------------------------------

Cluster Resources

--------------------------------------------------------------------------------

ora.LISTENER_SCAN1.lsnr

      1        ONLINE  ONLINE       rac1                                         

ora.cvu

      1        ONLINE  ONLINE       rac1                                         

ora.oc4j

      1        ONLINE  ONLINE       rac1                                         

ora.rac1.vip

      1        ONLINE  ONLINE       rac1                                         

ora.rac2.vip

      1        ONLINE  ONLINE       rac2                                         

ora.scan1.vip

      1        ONLINE  ONLINE       rac1 


crsctl query css votedisk

##  STATE    File Universal Id                File Name Disk group

--  -----    -----------------                --------- ---------

 1. ONLINE   2871fc8756d14fb2bf4712349160ef59 (/dev/asm-diskb) [CRS]

Located 1 voting disk(s).


ocrcheck

Status of Oracle Cluster Registry is as follows :

         Version                  :          3

         Total space (kbytes)     :     262120

         Used space (kbytes)      :       2368

         Available space (kbytes) :     259752

         ID                       : 1724549217

         Device/File Name         :       +CRS

                                    Device/File integrity check succeeded


                                    Device/File not configured


                                    Device/File not configured


                                    Device/File not configured


                                    Device/File not configured


         Cluster registry integrity check succeeded


         Logical corruption check bypassed due to non-privileged user


olsnodes -n

rac1    1

rac2    2


srvctl config asm -a

ASM home: /u01/app/11.2.0/grid

ASM listener: LISTENER

ASM is enabled.



--创建其它新磁盘组(节点一grid执行)

asmca

1.Disk Groups-->Create

2.Disk Group Name 输入 DATA

选择 External(None)

勾选 /dev/asm-diskc

点击 OK

3.Disk Groups-->Create

4.Disk Group Name 输入 ARCH

选择 External(None)

勾选 /dev/asm-diskd

点击 OK

5.Exit退出



--验证(节点一grid执行)

crsctl stat res -t

ora.ARCH.dg

               ONLINE  ONLINE       rac1                                         

               ONLINE  ONLINE       rac2                                         

ora.CRS.dg

               ONLINE  ONLINE       rac1                                         

               ONLINE  ONLINE       rac2                                         

ora.DATA.dg

               ONLINE  ONLINE       rac1                                         

               ONLINE  ONLINE       rac2



--安装数据库软件(节点一oracle执行)

export DISPLAY=192.168.0.108:0.0

xhost +

显示:"access control disabled, clients can connect from any host" 为成功


cd /tmp/database/

./runInstaller


1.取消勾选 I wish to receive...

2.选择 Use pre-downloaded ...

3.选择 Install database software only

4.SSH Connectivity输入oracle密码 Setup配置互信

5.下一步

6.选择 Enterprise Edition

7.下一步

8.选择 dba/oinstall

9.忽略检测

10.下一步

94%弹出执行脚本,按顺序执行(双节点root执行)

节点一:

/u01/app/oracle/product/11.2.0/db_1/root.sh

节点二:

/u01/app/oracle/product/11.2.0/db_1/root.sh



--DBCA创建数据库(节点一oracle执行)

dbca


1.选择 Oracle Real Application ...

2.选择 Create a Database

3.选择 General Purpose ...

4.Global Database Name/SID Prefix 输入 rac

点击Select All

5.取消勾选Configure Enterprise Manager

6.选择 Use the Same Administative ... 输入密码

7.选择 Use Oracle-Managed Files 输入 +DATA

8.取消勾选Specify Fast Recovery Area

勾选Enable Archiving

9.下一步

10.Memory Size 输入 2048

勾选Use Automatic Memory Management

点击 Character Sets选项卡

National Character Set 选择 UTF8 - Unicode 3.0

11.下一步

12.Finish



--关闭可能会引起bug的组件(节点一root执行)

/u01/app/11.2.0/grid/bin/crsctl stop res ora.crf -init

/u01/app/11.2.0/grid/bin/crsctl modify res ora.crf -attr ENABLED=0 -init



--删除显示GSD状态(节点一root执行)

/u01/app/11.2.0/grid/bin/crsctl delete resource ora.gsd



--安装rlwrap插件(root用户双节点)

tar -xvf rlwrap-0.30.tar

cd rlwrap-0.30

./configure

make

make install










来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30618950/viewspace-2638605/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2015-12-07

  • 博文量
    4
  • 访问量
    6758