1. 程式人生 > >oracle11g rac安裝部署

oracle11g rac安裝部署

1、虛擬機器配置

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 SETTINGgrid soft nproc 2047 grid hard nproc 16384grid soft nofile 1024grid hard nofile 65536grid soft stack 10240grid hard stack 32768oracle soft nproc 2047oracle hard nproc 16384oracle soft nofile 1024oracle hard nofile 65536oracle soft stack 10240

oracle hard stack 32768

11、vi /etc/security/limits.d/90-nproc.conf#* soft nproc 1024* - nproc 16384root 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 SETTINGsession required pam_limits.so

15、

vi /etc/sysctl.conf#ORACLE SETTINGfs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmmax = 1147483648kernel.shmall = 524288kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.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-keygen -t rsa$ ssh-keygen -t dsa2).在副節點itpux2上執行相同的操作,確保通訊無阻# su - oracle (su - grid)$ mkdir ~/.ssh$ ssh-keygen -t rsa$ ssh-keygen -t dsa3).在主節點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_keys4).主節點itpux1上執行檢驗操作$ ssh itpux1 date$ ssh itpux2 date$ ssh itpux1prv date$ ssh itpux2prv date5).在副節點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