oracle11g rac安装部署

1、虚拟机配置

oracle11g rac安装部署oracle11g rac安装部署

2、上传oracle软件包(在第一个节点上传即可)

-rw-r--r-- 1 root root 1395582860 Nov  7  2014 p13390677_112040_Linux-x86-64_1of7.zip
-rw-r--r-- 1 root root 1151304589 Nov  7  2014 p13390677_112040_Linux-x86-64_2of7.zip

-rw-r--r-- 1 root root 1205251894 Nov  7  2014 p13390677_112040_Linux-x86-64_3of7.zip

3、配置Yum源用于安装oracle依赖包(两个节点都要做)

[[email protected] ~]# cd /etc/yum.repos.d
[[email protected] yum.repos.d]# ls -l
total 4
-rw-r--r-- 1 root root 71 Aug 21 05:54 kobe.repo
[[email protected] yum.repos.d]# cat kobe.repo 
[kobe]
name=kobe
baseurl=file:///mnt/cdrom/Server
enabled=1
gpgcheck=0

4、挂载光盘(两个节点都要)

[[email protected] yum.repos.d]# mkdir /mnt/cdrom
[[email protected] yum.repos.d]# mount /dev/cdrom /mnt/cdrom

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

5、安装oracle依赖包

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*

6、/etc/hosts文件配置

第一个节点

192.168.1.53 itpux1
#public ip ent1
192.168.1.53    itpux1
192.168.1.54    itpux2
#priv ip ent2
192.168.40.133  itpux1prv
192.168.40.134  itpux2prv
#vip ip
192.168.1.128   itpux1vip
192.168.1.129   itpux2vip
#scan ip

192.168.1.185   itpuxscan

第二个节点

192.168.1.54 itpux2
#public ip ent1
192.168.1.53    itpux1
192.168.1.54    itpux2
#priv ip ent2
192.168.40.133  itpux1prv
192.168.40.134  itpux2prv
#vip ip
192.168.1.128   itpux1vip
192.168.1.129   itpux2vip
#scan ip

192.168.1.185   itpuxscan

7、配置主机名

第一个节点

[[email protected] yum.repos.d]# hostname itpux1
[[email protected] yum.repos.d]# vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no

HOSTNAME=itpux1

第二个节点

[[email protected] yum.repos.d]# hostname itpux2
[[email protected] yum.repos.d]# vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no

HOSTNAME=itpux2

8、添加用户和组

[[email protected] ~]# /usr/sbin/groupadd -g 501 oinstall
[[email protected] ~]# /usr/sbin/groupadd -g 502 dba
[[email protected] ~]# /usr/sbin/groupadd -g 503 oper
[[email protected] ~]# /usr/sbin/groupadd -g 504 asmadmin
[[email protected] ~]# /usr/sbin/groupadd -g 505 asmoper
[[email protected] ~]# /usr/sbin/groupadd -g 506 asmdba
[[email protected] ~]# /usr/sbin/useradd -g oinstall -G dba,asmdba,oper oracle
[[email protected] ~]# /usr/sbin/useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
[[email protected] ~]# 
[[email protected] ~]# echo "oracle" |passwd --stdin oracle
Changing password for user oracle.
passwd: all authentication tokens updated successfully.
[[email protected] ~]# echo "grid"|passwd --stdin grid
Changing password for user grid.

passwd: all authentication tokens updated successfully.

9、创建目录

[[email protected] ~]# mkdir -p /u01/app/grid
[[email protected] ~]# mkdir -p /u01/app/11.2.0/grid
[[email protected] ~]# chown -R grid:oinstall /u01
[[email protected] ~]# mkdir -p /u01/app/oraInventory
[[email protected] ~]# chown -R grid:oinstall /u01/app/oraInventory
[[email protected] ~]# mkdir -p /u01/app/oracle
[[email protected] ~]# chown -R oracle:oinstall /u01/app/oracle

[[email protected] ~]# chmod -R 775 /u01

10、

修改/etc/security/limits.conf文件
vi /etc/security/limits.conf
#ORACLE SETTING
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

11、vi /etc/security/limits.d/90-nproc.conf

#* soft nproc 1024
* - nproc 16384
root soft nproc unlimited

12、[[email protected] ~]# 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 - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
#       targeted - Only targeted network daemons are protected.
#       strict - Full SELinux protection.

SELINUXTYPE=targeted

[[email protected] ~]# setenforce 0

13、

[[email protected] ~]# service iptables stop

[[email protected] ~]# chkconfig iptables off

14、

vi /etc/pam.d/login

#ORACLE SETTING
session required pam_limits.so

15、

vi /etc/sysctl.conf
#ORACLE SETTING
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmmax = 1147483648
kernel.shmall = 524288
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

16、停止ntp服务

[[email protected] ~]# service ntpd status
ntpd is stopped
[[email protected] ~]# chkconfig ntpd off
[[email protected] ~]# cp /etc/ntp.conf /etc/ntp.conf.bak

[[email protected] ~]# rm -rf /etc/ntp.conf


17、[[email protected] ~]$ cat .bash_profile 
# .bash_profile


# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
export PS1
umask 022
alias sqlplus="rlwrap sqlplus"
export TMP=/tmp
export LANG=en_US
export TMPDIR=$TMP
export ORACLE_HOSTNAME=itpux1
ORACLE_SID=+ASM1; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
ORACLE_BASE=/u01/app/grid; export ORACLE_BASE
ORACLE_HOME=/u01/app/11.2.0/grid; export ORACLE_HOME
NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT
PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin; export PATH
THREADS_FLAG=native; export THREADS_FLAG
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


[[email protected] ~]$ cat .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs


PATH=$PATH:$HOME/bin

export PATH
alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap rman"
export PS1
export TMP=/tmp
export LANG=en_US
export TMPDIR=$TMP
export ORACLE_HOSTNAME=itpux1
export ORACLE_UNQNAME=itpuxdb
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_SID=itpuxdb1; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;export NLS_LANG
PATH=.:$PATH:$HOME/bin:$ORACLE_BASE/product/11.2.0/db_1/bin:$ORACLE_HOME/bin; export PATH
THREADS_FLAG=native; export THREADS_FLAG
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


节点2

[[email protected] ~]$ cat .bash_profile 
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
export PS1
umask 022
alias sqlplus="rlwrap sqlplus"
export TMP=/tmp
export LANG=en_US
export TMPDIR=$TMP
export ORACLE_HOSTNAME=itpux2
ORACLE_SID=+ASM2; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
ORACLE_BASE=/u01/app/grid; export ORACLE_BASE
ORACLE_HOME=/u01/app/11.2.0/grid; export ORACLE_HOME
NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT
PATH=.:$PATH:$HOME/bin:$ORACLE_HOME/bin; export PATH
THREADS_FLAG=native; export THREADS_FLAG
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

[[email protected] ~]$ cat .bash_profile
# .bash_profile


# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap rman"
export PS1
export TMP=/tmp
export LANG=en_US
export TMPDIR=$TMP
export ORACLE_HOSTNAME=itpux2
export ORACLE_UNQNAME=itpuxdb
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME
ORACLE_SID=itpuxdb2; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"; export NLS_DATE_FORMAT
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK;export NLS_LANG
PATH=.:$PATH:$HOME/bin:$ORACLE_BASE/product/11.2.0/db_1/bin:$ORACLE_HOME/bin; export PATH
THREADS_FLAG=native; export THREADS_FLAG
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

配置SSH信任关系

1).在主节点itpux1上以grid,oracle用户身份生成用户的公匙和私匙
# su - oracle (su - grid)
$ mkdir ~/.ssh
$ ssh-****** -t rsa
$ ssh-****** -t dsa

2).在副节点itpux2上执行相同的操作,确保通信无阻
# su - oracle (su - grid)
$ mkdir ~/.ssh
$ ssh-****** -t rsa
$ ssh-****** -t dsa

3).在主节点itpux1上oracle(grid)用户执行以下操作
$ cat ~/.ssh/id_rsa.pub >> ./.ssh/authorized_keys
$ cat ~/.ssh/id_dsa.pub >> ./.ssh/authorized_keys
$ ssh itpux2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
$ ssh itpux2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
$ scp ~/.ssh/authorized_keys itpux2:~/.ssh/authorized_keys

4).主节点itpux1上执行检验操作
$ ssh itpux1 date
$ ssh itpux2 date
$ ssh itpux1prv date
$ ssh itpux2prv date

5).在副节点itpux2上执行检验操作
$ ssh itpux1 date
$ ssh itpux2 date
$ ssh itpux1prv date
$ ssh itpux2prv date

设置asm磁盘

第一个节点:
raw配置
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=="sde1",RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", KERNEL=="sdf1",RUN+="/bin/raw /dev/raw/raw5 %N"
ACTION=="add", KERNEL=="sdg1",RUN+="/bin/raw /dev/raw/raw6 %N"
ACTION=="add",KERNEL=="raw*", OWNER="grid", GROUP="asmadmin", MODE="660"


start_udev
ll /dev/raw
raw -qa
第二个节点:
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=="sde1",RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", KERNEL=="sdf1",RUN+="/bin/raw /dev/raw/raw5 %N"
ACTION=="add", KERNEL=="sdg1",RUN+="/bin/raw /dev/raw/raw6 %N"
ACTION=="add",KERNEL=="raw*", OWNER="grid", GROUP="asmadmin", MODE="660"
partprobe
raw -qa
start_udev
ll /dev/raw