ITPub博客

首页 > 数据库 > Oracle > rac两节点图像安装实施

rac两节点图像安装实施

原创 Oracle 作者:不一样的天空w 时间:2017-07-14 14:45:34 0 删除 编辑

一:环境:

OS:Red Hat Enterprise Linux Server release 6.7 (Santiago)

要求:RAC

主库IP:

主机名

Public ip

Vip

Private ip

Scan ip

fast1(节点1)

192.168.11.40

192.168.11.41

10.10.10.1

192.168.11.44

fast2(节点2)

192.168.11.42

192.168.11.43

10.10.10.2



二:关闭防火墙和
selinux:

——查看selinux状态:

[root@fast1 ~]# sestatus

SELinux status:                 enabled

SELinuxfs mount:                /selinux

Current mode:                   enforcing

Mode from config file:          enforcing

Policy version:                 24

Policy from config file:        targeted

 [root@fast1 ~]#

——修改selinux配置文件/etc/selinux/config

[root@fast1 ~]# 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

~

"/etc/selinux/config" 13L, 457C written

[root@fast1 ~]#

——使selinux配置修改生效; 

[root@fast1 ~]# setenforce 0

——再次查看selinux状态: 

[root@fast1 ~]# sestatus

SELinux status:                 enabled

SELinuxfs mount:                /selinux

Current mode:                   permissive

Mode from config file:          disabled

Policy version:                 24

Policy from config file:        targeted

[root@fast1 ~]#

 

——查看防火墙状态:

service iptables status

Table: filter

Chain INPUT (policy ACCEPT)

num  target     prot opt source               destination         

1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           state RELATED,ESTABLISHED

2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           

3    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           

4    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           state NEW tcp dpt:22

5    REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

 

Chain FORWARD (policy ACCEPT)

num  target     prot opt source               destination         

1    REJECT     all  --  0.0.0.0/0            0.0.0.0/0           reject-with icmp-host-prohibited

 

Chain OUTPUT (policy ACCEPT)

num  target     prot opt source               destination         

——查看防火墙运行窗口等级

 [root@fast1 ~]# chkconfig --list iptables

iptables        0:off   1:off   2:on    3:on    4:on    5:on    6:off

——关闭防火墙,重启后永久性生效

 [root@fast1 ~]# chkconfig iptables off

[root@fast1 ~]#

[root@fast1 ~]# chkconfig --list iptables

iptables        0:off   1:off   2:off   3:off   4:off   5:off   6:off

——关闭防火墙,即时生效,重启后失效:

[root@fast1 ~]# service iptables stop

iptables: Setting chains to policy ACCEPT: filter [  OK  ]

iptables: Flushing firewall rules: [  OK  ]

iptables: Unloading modules: [  OK  ]

[root@fast1 ~]#  service iptables status

iptables: Firewall is not running.

[root@fast1 ~]#

 

三:配置解析网络等文件

——配置/etc/hosts解析文件、主机名文件/etc/sysconfig/network,及查看网络ip文件/etc/sysconfig/network-scripts/ifconfig-eth0等等;

——主机名/IP解析文件:

[root@fast1 ~]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

 

192.168.11.40    fast1

192.168.11.41    fast1-vip

10.10.10.1       fast1-priv

 

192.168.11.42    fast2

192.168.11.43    fast2-vip

10.10.10.2       fast2-priv

 

1192.168.11.44   rac-scan

  ——主机名文件

[root@fast1 ~]# cat /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=fast1

GATEWAY=192.168.11.1

[root@fast1 ~]#

  ——网络ip配置文件

  [root@fast1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE=eth0

TYPE=Ethernet

UUID=d7236278-03db-46cc-b244-8c0771915e18

ONBOOT=yes

BOOTPROTO=static

IPADDR=192.168.11.40

GATEWAY=192.168.11.1

NETMASK=255.255.255.0

NM_CONTROLLED=yes

PREFIX=24

DEFROUTE=yes

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

NAME="System eth0"

HWADDR=08:00:27:09:4D:35

[root@fast1 ~]#

[root@fast1 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1

DEVICE=eth1

TYPE=Ethernet

UUID=a535af84-5f6c-445a-ad0a-ce5255618280

NM_CONTROLLED=yes

ONBOOT=yes

BOOTPROTO=static

IPADDR=10.10.10.1

PREFIX=24

DEFROUTE=no

IPV4_FAILURE_FATAL=yes

IPV6INIT=no

NAME="System eth1"

HWADDR=08:00:27:CC:98:C9

[root@fast1 ~]#

——使网络IP配置生效:

[root@fast1 network-scripts]# service network restart

Shutting down interface eth0:  Device state: 3 (disconnected)

[  OK  ]

Shutting down interface eth1:  Device state: 3 (disconnected)

[  OK  ]

Shutting down loopback interface:  [  OK  ]

Bringing up loopback interface:  [  OK  ]

Bringing up interface eth0:  Active connection state: activated

Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/4

[  OK  ]

Bringing up interface eth1:  Active connection state: activated

Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/5

[  OK  ]

[root@fast1 network-scripts]#

 

四:克隆

——关闭节点1克隆出节点2(fast2),克隆时要注意选择改变MAC地址,然后注意修改/etc/hosts、/etc/sysconfig/network、/etc/sysconfig/network-scripts/ifcfg-eth0(ifcfg-eth1)

此时刚克隆完可能网卡名不一致,需要结合/etc/udev/rules.d/70-persistent-net.rules文件修改!

 

五:检查系统要求(在两节点分别执行)

A.LINUX版本

 cat /etc/redhat-release

B.内存(至少1G,推荐2G,RAC架构更大)

grep MemTotal /proc/meminfo

C.SWAP分区(GI安装,内存至少2.5G以上)

  内存在2G以下 ,SWAP分区就设置为内存的1.5倍

  内存在2G至8G之间,SWAP就设置为内存大小

  内存在8G以上,SWAP就设置为内存大小的0.75倍。

  查看SWAP分区情况:

 

grep SwapTotal /proc/meminfo

D.TMP空间

  要求至少1G

  查看TMP空间

  df -k /tmp

F: 检查dns是否配置

cat /etc/resolv.conf

 

 

5.禁用防火墙和SELinux(在两节点分别执行)

禁用防火墙

service iptables status

service iptables stop

chkconfig iptables off

 

关闭SELinux

#vi /etc/selinux/config

将文件中的SELINUX="" 为 disabled ,然后重启。

如果不想重启系统,使用命令setenforce 0

注:setenforce 1 设置SELinux 成为enforcing模式

    setenforce 0 设置SELinux 成为permissive模式

 

getenforce/setenforce查看和设置SELinux的当前工作模式

 

查看selinx状态

sestatus

 

六: 建立oracle、grid用户及相关目录

——在两节点分别执行

groupadd  -g 1000  oinstall

groupadd  -g 1100  asmadmin

groupadd  -g 1200  dba

groupadd  -g 1201  oper

groupadd  -g 1300  asmdba

groupadd  -g 1301  asmoper

useradd -u 1100 -g oinstall -G asmadmin,asmdba,asmoper,dba grid

useradd -u 1101 -g oinstall -G dba,oper,asmdba,asmadmin oracle

passwd oracle

passwd grid

 

 

mkdir -p /oracle/app/11.2.0/grid   

mkdir -p /oracle/app/grid         

chown -R grid:oinstall /oracle

mkdir –p /oracle/app/oracle

mkdir -p /oracle/app/oracle/product/11.2.0/dbhome_1

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

chmod -R 775 /oracle/

 

七设置相关系统参数(在两节点分别执行)

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

oracle soft memlock 151072000  

oracle hard memlock 151072000

——memlock标记,用于设置每个用户允许的最大内存使用情况。这个取值可以设置为数据库服务器物理内存大小。

 

更改系统参数 vi /etc/sysctl.conf

shmall 是全部允许使用的共享内存大小,shmmax 是单个段允许使用的大小。这两个可以设置为内存的 90%。例如 16G 内存,16*1024*1024*1024*90% = 15461882265,shmall 的大小为 15461882265/4k(getconf PAGESIZE可得到) = 3774873。

vm.dirty_background_ratio = 3

vm.dirty_ratio = 20

vm.dirty_expire_centisecs = 500

vm.dirty_writeback_centisecs = 100

vm.min_free_kbytes=524288

vm.swappiness = 10

net.core.rmem_default = 4194304

net.core.rmem_max = 4194304

net.core.wmem_default = 4194304

net.core.wmem_max =4194304

fs.file-max = 6815744

fs.aio-max-nr = 4194304

kernel.sem = 20000 1280000 20000 1024

kernel.shmmax = 1932735283

kernel.shmall = 483183820

kernel.shmmni = 4096

net.ipv4.ip_local_port_range = 9000 65500

 

/sbin/sysctl -p

 

 

vi /etc/pam.d/login

加入以下语句

session required /lib64/security/pam_limits.so

 

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

 

配置:用于监视 Linux 内核是否挂起

vi /etc/modprobe.conf

options hangcheck-timer hangcheck_tick=30 hangcheck_margin=180

 

自动加载hangcheck-timer 模块(设置hangcheck内核模块开机加载)

vi /etc/rc.local

modprobe hangcheck-timer

 

检查hangcheck-timer模块是否已经加载:

lsmod | grep hangcheck_timer

 

八: 设置NTP服务

1)在节点一配置/etc/ntp.conf(以节点1向节点2做时间同步,节点2为NTP Server

cat /etc/ntp.conf

# For more information about this file, see the man pages

# ntp.conf(5), ntp_acc(5), ntp_auth(5), ntp_clock(5), ntp_misc(5), ntp_mon(5).

server 192.168.11.42  prefer

server 192.168.11.42

driftfile /var/lib/ntp/drift/ntp.drift

 

# Permit time synchronization with our time source, but do not

# permit the source to query or modify the service on this system.

restrict default kod nomodify notrap nopeer noquery

restrict -6 default kod nomodify notrap nopeer noquery

 

# Permit all access over the loopback interface.  This could

# be tightened as well, but to do so would effect some of

# the administrative functions.

restrict 127.0.0.1

restrict -6 ::1

disable monitor

 

2)分别在2个节点设置NTP服务

vi /etc/sysconfig/ntpd

# Drop root to id 'ntp:ntp' by default.

OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"

 

--重启ntp

在重启前可先手动使用ntpdate 192.168.11.42 进行时间同步。

service ntpd restart

chkconfig ntpd on

[root@fast1 sysconfig]# service ntpd restart

Shutting down ntpd: [  OK  ]

Starting ntpd: [  OK  ]

[root@fast1 sysconfig]# chkconfig ntpd on

[root@fast1 sysconfig]#

[root@fast1 sysconfig]#

[root@fast1 sysconfig]# ntpdate 192.168.11.42

 9 Mar 22:22:21 ntpdate[28554]: the NTP socket is in use, exiting

[root@fast1 sysconfig]#

——查看NTP服务的运行状况

[root@fast1 sysconfig]# ntpq -p

remote   refid      st t when poll reach   delay   offset  jitter

===========================================

 fast2  .INIT.  16 u   48   64    0  0.000    0.000   0.000

 

[root@fast2 ~]# service ntpd restart

Shutting down ntpd: [  OK  ]

Starting ntpd: [  OK  ]

[root@fast2 ~]#

[root@fast2 ~]# chkconfig ntpd on

 

九:yum安装系统包(在两节点分别执行)

——挂载光盘

[root@fast1 ~]# df -h

Filesystem      Size  Used Avail Use% Mounted on

/dev/sda3        35G  3.0G   31G   9% /

tmpfs          1004M   76K 1004M   1% /dev/shm

/dev/sda1       477M   41M  411M   9% /boot

/dev/sr0        3.6G  3.6G     0 100% /media/RHEL-6.7 Server.x86_64

[root@fast1 ~]#

[root@fast1 ~]# mount /dev/sr0  /mnt

mount: block device /dev/sr0 is write-protected, mounting read-only

 

建立相关yum源

[root@fast1 yum.repos.d]# pwd

/etc/yum.repos.d

[root@fast1 yum.repos.d]# ls

redhat.repo  rhel-source.repo

[root@fast1 yum.repos.d]#cp rhel-source.repo yum.repo

[root@fast1 yum.repos.d]vi yum.repo

[base]

name=base

baseurl=file:///mnt/Server  

enabled=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

 

[HighAvailability]

name=HighAvailability

baseurl=file:///mnt/HighAvailability

enabled=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

 

[ResilientStorage]

name=ResilientStorage

baseurl=file:///mnt/ResilientStorage

enabled=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

 

[LoadBalancer]

name=LoadBalancer

baseurl=file:///mnt/LoadBalancer

enabled=1

gpgcheck=0

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

 

 

 

——清空yum缓存

yum clean all

——生成列表

yum list

 

安装相关软件:

——检测redhat6.7需要的安装包是否已安装:

[root@fast1 Packages]# rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libgcc libstdc++ libstdc++-devel libaio libaio-devel make sysstat

 

binutils-2.20.51.0.2-5.43.el6.x86_64

package compat-libcap1 is not installed

package compat-libstdc++-33 is not installed

package gcc is not installed

package gcc-c++ is not installed

glibc-2.12-1.166.el6.x86_64

glibc-devel-2.12-1.166.el6.x86_64

ksh-20120801-28.el6.x86_64

libgcc-4.4.7-16.el6.x86_64

libgcc-4.4.7-16.el6.i686

libstdc++-4.4.7-16.el6.x86_64

package libstdc++-devel is not installed

libaio-0.3.107-10.el6.x86_64

libaio-0.3.107-10.el6.i686

libaio-devel-0.3.107-10.el6.x86_64

libaio-devel-0.3.107-10.el6.i686

make-3.81-20.el6.x86_64

sysstat-9.0.4-27.el6.x86_64

[root@fast1 Packages]#

——安装未安装的包:

yum install -y compat-libcap1*

yum install -y compat-libstdc++-33*

yum install -y gcc*

yum install -y libstdc++-devel*

 

 

十. 设置用户的环境变量(在两节点分别执行)

#gird用户

修改 ~/.bash_profile文件

ORACLE_SID=+ASM1;export ORACLE_SID

ORACLE_BASE=/oracle/app/grid;export ORACLE_BASE

ORACLE_HOME=/oracle/app/11.2.0/grid;export ORACLE_HOME

GRID_HOME=/oracle/app/11.2.0/grid;export GRID_HOME

JAVA_HOME=$ORACLE_HOME/jdk;export JAVA_HOME

ORACLE_PATH=/oracle/app/oracle/common/oracle/sql;export ORACLE_PATH

ORACLE_TERM=xterm;export ORACLE_TERM

TNS_ADMIN=$ORACLE_HOME/network/admin;export TNS_ADMIN

PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin

PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin

PATH=${PATH}:/oracle/app/common/oracle/bin

PATH=$PATH:$ORACLE_HOME/oracm/bin:$ORACLE_HOME/OPatch

export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib

LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib

LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib

LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/ctx/lib

export LD_LIBRARY_PATH

CLASSPATH=$ORACLE_HOME/JRE

CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib

CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib

CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib

export CLASSPATH  

export TEMP=/tmp

export TMPDIR=/tmp

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

export SQLPATH=~/admin/sql:/$ORACLE_HOME/sqlplus/admin

export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"

umask 022

 

[grid@fast1 ~]$ source .bash_profile

 

#oracle用户

修改 ~/.bash_profile文件:

 

ORACLE_SID=test1;export ORACLE_SID

ORACLE_UNQNAME=test;export ORACLE_UNQNAME

ORACLE_BASE=/oracle/app/oracle;export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1;export ORACLE_HOME

JAVA_HOME=$ORACLE_HOME/jdk;export JAVA_HOME

ORACLE_PATH=/oracle/app/oracle/common/oracle/sql;export ORACLE_PATH

ORACLE_TERM=xterm;export ORACLE_TERM

TNS_ADMIN=$ORACLE_HOME/network/admin;export TNS_ADMIN

PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin

PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin

PATH=${PATH}:/oracle/app/common/oracle/bin

PATH=$PATH:$ORACLE_HOME/oracm/bin:$ORACLE_HOME/OPatch: LD_LIBRARY_PATH=$ORACLE_HOME/lib

LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib

LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib

LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/ctx/lib

export LD_LIBRARY_PATH

CLASSPATH=$ORACLE_HOME/JRE

CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib

CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib

CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib

export CLASSPATH  

export TEMP=/tmp

export TMPDIR=/tmp

export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK

export SQLPATH=~/admin/sql:/$ORACLE_HOME/sqlplus/admin

export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"

umask 022

 

[oracle@fast1 ~]$ source .bash_profile

 

十一: 配置SSH

grid用户:

在两节点分别执行:

ssh-keygen -t rsa

ssh-keygen -t dsa

cd .ssh

cat *.pub > authorized_keys

 

节点1:

scp authorized_keys grid@节点2:/home/grid/.ssh/keys_dbs

 

节点2:

cat keys_dbs >> authorized_keys

scp authorized_keys grid@节点1:/home/grid/.ssh/

 

oracle用户:方法同grid一样配置

ssh-keygen -t rsa

ssh-keygen -t dsa

cd .ssh

cat *.pub > authorized_keys

 

节点1:

scp authorized_keys oracle@节点2:/home/grid/.ssh/keys_dbs

 

节点2:

cat keys_dbs >> authorized_keys

scp authorized_keys oracle@节点1:/home/grid/.ssh/

 

测试:

在节点1上:

ssh 节点2 public ip

ssh 节点2 private ip

ssh 节点1 public ip  --有时集群检查会过不了,所以需要ssh自己下

ssh 节点1 private ip

在节点2上:

ssh 节点1 public ip

ssh 节点1 private ip

ssh 节点2 public ip  --有时集群检查会过不了,所以需要ssh自己下

ssh 节点2 private ip

 

 

 

十二:.配置共享存储:

用UDEV配置ASM所需磁盘(在所有节点配置)

--查看磁盘情况

[root@fast1 ~]# fdisk -l

 

Disk /dev/sda: 42.9 GB, 42949672960 bytes

255 heads, 63 sectors/track, 5221 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000d61

 

   Device Boot      Start         End      Blocks   Id  System

/dev/sda1   *           1          64      512000   83  Linux

Partition 1 does not end on cylinder boundary.

/dev/sda2              64         587     4194304   82  Linux swap / Solaris

Partition 2 does not end on cylinder boundary.

/dev/sda3             587        5222    37235712   83  Linux

 

Disk /dev/sdb: 2147 MB, 2147483648 bytes

255 heads, 63 sectors/track, 261 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000

省略.............................

 

--查看共享磁盘对应的uuid:

[root@fast1 ~]#  scsi_id -g -u /dev/sdb

1ATA_VBOX_HARDDISK_VBa2674be4-d56a18ec

[root@fast1 ~]#

[root@fast1 ~]#  scsi_id -g -u /dev/sdc

1ATA_VBOX_HARDDISK_VB58731b41-c97b4765

[root@fast1 ~]#

[root@fast1 ~]#  scsi_id -g -u /dev/sdd

1ATA_VBOX_HARDDISK_VB9bc89125-834a7fc7

[root@fast1 ~]#

[root@fast1 ~]#  scsi_id -g -u /dev/sde

1ATA_VBOX_HARDDISK_VBedf09587-cce1e323

[root@fast1 ~]#

[root@fast1 ~]#  scsi_id -g -u /dev/sdf

1ATA_VBOX_HARDDISK_VB76b16a97-de075646

[root@fast1 ~]#

[root@fast1 ~]#  scsi_id -g -u /dev/sdg

1ATA_VBOX_HARDDISK_VB7a4dfd6c-550d5979

[root@fast1 ~]#

[root@fast1 ~]#  scsi_id -g -u /dev/sdh

1ATA_VBOX_HARDDISK_VB47fd4f8f-e781988c

--配置规则文件

[root@fast1 ~]# cd /etc/udev/rules.d/

 

——各节点文件99-oracle-asmdevices.rules添加如下信息:

[root@fast1 rules.d]# vi 99-oracle-asmdevices.rules

KERNEL=="sd*", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VBa2674be4-d56a18ec", NAME="asm_wang_ocr1", OWNER="grid", GROUP="asmdba", MODE="0660"

KERNEL=="sd*", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB58731b41-c97b4765", NAME="asm_wang_ocr2", OWNER="grid", GROUP="asmdba", MODE="0660"

KERNEL=="sd*", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB9bc89125-834a7fc7", NAME="asm_wang_ocr3", OWNER="grid", GROUP="asmdba", MODE="0660"

KERNEL=="sd*", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VBedf09587-cce1e323", NAME="asm_wang_fra1", OWNER="grid", GROUP="asmdba", MODE="0660"

KERNEL=="sd*", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB76b16a97-de075646", NAME="asm_wang_fra2", OWNER="grid", GROUP="asmdba", MODE="0660"

KERNEL=="sd*", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB7a4dfd6c-550d5979", NAME="asm_wang_data1", OWNER="grid", GROUP="asmdba", MODE="0660"

KERNEL=="sd*", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="1ATA_VBOX_HARDDISK_VB47fd4f8f-e781988c", NAME="asm_wang_data2", OWNER="grid", GROUP="asmdba", MODE="0660"~

~

"99-oracle-asmdevices.rules" [New] 7L, 1473C written

[root@fast1 rules.d]#

 

--重启服务

[root@fast1 rules.d]# start_udev

Starting udev: [  OK  ]

[root@fast1 rules.d]#

 

--验证结果;

[root@fast1 rules.d]# ll /dev/asm*

brw-rw---- 1 grid asmdba 8,  96 Mar 12 03:34 /dev/asm_wang_data1

brw-rw---- 1 grid asmdba 8, 112 Mar 12 03:34 /dev/asm_wang_data2

brw-rw---- 1 grid asmdba 8,  64 Mar 12 03:34 /dev/asm_wang_fra1

brw-rw---- 1 grid asmdba 8,  80 Mar 12 03:34 /dev/asm_wang_fra2

brw-rw---- 1 grid asmdba 8,  16 Mar 12 03:34 /dev/asm_wang_ocr1

brw-rw---- 1 grid asmdba 8,  32 Mar 12 03:34 /dev/asm_wang_ocr2

brw-rw---- 1 grid asmdba 8,  48 Mar 12 03:34 /dev/asm_wang_ocr3

[root@fast1 rules.d]#

 

 

十三:在节点一创建介质上传目录:

上传的是11.2.0.4的grid、oracle包及psu包、opatch包

mkdir /soft

chown -R oracle:oinstall /soft

chmod -R 775 /soft


 

解压省略……………..

 

 

十四:在安装节点执行安装GI前的检测

用grid用户进行检测:

[grid@fast1 ~]$ cd /soft

[grid@fast1 soft]$ ll

total 4514096

drwxr-xr-x 7 oracle oinstall       4096 Aug 27  2013 database

drwxr-xr-x 7 grid   oinstall       4096 Aug 27  2013 grid

-rw-r--r-- 1 oracle oinstall 1395582860 Feb 19  2016 p13390677_112040_Linux_x86_64_1of7.zip

-rw-r--r-- 1 oracle oinstall 1151304589 Feb 19  2016 p13390677_112040_Linux_x86_64_2of7.zip

-rw-r--r-- 1 oracle oinstall 1205251894 Mar 14  2016 p13390677_112040_Linux-x86-64_3of7.zip

-rw-r--r-- 1 oracle oinstall  105489166 Nov  2 15:59 p24006111_112040_Linux-x86-64.zip

-rw-r--r-- 1 oracle oinstall  712035213 Jan 19 16:59 p24436338_112040_Linux-x86-64.zip

-rw-r--r-- 1 oracle oinstall   52733900 Mar 14  2016 p6880880_112000_Linux-x86-64.zip

[grid@fast1 soft]$

[grid@fast1 soft]$ cd grid/

[grid@fast1 grid]$

[grid@fast1 grid]$ ls

install  readme.html  response  rpm  runcluvfy.sh  runInstaller  sshsetup  stage  welcome.html

[grid@fast1 grid]$

[grid@fast1 grid]$ ./runcluvfy.sh stage -pre crsinst -n fast1,fast2 -fixup -verbose

省略…………………………..

检测发现pdksh  elfutils-libelf-devel这两个包未安装,且pdksh包光盘内没有,需下载或者忽略;

yum install -y elfutils-libelf-devel*

………………省略…………………………………….

yum install -y pdksh*

 

注意:本次下载pdksh-5.2.14-1.i386.rpm,pdksh与ksh冲突:

[root@fast1 soft]#  rpm -q ksh

ksh-20120801-28.el6.x86_64

[root@fast1 soft]#

[root@fast1 soft]#  rpm -e ksh

[root@fast1 soft]#

[root@fast1 soft]#  rpm -q ksh

package ksh is not installed

 

[root@fast1 soft]# yum install -y pdksh-5.2.14-1.i386.rpm

………………………………………

Installed:

  pdksh.i386 0:5.2.14-1                                                                                                              

 

Dependency Installed:

  glibc.i686 0:2.12-1.166.el6                                nss-softokn-freebl.i686 0:3.14.3-22.el6_6                               

 

Complete!

[root@fast1 soft]#

上述节点2同样安装;

十五:安装GRID集群软件

——以grid用户登录安装GI软件:

[grid@fast1 ~]$ cd /soft

[grid@fast1 soft]$ ls

database                                p24006111_112040_Linux-x86-64.zip

grid                                    p24436338_112040_Linux-x86-64.zip

p13390677_112040_Linux_x86_64_1of7.zip  p6880880_112000_Linux-x86-64.zip

p13390677_112040_Linux_x86_64_2of7.zip  pdksh-5.2.14-1.i386.rpm

p13390677_112040_Linux-x86-64_3of7.zip

[grid@fast1 soft]$ cd grid/

[grid@fast1 grid]$ ls

install      response  runcluvfy.sh  sshsetup  welcome.html

readme.html  rpm       runInstaller  stage

[grid@fast1 grid]$ ./runInstaller


 

选择第一项:安装GI


 

选择高级安装

 


 

加入汉语简体:


 

参照/etc/hosts配置,输入集群名字、scan主机名、scan端口


 

添加集群节点信息

添加集群节点, 直接在此选择【setup】,输入grid用户的密码

 

 

配置和检测public、private网卡


 


 

选择voting磁盘3块,Normal类型,配置磁盘组OCRDG


输入
asm管理员的密码

   

执行安装前的检查, 确认安装前的检查结果,如果是内核参数设置问题,可通过fix自动调整,如果缺少rpm补丁包,需要对应的安装rpm补丁包。一些检查操作,可以选择ignore all进行忽略:

[root@fast1 soft]# /tmp/CVU_11.2.0.4.0_grid/runfixup.sh

Response file being used is :/tmp/CVU_11.2.0.4.0_grid/fixup.response

Enable file being used is :/tmp/CVU_11.2.0.4.0_grid/fixup.enable

Log file location: /tmp/CVU_11.2.0.4.0_grid/orarun.log

Installing Package /tmp/CVU_11.2.0.4.0_grid//cvuqdisk-1.0.9-1.rpm

Preparing...                ########################################### [100%]

   1:cvuqdisk               ########################################### [100%]

[root@fast1 soft]#


 

——节点一:

[root@fast1 ~]# /oracle/app/oraInventory/orainstRoot.sh

Changing permissions of /oracle/app/oraInventory.

Adding read,write permissions for group.

Removing read,write,execute permissions for world.

 

Changing groupname of /oracle/app/oraInventory to oinstall.

The execution of the script is complete.

[root@fast1 ~]#

[root@fast1 ~]# /oracle/app/11.2.0/grid/root.sh

Performing root user operation for Oracle 11g

 

The following environment variables are set as:

    ORACLE_OWNER= grid

    ORACLE_HOME=  /oracle/app/11.2.0/grid

 

Enter the full pathname of the local bin directory: [/usr/local/bin]:

   Copying dbhome to /usr/local/bin ...

   Copying oraenv to /usr/local/bin ...

   Copying coraenv to /usr/local/bin ...

 

Creating /etc/oratab file...

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root script.

Now product-specific root actions will be performed.

Using configuration parameter file: /oracle/app/11.2.0/grid/crs/install/crsconfig_params

Creating trace directory

User ignored Prerequisites during installation

Installing Trace File Analyzer

OLR initialization - successful

  root wallet

  root wallet cert

  root cert export

  peer wallet

  profile reader wallet

  pa wallet

  peer wallet keys

  pa wallet keys

  peer cert request

  pa cert request

  peer cert

  pa cert

  peer root cert TP

  profile reader root cert TP

  pa root cert TP

  peer pa cert TP

  pa peer cert TP

  profile reader pa cert TP

  profile reader peer cert TP

  peer user cert

  pa user cert

Adding Clusterware entries to upstart

CRS-2672: Attempting to start 'ora.mdnsd' on 'fast1'

CRS-2676: Start of 'ora.mdnsd' on 'fast1' succeeded

CRS-2672: Attempting to start 'ora.gpnpd' on 'fast1'

CRS-2676: Start of 'ora.gpnpd' on 'fast1' succeeded

CRS-2672: Attempting to start 'ora.cssdmonitor' on 'fast1'

CRS-2672: Attempting to start 'ora.gipcd' on 'fast1'

CRS-2676: Start of 'ora.cssdmonitor' on 'fast1' succeeded

CRS-2676: Start of 'ora.gipcd' on 'fast1' succeeded

CRS-2672: Attempting to start 'ora.cssd' on 'fast1'

CRS-2672: Attempting to start 'ora.diskmon' on 'fast1'

CRS-2676: Start of 'ora.diskmon' on 'fast1' succeeded

CRS-2676: Start of 'ora.cssd' on 'fast1' succeeded

 

ASM created and started successfully.

 

Disk Group OCRDG created successfully.

 

clscfg: -install mode specified

Successfully accumulated necessary OCR keys.

Creating OCR keys for user 'root', privgrp 'root'..

Operation successful.

CRS-4256: Updating the profile

Successful addition of voting disk 7399695877fc4f25bfa5209341cb8924.

Successful addition of voting disk 028b62cc838b4f66bf7532afde781298.

Successful addition of voting disk 251dd2f5dd414f20bf3e4f923dc34201.

Successfully replaced voting disk group with +OCRDG.

CRS-4256: Updating the profile

CRS-4266: Voting file(s) successfully replaced

##  STATE    File Universal Id                File Name Disk group

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

 1. ONLINE   7399695877fc4f25bfa5209341cb8924 (/dev/asm_wang_ocr1) [OCRDG]

 2. ONLINE   028b62cc838b4f66bf7532afde781298 (/dev/asm_wang_ocr2) [OCRDG]

 3. ONLINE   251dd2f5dd414f20bf3e4f923dc34201 (/dev/asm_wang_ocr3) [OCRDG]

Located 3 voting disk(s).

CRS-2672: Attempting to start 'ora.asm' on 'fast1'

CRS-2676: Start of 'ora.asm' on 'fast1' succeeded

CRS-2672: Attempting to start 'ora.OCRDG.dg' on 'fast1'

CRS-2676: Start of 'ora.OCRDG.dg' on 'fast1' succeeded

Configure Oracle Grid Infrastructure for a Cluster ... succeeded

[root@fast1 ~]#

——节点二:

[root@fast2 ~]# /oracle/app/oraInventory/orainstRoot.sh

Changing permissions of /oracle/app/oraInventory.

Adding read,write permissions for group.

Removing read,write,execute permissions for world.

 

Changing groupname of /oracle/app/oraInventory to oinstall.

The execution of the script is complete.

[root@fast2 ~]# /oracle/app/11.2.0/grid/root.sh

Performing root user operation for Oracle 11g

 

The following environment variables are set as:

    ORACLE_OWNER= grid

    ORACLE_HOME=  /oracle/app/11.2.0/grid

 

Enter the full pathname of the local bin directory: [/usr/local/bin]:

   Copying dbhome to /usr/local/bin ...

   Copying oraenv to /usr/local/bin ...

   Copying coraenv to /usr/local/bin ...

 

Creating /etc/oratab file...

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root script.

Now product-specific root actions will be performed.

 

Using configuration parameter file: /oracle/app/11.2.0/grid/crs/install/crsconfig_params

Creating trace directory

User ignored Prerequisites during installation

Installing Trace File Analyzer

OLR initialization - successful

Adding Clusterware entries to upstart

CRS-4402: The CSS daemon was started in exclusive mode but found an active CSS daemon on node fast1, number 1, and is terminating

An active cluster was found during exclusive startup, restarting to join the cluster

Configure Oracle Grid Infrastructure for a Cluster ... succeeded

[root@fast2 ~]#



——验证:

[grid@fast1 oraInventory]$crsctl check crs

CRS-4638: Oracle High Availability Services is online

CRS-4537: Cluster Ready Services is online

CRS-4529: Cluster Synchronization Services is online

CRS-4533: Event Manager is online

[grid@fast1 oraInventory]$

[grid@fast1 oraInventory]$

[grid@fast1 oraInventory]$ crsctl stat res –t

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

NAME           TARGET  STATE        SERVER                   STATE_DETAILS       

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

Local Resources

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

ora.LISTENER.lsnr

               ONLINE  ONLINE       fast1                                        

               ONLINE  ONLINE       fast2                                        

ora.OCRDG.dg

               ONLINE  ONLINE       fast1                                        

               ONLINE  ONLINE       fast2                                        

ora.asm

               ONLINE  ONLINE       fast1                    Started             

               ONLINE  ONLINE       fast2                    Started             

ora.gsd

               OFFLINE OFFLINE      fast1                                        

               OFFLINE OFFLINE      fast2                                        

ora.net1.network

               ONLINE  ONLINE       fast1                                        

               ONLINE  ONLINE       fast2                                        

ora.ons

               ONLINE  ONLINE       fast1                                        

               ONLINE  ONLINE       fast2                                        

ora.registry.acfs

               ONLINE  ONLINE       fast1                                        

               ONLINE  ONLINE       fast2                                        

-----------------------------------------------------------------------Cluster Resources

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

ora.LISTENER_SCAN1.lsnr

      1        ONLINE  ONLINE       fast1                                        

ora.cvu

      1        ONLINE  ONLINE       fast1                                        

ora.fast1.vip

      1        ONLINE  ONLINE       fast1                                        

ora.fast2.vip

      1        ONLINE  ONLINE       fast2                                        

ora.oc4j

      1        ONLINE  ONLINE       fast1                                        

ora.scan1.vip

      1        ONLINE  ONLINE       fast1                                        

[grid@fast1 oraInventory]$

 

十六: 安装数据库软件

——以oracle用户身份登录执行安装操作:

[oracle@fast1 ~]$ cd /soft

[oracle@fast1 soft]$ ls

database                                p24006111_112040_Linux-x86-64.zip

grid                                    p24436338_112040_Linux-x86-64.zip

p13390677_112040_Linux_x86_64_1of7.zip  p6880880_112000_Linux-x86-64.zip

p13390677_112040_Linux_x86_64_2of7.zip  pdksh-5.2.14-1.i386.rpm

p13390677_112040_Linux-x86-64_3of7.zip

[oracle@fast1 soft]$ cd database/

[oracle@fast1 database]$ ls

install  readme.html  response  rpm  runInstaller  sshsetup  stage  welcome.html

[oracle@fast1 database]$ ./runInstaller


 

只安装oracle database 软件

 

 

设置RAC安装项,选择所有节点进行安装,直接在此选择【setup】,输入oracle用户的密码

    

执行安装前的检查, 确认安装前的检查结果,如果是内核参数设置问题,可通过fix自动调整,如果缺少rpm补丁包,需要对应的安装rpm补丁包。一些检查操作,可以选择ignore all进行忽略

   

——节点一:

[root@fast1soft]# /oracle/app/oracle/product/11.2.0/dbhome_1/root.sh

Performing root user operation for Oracle 11g

 

The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /oracle/app/oracle/product/11.2.0/dbhome_1

 

Enter the full pathname of the local bin directory: [/usr/local/bin]:

The contents of "dbhome" have not changed. No need to overwrite.

The contents of "oraenv" have not changed. No need to overwrite.

The contents of "coraenv" have not changed. No need to overwrite.

 

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root script.

Now product-specific root actions will be performed.

Finished product-specific root actions.

[root@fast1 soft]#

 

——节点二:

[root@fast2~]# /oracle/app/oracle/product/11.2.0/dbhome_1/root.sh

Performing root user operation for Oracle 11g

 

The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /oracle/app/oracle/product/11.2.0/dbhome_1

 

Enter the full pathname of the local bin directory: [/usr/local/bin]:

The contents of "dbhome" have not changed. No need to overwrite.

The contents of "oraenv" have not changed. No need to overwrite.

The contents of "coraenv" have not changed. No need to overwrite.

 

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root script.

Now product-specific root actions will be performed.

Finished product-specific root actions.

[root@fast2 ~]#

 

 

十七:ASM Diskgroup创建(asmca)

创建DATA和FRA磁盘组

——以grid用户登录,并执行asmca命令工具建立磁盘组,用xshell工具启图形

[grid@fast1 ~]$ asmca

 

 

 

 

 

十八:创建数据库(dbca建数据库)

——以oracle用户登录,用xshell工具启图形:

[oracle@fast1 ~]$ dbca

 

 
选择所有节点

  

选择数据库存储磁盘

  

设置内存、字符集等

 

  设置会话数:

 
字符集:

 

   

 

 

 

——RAC双节点数据库装好,验证:

[grid@fast1 ~]$ crsctl check crs

CRS-4638: Oracle High Availability Services is online

CRS-4537: Cluster Ready Services is online

CRS-4529: Cluster Synchronization Services is online

CRS-4533: Event Manager is online

[grid@fast1 ~]$

[grid@fast1 ~]$ crsctl stat res -t

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

NAME           TARGET  STATE        SERVER                   STATE_DETAILS       

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

Local Resources

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

ora.DATA.dg

               ONLINE  ONLINE       fast1                                        

               ONLINE  ONLINE       fast2                                        

ora.FRA.dg

               ONLINE  ONLINE       fast1                                        

               ONLINE  ONLINE       fast2                                        

ora.LISTENER.lsnr

               ONLINE  ONLINE       fast1                                        

               ONLINE  ONLINE       fast2                                        

ora.OCRDG.dg

               ONLINE  ONLINE       fast1                                        

               ONLINE  ONLINE       fast2                                        

ora.asm

               ONLINE  ONLINE       fast1                    Started             

               ONLINE  ONLINE       fast2                    Started             

ora.gsd

               OFFLINE OFFLINE      fast1                                        

               OFFLINE OFFLINE      fast2                                        

ora.net1.network

               ONLINE  ONLINE       fast1                                        

               ONLINE  ONLINE       fast2                                        

ora.ons

               ONLINE  ONLINE       fast1                                        

               ONLINE  ONLINE       fast2                                        

ora.registry.acfs

               ONLINE  ONLINE       fast1                                        

               ONLINE  ONLINE       fast2                                        

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

Cluster Resources

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

ora.LISTENER_SCAN1.lsnr

      1        ONLINE  ONLINE       fast1                                        

ora.cvu

      1        ONLINE  ONLINE       fast1                                        

ora.fast1.vip

      1        ONLINE  ONLINE       fast1                                        

ora.fast2.vip

      1        ONLINE  ONLINE       fast2                                        

ora.oc4j

      1        ONLINE  ONLINE       fast1                                        

ora.scan1.vip

      1        ONLINE  ONLINE       fast1                                        

ora.test.db

      1        ONLINE  ONLINE       fast1                    Open                

      2        ONLINE  ONLINE       fast2                    Open                

[grid@fast1 ~]$



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

请登录后发表评论 登录
全部评论

注册时间:2016-09-22

  • 博文量
    916
  • 访问量
    1409322