在oracle linux 5.6上安裝oracle 11g RAC

oracle_zsx發表於2013-08-22
1、
vi /etc/hosts
192.168.20.41           rac1
192.168.20.42           rac2
10.0.0.41               rac1-priv
10.0.0.42               rac2-priv
192.168.20.43           rac1-vip
192.168.20.44           rac2-vip
192.168.20.45           rac-scan

2、
私有ip要寫到eth1中      (兩個節點)

3.
install rpms (光碟yum源安裝) (兩個節點都執行)                                         #
A.mount 光碟
[root@rac1 ~]# mkdir -p /mnt/cdrom                                         #
[root@rac1 ~]# mount /dev/cdrom /mnt/cdrom/
mount: block device /dev/cdrom is write-protected, mounting read-only                      #                                       # 
B.配置yum源                                                   #
[root@rac1 yum.repos.d]# cat>>/etc/yum.repos.d/rhel-source.repo< [Server]
baseurl=file:///mnt/cdrom/Server
enabled=1
gpgcheck=0
EOF
4、
編輯指令碼  (兩個節點)
vi pack.sh
#!bin/bash
#start install required packages
echo "start installing requiredpackages"
yum -y install binutils-2.17.50.0.6*
yum -y install compat-libstdc++-33-3.2.3*
yum -y install elfutils-libelf-0.125*  
yum -y install elfutils-libelf-devel-0.125*
yum -y install elfutils-libelf-devel-static-0.125*
yum -y install gcc-4.1.2*
yum -y install gcc-c++-4.1.2*
yum -y install glibc-2.5-24*
yum -y install glibc-common-2.5*
yum -y install glibc-common-2.5*
yum -y install glibc-devel-2.5*
yum -y install glibc-headers-2.5*
yum -y install ksh-20060214*
yum -y install libaio-0.3.106*
yum -y install libaio-devel-0.3.106*
yum -y install libgcc-4.1.2*
yum -y install libgomp-4.1.2*
yum -y install libstdc++-4.1.2*
yum -y install libstdc++-devel-4.1.2*
yum -y install make-3.81*
yum -y install sysstat-7.0.2*
yum -y install unixODBC-2.2.11*
yum -y install unixODBC-devel-2.2.11*
yum -y install pdksh*
5、
安裝rpm包(兩個節點)
[root@rac1 ~]# chmod +x pack.sh
[root@rac1 ~]# sh pack.sh

6、
在解壓的grid包中找到rpm路徑下這個包安裝(兩個節點)
rpm -ihv cvuqdisk-1.0.9-1.rpm  
注意:
grid安裝包只需要傳到節點1上。
找到節點1中的這個包傳到節點2.
 
7、
DISABLE FIREWALL(兩個節點)
#service iptables stop
#chkconfig iptables off
8、
DISABLE SELINUX(兩個節點)
vi /etc/selinux/config
SELinux=disable

9、 Create System Groups and Users(兩個節點)
# /usr/sbin/groupadd -g 1001 oinstall
# /usr/sbin/groupadd -g 1002 dba
# /usr/sbin/groupadd -g 1003 oper
# /usr/sbin/groupadd -g 1021 asmadmin
# /usr/sbin/groupadd -g 1022 asmdba
# /usr/sbin/groupadd -g 1023 asmoper
# /usr/sbin/useradd -g oinstall -G dba,asmadmin,asmdba,asmoper grid
# /usr/sbin/useradd -g oinstall -G dba,oper,asmdba oracle
10、
用root使用者給oracle和grid分配密碼 (兩個節點)
passwd oracle
passwd grid

11、
編輯.bash_profile(兩個節點)
su - grid  
vi .bash_profile
export ORACLE_HOME=/u01/app/11.2.0/grid
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORACLE_SID=+ASM1
export PATH=$PATH:$ORACLE_HOME/bin
echo -ne "\033]0;${USER}@${HOSTNAME%%.*}\007"
export
stty erase ^H

12、
(兩個節點)
su - oracle  
vi .bash_profile
export ORACLE_BASE=/u02/app/oracle
export ORACLE_HOME=$ORACLE_BASE/products/11.2.0
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORACLE_SID=gis1
export PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$ORACLE_BASE/products/crs/bin:.
echo -ne "\033]0;${USER}@${HOSTNAME%%.*}\007"
export
stty erase ^H

13、
#建立目錄     (兩個節點)
#mkdir /u01
#mkdir /u02
#chown -R oracle:oinstall /u02
#chown -R grid:oinstall /u01
#su - grid
#mkdir -p $ORACLE_HOME
#su - oracle
#mkdir -p $ORACLE_BASE
#mkdir -p $ORACLE_HOME
 
14、
(兩個節點)
#vi /etc/profile 新增:   
if [ \$USER = "grid" ]; then
if [ \$SHELL = "/bin/bash" ]; then
   ulimit -p 16384
   ulimit -n 65536
else
   ulimit -u 16384 -n 65536
fi
   umask 022
fi
if [ \$USER = "oracle" ]; then
if [ \$SHELL = "/bin/bash" ]; then
   ulimit -p 16384
   ulimit -n 65536
else
   ulimit -u 16384 -n 65536
fi
   umask 022
fi
 

15、
Checking Resource Limits (兩個節點)
#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
 
16、
Configuring Kernel Parameters(兩個節點)
#vi /etc/sysctl.conf
##add for rac
kernel.shmall = 2097152
kernel.shmmax = 17179869184
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
 
17、
時間同步(兩個節點)
方法二:使用CTSS
################################
叢集時間同步服務:
配置叢集時間同步服務 — (CTSS):
# /sbin/service ntpd stop
# chkconfig ntpd off
# chkconfig --list ntpd
# mv /etc/ntp.conf  /etc/ntp.conf.org
# rm /var/run/ntpd.pid
 
18、
配置/etc/hosts(兩個節點),如果第一步做了,則不做
# vi /etc/hosts
# more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               rac1 localhost.localdomain localhost
::1             localhost6.localdomain6 localhost6
#public
192.168.50.100   rac1
192.168.50.101   rac2
#private
10.0.0.100   rac1-priv
10.0.0.101   rac2-priv
#vip
192.168.50.110   rac1-vip
192.168.50.111   rac2-vip
#scan
192.168.50.150   rac-scan
注意:將private IP要寫到eth1 (兩個節點)
 
19、
配置SSH互通 (兩個節點)
在 rac1、rac2上執行(oracle、grid、root使用者都需要執行)
#su - oracle             --oracle 使用者
ssh-keygen -t rsa
ssh-keygen -t dsa
#su - grid               --grid 使用者
ssh-keygen -t rsa
ssh-keygen -t dsa
#su –                    --root使用者
ssh-keygen -t rsa
ssh-keygen -t dsa

20、
在 rac1 上執行
#su – root
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys
#su - oracle
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys
#su - grid
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
ssh rac2 cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
scp ~/.ssh/authorized_keys rac2:~/.ssh/authorized_keys
 

21、
在每個節點上測試連線  (兩個節點都要確認)
#su -
ssh rac1 date
ssh rac2 date
ssh rac1-priv date
ssh rac2-priv date   
#su - oracle
ssh rac1 date
ssh rac2 date
ssh rac1-priv date
ssh rac2-priv date
#su - grid
ssh rac1 date
ssh rac2 date
ssh rac1-priv date
ssh rac2-priv date
結果如下:
rac1 date
Thu May 16 16:29:51 CST 2013
rac2 date
Thu May 16 16:29:57 CST 2013
rac1-priv date
The authenticity of host 'rac1-priv (10.0.0.41)' can't be established.
RSA key fingerprint is 74:08:14:a8:6d:bb:b0:6f:f9:1f:9c:e6:06:09:9a:6e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'rac1-priv,10.0.0.41' (RSA) to the list of known hosts.
Thu May 16 16:30:03 CST 2013
rac1-priv date
Thu May 16 16:30:04 CST 2013
rac1-priv date
Thu May 16 16:30:05 CST 2013
rac2-priv date
The authenticity of host 'rac2-priv (10.0.0.42)' can't be established.
RSA key fingerprint is 74:08:14:a8:6d:bb:b0:6f:f9:1f:9c:e6:06:09:9a:6e.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'rac2-priv,10.0.0.42' (RSA) to the list of known hosts.
Thu May 16 16:30:12 CST 2013
rac2-priv date
Thu May 16 16:30:14 CST 2013
rac2-priv date
Thu May 16 16:30:14 CST 2013
>
 

22、
配置共享儲存   (這一步是在伺服器中做的,注意在自己對應的目錄裡面做)
# cd /vmfs/volumes/datastore1/SHAREDISK/szsc/VM03009   (這個目錄不一定全部正確,要看伺服器上是不是有)
#vmkfstools -c 2048m -a lsilogic -d eagerzeroedthick  data01_2g.vmdk
#vmkfstools -c 2048m -a lsilogic -d eagerzeroedthick  data02_2g.vmdk
#vmkfstools -c 2048m -a lsilogic -d eagerzeroedthick  data03_2g.vmdk
#vmkfstools -c 512m  -a lsilogic -d eagerzeroedthick  dbfs01_0.5g.vmdk
#vmkfstools -c 1024m -a lsilogic -d eagerzeroedthick  reco01_1g.vmdk
 
23、
共享磁碟上建立完成之後,去虛擬機器設定裡面,將這五塊磁碟新增上來  
(兩個虛擬機器都要做,注意是自己的目錄中,不要用別人的)
 
24、
進入伺服器中對應的自己的虛擬機器上做   (不要改別人的,要注意)
#cd /vmfs/volumes/datastore1/VM03001
#vi VM03001.vmx
#cd /vmfs/volumes/datastore1/VM03002
#vi VM03002.vmx
修改虛擬機器配置檔案,增加如下內容:
disk.UUIDEnable="TRUE"
disk.locking = "FALSE"
diskLib.dataCacheMaxSize = "0"
scsi1.sharedBus = "virtual"
#scsi1.sharedBus = "none"  註釋掉改行,使用上面的值
 

25.
磁碟檢查   (兩個節點)
[root@rac1 ~]# ls -l /dev/sd*
brw-r----- 1 root disk 8,  0 Jan  7 13:39 /dev/sda
brw-r----- 1 root disk 8,  1 Jan  7 13:39 /dev/sda1
brw-r----- 1 root disk 8,  2 Jan  7 13:39 /dev/sda2
brw-r----- 1 root disk 8,  2 Jan  7 13:39 /dev/sda3
brw-r----- 1 root disk 8,  2 Jan  7 13:39 /dev/sda4
brw-r----- 1 root disk 8,  2 Jan  7 13:39 /dev/sda5
brw-r----- 1 root disk 8, 16 Jan  7 13:39 /dev/sdb
brw-r----- 1 root disk 8, 32 Jan  7 13:39 /dev/sdc
brw-r----- 1 root disk 8, 48 Jan  7 13:39 /dev/sdd
brw-r----- 1 root disk 8, 64 Jan  7 13:39 /dev/sde
brw-r----- 1 root disk 8, 80 Jan  7 13:39 /dev/sdf
[root@rac2 ~]# ls -l /dev/sd*
brw-r----- 1 root disk 8,  0 Jan  7 13:39 /dev/sda
brw-r----- 1 root disk 8,  1 Jan  7 13:39 /dev/sda1
brw-r----- 1 root disk 8,  2 Jan  7 13:39 /dev/sda2
brw-r----- 1 root disk 8,  2 Jan  7 13:39 /dev/sda3
brw-r----- 1 root disk 8,  2 Jan  7 13:39 /dev/sda4
brw-r----- 1 root disk 8,  2 Jan  7 13:39 /dev/sda5
brw-r----- 1 root disk 8, 16 Jan  7 13:39 /dev/sdb
brw-r----- 1 root disk 8, 32 Jan  7 13:39 /dev/sdc
brw-r----- 1 root disk 8, 48 Jan  7 13:39 /dev/sdd
brw-r----- 1 root disk 8, 64 Jan  7 13:39 /dev/sde
brw-r----- 1 root disk 8, 80 Jan  7 13:39 /dev/sdf
 
26、
配置UDEV
檢查UDEV包
UDEV Mapping SCSI:
[root@rac1 ~]# rpm -qa|grep udev
udev-095-14.24.el5
[root@rac2 ~]# rpm -qa|grep udev
udev-095-14.24.el5
 
27、
首先確認是 Linux 5.0及以上版本
[root@rac1 ~]# cat /etc/issue
Oracle Linux Server release 5.6
[root@rac2 ~]# cat /etc/issue
Oracle Linux Server release 5.6
2.4.3.新增記錄到/etc/scsi_id.config
#vi /etc/scsi_id.config
options=-g
注:把options=-b註釋掉,加入options=-g,該選項保證所有連線的SCSI裝置返回一個UUID.如果該檔案不存在,可以手動建立一個.

28、
配置裸裝置      (兩個節點)
[root@rac1 ~]# /bin/raw /dev/raw/raw1 /dev/sdb
/dev/raw/raw1:  bound to major 8, minor 16
[root@rac1 ~]#  /bin/raw /dev/raw/raw2 /dev/sdc
/dev/raw/raw2:  bound to major 8, minor 32
[root@rac1 ~]# /bin/raw /dev/raw/raw3 /dev/sdd
/dev/raw/raw3:  bound to major 8, minor 48
[root@rac1 ~]# /bin/raw /dev/raw/raw4 /dev/sde
/dev/raw/raw4:  bound to major 8, minor 64
[root@rac1 ~]# /bin/raw /dev/raw/raw5 /dev/sdf
Last login: Thu May 16 15:07:11 2013 from 192.168.20.54
[root@rac1 ~]#
[root@rac1 ~]#
[root@rac1 ~]# /bin/raw /dev/raw/raw5 /dev/sdf
/dev/raw/raw5:  bound to major 8, minor 80
[root@rac1 ~]# raw -qa
/dev/raw/raw1:  bound to major 8, minor 16
/dev/raw/raw2:  bound to major 8, minor 32
/dev/raw/raw3:  bound to major 8, minor 48
/dev/raw/raw4:  bound to major 8, minor 64
/dev/raw/raw5:  bound to major 8, minor 80

29、
修改/etc/udev/rules.d/60-raw.rules檔案  (兩個節點)
vi /etc/udev/rules.d/60-raw.rules
ACTION=="add",KERNEL=="/dev/sdb",  RUN+="/bin/raw /dev/raw/raw1 %N",OWNER="grid", GROUP="oinstall", MODE="775"
ACTION=="add",KERNEL=="/dev/sdc",  RUN+="/bin/raw /dev/raw/raw2 %N",OWNER="grid", GROUP="oinstall", MODE="775"
ACTION=="add",KERNEL=="/dev/sdd",  RUN+="/bin/raw /dev/raw/raw3 %N",OWNER="grid", GROUP="oinstall", MODE="775"
ACTION=="add",KERNEL=="/dev/sde",  RUN+="/bin/raw /dev/raw/raw4 %N",OWNER="grid", GROUP="oinstall", MODE="775"
ACTION=="add",KERNEL=="/dev/sdf",  RUN+="/bin/raw /dev/raw/raw5 %N",OWNER="grid", GROUP="oinstall", MODE="775"
KERNEL=="raw*", WNER="grid", GROUP="oinstall", MODE="775"
chown grid:oinstall /dev/raw/raw*

30、
RAW盤的繫結(兩個節點)
# vi /etc/sysconfig/rawdevices
/dev/raw/raw1 /dev/sdb
/dev/raw/raw2 /dev/sdc
/dev/raw/raw3 /dev/sdd
/dev/raw/raw4 /dev/sde
/dev/raw/raw5 /dev/sdf
 
31、
RAW盤授權(兩個節點)
# vi /etc/rc.local
#ADD
/bin/raw /dev/raw/raw1 /dev/sdb
/bin/raw /dev/raw/raw2 /dev/sdc
/bin/raw /dev/raw/raw3 /dev/sdd
/bin/raw /dev/raw/raw4 /dev/sde
/bin/raw /dev/raw/raw5 /dev/sdf
chown grid:oinstall /dev/raw/raw*    //開機自動授權
chmod 775 /dev/raw/raw*
 
32
在安裝grid之前檢查共享磁碟
stage -post hwos -n rac1,rac2  -verbose
stage -pre crsinst -n rac1,rac2 -fixup -verbose
遇到DNS錯誤的時候可以忽略
 
33、
成功透過後,開始裝grid
 
34
配置ASM(圖形化介面,省略)
# su  - grid
#asmca
 
35
安裝資料庫軟體
 

36
用dbca建立資料庫。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29107230/viewspace-769030/,如需轉載,請註明出處,否則將追究法律責任。

相關文章