安裝oracle 11gR2 RAC
一、網路規劃及安裝虛擬主機
主機名 |
主機版本 |
Ip |
rac1.localdomain |
Redhat 6.5 RAC節點1 |
192.168.100.11 |
rac2.localdomain |
Redhat 6.5 RAC節點2 |
192.168.100.12 |
Loaclhost.localdomain |
Redhat 5.8 DNS伺服器 |
192.168.100.9 |
Short hostname |
type |
Ip address |
interface |
rac1 |
Public ip |
192.168.100.11 |
Eth0 |
rac1-vip |
Virtul ip |
192.168.100.13 |
Eth0:1 |
rac1-priv |
Private ip |
192.168.10.11 |
Eth1 |
rac2 |
Public ip |
192.168.100.12 |
Eth0 |
rac2-vip |
Virtul ip |
192.168.100.14 |
Eth0:1 |
rac2-priv |
Private ip |
192.168.10.12 |
Eth1 |
Scancluster |
Scan ip |
192.168.100.10 |
Eth0 |
二、RAC 安裝前期配置
1、配置/etc/host檔案(rac1、rac2上執行)
127.0.0.1 localhost
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#rac1
192.168.100.11 rac1
192.168.100.13 rac1-vip
192.168.10.11 rac1-priv
#rac2
192.168.100.12 rac2
192.168.100.14 rac2-vip
192.168.10.12 rac2-priv
#scan-ip
192.168.100.10 scan-cluster
2、配置DNS伺服器,解析scan ip(rhel5.8上執行)
1)安裝dns包
[root@localhost mnt]# ll
total 1112
-rw-r--r-- 1 root root 1012559 Jan 22 11:11 bind-9.3.6-20.P1.el5.x86_64.rpm
-rw-r--r-- 1 root root 47941 Jan 22 11:14 bind-chroot-9.3.6-20.P1.el5.x86_64.rpm
-rw-r--r-- 1 root root 64667 Jan 22 11:11 caching-nameserver-9.3.6-20.P1.el5.x86_64.rpm
[root@localhost mnt]# rpm -ivh bind-9.3.6-20.P1.el5.x86_64.rpm
[root@localhost mnt]# rpm -ivh bind-chroot-9.3.6-20.P1.el5.x86_64.rpm
[root@localhost mnt]# rpm -ivh caching-nameserver-9.3.6-20.P1.el5.x86_64.rpm
2)配置named.conf檔案
生成named.conf檔案:
[root@localhost mnt]# cd /var/named/chroot/etc/
[root@localhost etc]# ll
total 24
-rw-r--r-- 1 root root 3519 Feb 27 2006 localtime
-rw-r----- 1 root named 1230 Dec 2 2011 named.caching-nameserver.conf
-rw-r----- 1 root named 955 Dec 2 2011 named.rfc1912.zones
-rw-r----- 1 root named 113 Jan 22 10:51 rndc.key
[root@localhost etc]# cp -p named.caching-nameserver.conf named.conf
[root@localhost etc]# ll
total 28
-rw-r--r-- 1 root root 3519 Feb 27 2006 localtime
-rw-r----- 1 root named 1230 Dec 2 2011 named.caching-nameserver.conf
-rw-r----- 1 root named 1230 Dec 2 2011 named.conf
-rw-r----- 1 root named 955 Dec 2 2011 named.rfc1912.zones
-rw-r----- 1 root named 113 Jan 22 10:51 rndc.key
配置named.conf檔案:
[root@localhost etc]# vim named.conf
將127.0.0.1和localhost全部改成any。
3)配置named.rfc1912.zones檔案
[root@localhost etc]# vim named.rfc1912.zones --在最後新增下面內容
zone "100.168.192.in-addr.arpa" IN {
type master;
file "100.168.192.in-addr.arpa";
allow-update { none; };
};
4)生成正反向解析資料庫檔案
[root@localhost named]# pwd
/var/named/chroot/var/named
[root@localhost named]# ll
total 44
drwxrwx--- 2 named named 4096 Aug 26 2004 data
-rw-r----- 1 root named 198 Dec 2 2011 localdomain.zone
-rw-r----- 1 root named 195 Dec 2 2011 localhost.zone
-rw-r----- 1 root named 427 Dec 2 2011 named.broadcast
-rw-r----- 1 root named 1892 Dec 2 2011 named.ca
-rw-r----- 1 root named 424 Dec 2 2011 named.ip6.local
-rw-r----- 1 root named 426 Dec 2 2011 named.local
-rw-r----- 1 root named 427 Dec 2 2011 named.zero
drwxrwx--- 2 named named 4096 Jul 27 2004 slaves
[root@localhost named]# cp -p named.local 100.168.192.in-addr.arpa
[root@localhost named]# ll
total 48
-rw-r----- 1 root named 426 Dec 2 2011 100.168.192.in-addr.arpa
drwxrwx--- 2 named named 4096 Aug 26 2004 data
-rw-r----- 1 root named 198 Dec 2 2011 localdomain.zone
-rw-r----- 1 root named 195 Dec 2 2011 localhost.zone
-rw-r----- 1 root named 427 Dec 2 2011 named.broadcast
-rw-r----- 1 root named 1892 Dec 2 2011 named.ca
-rw-r----- 1 root named 424 Dec 2 2011 named.ip6.local
-rw-r----- 1 root named 426 Dec 2 2011 named.local
-rw-r----- 1 root named 427 Dec 2 2011 named.zero
drwxrwx--- 2 named named 4096 Jul 27 2004 slaves
5)配置正向解析數劇庫檔案
[root@localhost named]# vim localdomain.zone
[root@localhost named]# cat localdomain.zone
$TTL 86400
@ IN SOA localhost root (
42 ; serial (d. adams)
3H ; refresh
15M ; retry
1W ; expiry
1D ) ; minimum
IN NS localhost
localhost IN A 127.0.0.1
scan-cluster IN A 192.168.100.10
6)配置反向解析資料庫檔案
[root@localhost named]# vim 100.168.192.in-addr.arpa
[root@localhost named]# cat 100.168.192.in-addr.arpa
$TTL 86400
@ IN SOA localhost. root.localhost. (
1997022700 ; Serial
28800 ; Refresh
14400 ; Retry
3600000 ; Expire
86400 ) ; Minimum
IN NS localhost.
1 IN PTR localhost.
10 IN PTR scan-cluster.localdomain
7)伺服器上啟動DNS伺服器
[root@localhost named]# /etc/init.d/named status
rndc: connect failed: 127.0.0.1#953: connection refused
named is stopped
[root@localhost named]# /etc/init.d/named start
Starting named: [ OK ]
8)配置/etc/resolv.conf檔案(rac1、rac2上執行)
[root@rac1 ~]# vim /etc/resolv.conf
[root@rac1 ~]# cat /etc/resolv.conf
# Generated by NetworkManager
search localdomain
# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
nameserver 192.168.100.9
9)nslookup檢查(rac1、rac2上檢驗)
[root@rac1 ~]# nslookup 192.168.100.10
Server: 192.168.100.9
Address: 192.168.100.9#53
10.100.168.192.in-addr.arpa name = scan-cluster.localdomain
[root@rac1 ~]# nslookup scan-cluster
Server: 192.168.100.9
Address: 192.168.100.9#53
Name: scan-cluster.localdomain
Address: 192.168.100.10
3、建組、使用者、環境變數、核心引數等(rac1、rac2上執行)
節點1執行以下指令碼:
#!/bin/bash
#Usage:Log on as the superuser('root'),and then execute the command:#./1preusers.sh
groupadd -g 1000 oinstall
groupadd -g 1200 asmadmin
groupadd -g 1201 asmdba
groupadd -g 1202 asmoper
groupadd -g 1300 dba
groupadd -g 1301 oper
useradd -u 1100 -g oinstall -G asmadmin,asmdba,asmoper,dba -d /home/grid -s /bin/bash -c "grid Infrastructure Owner" grid
echo "grid" | passwd --stdin grid
echo "export TMP=/tmp">> /home/grid/.bash_profile
echo 'export TMPDIR=$TMP'>>/home/grid/.bash_profile
echo "export ORACLE_SID=+ASM1">> /home/grid/.bash_profile
echo "export ORACLE_BASE=/u01/app/grid">> /home/grid/.bash_profile
echo "export ORACLE_HOME=/u01/app/11.2.0/grid">> /home/grid/.bash_profile
echo "export ORACLE_TERM=xterm">> /home/grid/.bash_profile
echo "export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'" >> /home/grid/.bash_profile
echo 'export TNS_ADMIN=$ORACLE_HOME/network/admin' >> /home/grid/.bash_profile
echo 'export PATH=/usr/sbin:$PATH'>> /home/grid/.bash_profile
echo 'export PATH=$ORACLE_HOME/bin:$PATH'>> /home/grid/.bash_profile
echo 'export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib'>> /home/grid/.bash_profile
echo 'export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib'>> /home/grid/.bash_profile
echo "export LANG=en_US" >> /home/grid/.bash_profile
echo "export NLS_LANG=american_america.AL32UTF8" >> /home/grid/.bash_profile
useradd -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle
echo "oracle" | passwd --stdin oracle
echo "export TMP=/tmp">> /home/oracle/.bash_profile
echo 'export TMPDIR=$TMP'>>/home/oracle/.bash_profile
echo "export ORACLE_HOSTNAME=rac1.localdomain">> /home/oracle/.bash_profile
echo "export ORACLE_SID=devdb1">> /home/oracle/.bash_profile
echo "export ORACLE_BASE=/u01/app/oracle">> /home/oracle/.bash_profile
echo 'export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1'>> /home/oracle/.bash_profile
echo "export ORACLE_UNQNAME=devdb">> /home/oracle/.bash_profile
echo 'export TNS_ADMIN=$ORACLE_HOME/network/admin' >> /home/oracle/.bash_profile
echo "export ORACLE_TERM=xterm">> /home/oracle/.bash_profile
echo 'export PATH=/usr/sbin:$PATH'>> /home/oracle/.bash_profile
echo 'export PATH=$ORACLE_HOME/bin:$PATH'>> /home/oracle/.bash_profile
echo 'export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib'>> /home/oracle/.bash_profile
echo 'export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib'>> /home/oracle/.bash_profile
echo "export LANG=en_US" >> /home/oracle/.bash_profile
echo "export NLS_LANG=american_america.AL32UTF8" >> /home/oracle/.bash_profile
echo "export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'" >> /home/oracle/.bash_profile
echo "The Groups and users has been created"
echo "The Environment for grid,oracle also has been set successfully"
mkdir -p /u01/app/grid
mkdir -p /u01/app/11.2.0/grid
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01
chown -R grid:oinstall /u01/app/grid
chown -R grid:oinstall /u01/app/11.2.0
chmod -R 775 /u01
cp /etc/security/limits.conf /etc/security/limits.conf.bak
echo "oracle soft nproc 2047" >>/etc/security/limits.conf
echo "oracle hard nproc 16384" >>/etc/security/limits.conf
echo "oracle soft nofile 1024" >>/etc/security/limits.conf
echo "oracle hard nofile 65536" >>/etc/security/limits.conf
echo "grid soft nproc 2047" >>/etc/security/limits.conf
echo "grid hard nproc 16384" >>/etc/security/limits.conf
echo "grid soft nofile 1024" >>/etc/security/limits.conf
echo "grid hard nofile 65536" >>/etc/security/limits.conf
cp /etc/pam.d/login /etc/pam.d/login.bak
echo "session required /lib/security/pam_limits.so" >>/etc/pam.d/login
echo "session required pam_limits.so" >>/etc/pam.d/login
cp /etc/profile /etc/profile.bak
echo 'if [ $USER = "oracle" ]||[ $USER = "grid" ]; then' >> /etc/profile
echo 'if [ $SHELL = "/bin/ksh" ]; then' >> /etc/profile
echo 'ulimit -p 16384' >> /etc/profile
echo 'ulimit -n 65536' >> /etc/profile
echo 'else' >> /etc/profile
echo 'ulimit -u 16384 -n 65536' >> /etc/profile
echo 'fi' >> /etc/profile
echo 'fi' >> /etc/profile
cp /etc/sysctl.conf /etc/sysctl.conf.bak
echo "fs.aio-max-nr = 1048576" >> /etc/sysctl.conf
echo "fs.file-max = 6815744" >> /etc/sysctl.conf
echo "kernel.shmall = 2097152" >> /etc/sysctl.conf
echo "kernel.shmmax = 4294967295" >> /etc/sysctl.conf
echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.conf
echo "net.core.rmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304" >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048586" >> /etc/sysctl.conf
echo "net.ipv4.tcp_wmem = 262144 262144 262144" >> /etc/sysctl.conf
echo "net.ipv4.tcp_rmem = 4194304 4194304 4194304" >> /etc/sysctl.conf
sysctl -p
節點2執行以下指令碼:
#!/bin/bash
#Usage:Log on as the superuser('root'),and then execute the command:#./1preusers.sh
groupadd -g 1000 oinstall
groupadd -g 1200 asmadmin
groupadd -g 1201 asmdba
groupadd -g 1202 asmoper
groupadd -g 1300 dba
groupadd -g 1301 oper
useradd -u 1100 -g oinstall -G asmadmin,asmdba,asmoper,dba -d /home/grid -s /bin/bash -c "grid Infrastructure Owner" grid
echo "grid" | passwd --stdin grid
echo "export TMP=/tmp">> /home/grid/.bash_profile
echo 'export TMPDIR=$TMP'>>/home/grid/.bash_profile
echo "export ORACLE_SID=+ASM2">> /home/grid/.bash_profile
echo "export ORACLE_BASE=/u01/app/grid">> /home/grid/.bash_profile
echo "export ORACLE_HOME=/u01/app/11.2.0/grid">> /home/grid/.bash_profile
echo "export ORACLE_TERM=xterm">> /home/grid/.bash_profile
echo "export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'" >> /home/grid/.bash_profile
echo 'export TNS_ADMIN=$ORACLE_HOME/network/admin' >> /home/grid/.bash_profile
echo 'export PATH=/usr/sbin:$PATH'>> /home/grid/.bash_profile
echo 'export PATH=$ORACLE_HOME/bin:$PATH'>> /home/grid/.bash_profile
echo 'export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib'>> /home/grid/.bash_profile
echo 'export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib'>> /home/grid/.bash_profile
echo "export LANG=en_US" >> /home/grid/.bash_profile
echo "export NLS_LANG=american_america.AL32UTF8" >> /home/grid/.bash_profile
useradd -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash -c "Oracle Software Owner" oracle
echo "oracle" | passwd --stdin oracle
echo "export TMP=/tmp">> /home/oracle/.bash_profile
echo 'export TMPDIR=$TMP'>>/home/oracle/.bash_profile
echo "export ORACLE_HOSTNAME=rac2.localdomain">> /home/oracle/.bash_profile
echo "export ORACLE_SID=devdb2">> /home/oracle/.bash_profile
echo "export ORACLE_BASE=/u01/app/oracle">> /home/oracle/.bash_profile
echo 'export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1'>> /home/oracle/.bash_profile
echo "export ORACLE_UNQNAME=devdb">> /home/oracle/.bash_profile
echo 'export TNS_ADMIN=$ORACLE_HOME/network/admin' >> /home/oracle/.bash_profile
echo "export ORACLE_TERM=xterm">> /home/oracle/.bash_profile
echo 'export PATH=/usr/sbin:$PATH'>> /home/oracle/.bash_profile
echo 'export PATH=$ORACLE_HOME/bin:$PATH'>> /home/oracle/.bash_profile
echo 'export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib'>> /home/oracle/.bash_profile
echo 'export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib'>> /home/oracle/.bash_profile
echo "export LANG=en_US" >> /home/oracle/.bash_profile
echo "export NLS_LANG=american_america.AL32UTF8" >> /home/oracle/.bash_profile
echo "export NLS_DATE_FORMAT='yyyy/mm/dd hh24:mi:ss'" >> /home/oracle/.bash_profile
echo "The Groups and users has been created"
echo "The Environment for grid,oracle also has been set successfully"
mkdir -p /u01/app/grid
mkdir -p /u01/app/11.2.0/grid
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01
chown -R grid:oinstall /u01/app/grid
chown -R grid:oinstall /u01/app/11.2.0
chmod -R 775 /u01
cp /etc/security/limits.conf /etc/security/limits.conf.bak
echo "oracle soft nproc 2047" >>/etc/security/limits.conf
echo "oracle hard nproc 16384" >>/etc/security/limits.conf
echo "oracle soft nofile 1024" >>/etc/security/limits.conf
echo "oracle hard nofile 65536" >>/etc/security/limits.conf
echo "grid soft nproc 2047" >>/etc/security/limits.conf
echo "grid hard nproc 16384" >>/etc/security/limits.conf
echo "grid soft nofile 1024" >>/etc/security/limits.conf
echo "grid hard nofile 65536" >>/etc/security/limits.conf
cp /etc/pam.d/login /etc/pam.d/login.bak
echo "session required /lib/security/pam_limits.so" >>/etc/pam.d/login
echo "session required pam_limits.so" >>/etc/pam.d/login
cp /etc/profile /etc/profile.bak
echo 'if [ $USER = "oracle" ]||[ $USER = "grid" ]; then' >> /etc/profile
echo 'if [ $SHELL = "/bin/ksh" ]; then' >> /etc/profile
echo 'ulimit -p 16384' >> /etc/profile
echo 'ulimit -n 65536' >> /etc/profile
echo 'else' >> /etc/profile
echo 'ulimit -u 16384 -n 65536' >> /etc/profile
echo 'fi' >> /etc/profile
echo 'fi' >> /etc/profile
cp /etc/sysctl.conf /etc/sysctl.conf.bak
echo "fs.aio-max-nr = 1048576" >> /etc/sysctl.conf
echo "fs.file-max = 6815744" >> /etc/sysctl.conf
echo "kernel.shmall = 2097152" >> /etc/sysctl.conf
echo "kernel.shmmax = 4294967295" >> /etc/sysctl.conf
echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.conf
echo "net.core.rmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304" >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048586" >> /etc/sysctl.conf
echo "net.ipv4.tcp_wmem = 262144 262144 262144" >> /etc/sysctl.conf
echo "net.ipv4.tcp_rmem = 4194304 4194304 4194304" >> /etc/sysctl.conf
sysctl -p
4、停止NTP服務(rac1、rac2上執行)
[root@rac2 mnt]# service ntpd status
ntpd is stopped
[root@rac2 mnt]# chkconfig ntpd off
[root@rac2 mnt]# cp /etc/ntp.conf /etc/ntp.conf.bak
[root@rac2 mnt]# rm /etc/ntp.conf -rf
5、配置grid使用者和oracle使用者ssh對等性
[root@rac1 mnt]# su - grid
[grid@rac1 ~]$ pwd
/home/grid
[grid@rac1 ~]$ ls -al
total 44
drwx------. 4 grid oinstall 4096 Jan 22 12:55 .
drwxr-xr-x. 5 root root 4096 Jan 22 12:48 ..
-rw-------. 1 grid oinstall 19 Jan 22 12:55 .bash_history
-rw-r--r--. 1 grid oinstall 18 Jul 9 2013 .bash_logout
-rw-r--r--. 1 grid oinstall 677 Jan 22 12:48 .bash_profile
-rw-r--r--. 1 grid oinstall 124 Jul 9 2013 .bashrc
drwxr-xr-x. 2 grid oinstall 4096 Jul 14 2010 .gnome2
-rw-r--r--. 1 grid oinstall 171 Oct 16 2013 .kshrc
-rw-r--r--. 1 grid oinstall 124 Oct 24 2013 .mkshrc
drwxr-xr-x. 4 grid oinstall 4096 Jan 21 16:47 .mozilla
-rw-r--r--. 1 grid oinstall 658 Aug 6 2013 .zshrc
[grid@rac1 ~]$ mkdir .ssh
[grid@rac1 ~]$ ls -al
total 48
drwx------. 5 grid oinstall 4096 Jan 22 13:11 .
drwxr-xr-x. 5 root root 4096 Jan 22 12:48 ..
-rw-------. 1 grid oinstall 19 Jan 22 12:55 .bash_history
-rw-r--r--. 1 grid oinstall 18 Jul 9 2013 .bash_logout
-rw-r--r--. 1 grid oinstall 677 Jan 22 12:48 .bash_profile
-rw-r--r--. 1 grid oinstall 124 Jul 9 2013 .bashrc
drwxr-xr-x. 2 grid oinstall 4096 Jul 14 2010 .gnome2
-rw-r--r--. 1 grid oinstall 171 Oct 16 2013 .kshrc
-rw-r--r--. 1 grid oinstall 124 Oct 24 2013 .mkshrc
drwxr-xr-x. 4 grid oinstall 4096 Jan 21 16:47 .mozilla
drwxr-xr-x. 2 grid oinstall 4096 Jan 22 13:11 .ssh
-rw-r--r--. 1 grid oinstall 658 Aug 6 2013 .zshrc
[grid@rac1 ~]$ chmod 700 .ssh
[grid@rac1 ~]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/grid/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/grid/.ssh/id_rsa.
Your public key has been saved in /home/grid/.ssh/id_rsa.pub.
The key fingerprint is:
b8:28:a2:8a:cd:09:4e:54:e0:ba:9a:15:94:22:c0:4b grid@rac1.localdomain
The key's randomart image is:
+--[ RSA 2048]----+
|o. |
|oE.. |
|+.+. |
|o+. . |
|... . S |
|.. . . . |
|+.o . . |
|*B o |
|B.+ |
+-----------------+
[grid@rac1 ~]$ cd .ssh
[grid@rac1 .ssh]$ ls -al
total 16
drwx------. 2 grid oinstall 4096 Jan 22 13:13 .
drwx------. 5 grid oinstall 4096 Jan 22 13:11 ..
-rw-------. 1 grid oinstall 1675 Jan 22 13:13 id_rsa
-rw-r--r--. 1 grid oinstall 404 Jan 22 13:13 id_rsa.pub
[grid@rac1 .ssh]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/grid/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/grid/.ssh/id_dsa.
Your public key has been saved in /home/grid/.ssh/id_dsa.pub.
The key fingerprint is:
83:35:09:9a:b2:f5:41:ec:44:d1:d8:9b:ba:a6:6e:8f grid@rac1.localdomain
The key's randomart image is:
+--[ DSA 1024]----+
| o== |
| ++.o. |
| . +o. +o |
| + ..+o. |
| . o.S |
| . . |
| . |
| ..o |
| oE+. |
+-----------------+
[grid@rac1 .ssh]$ ls -al
total 24
drwx------. 2 grid oinstall 4096 Jan 22 13:14 .
drwx------. 5 grid oinstall 4096 Jan 22 13:11 ..
-rw-------. 1 grid oinstall 668 Jan 22 13:14 id_dsa
-rw-r--r--. 1 grid oinstall 612 Jan 22 13:14 id_dsa.pub
-rw-------. 1 grid oinstall 1675 Jan 22 13:13 id_rsa
-rw-r--r--. 1 grid oinstall 404 Jan 22 13:13 id_rsa.pub
生成authorized_keys檔案
[grid@rac1 ~]$ cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[grid@rac1 ~]$ cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
[grid@rac1 .ssh]$ ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[grid@rac1 .ssh]$ ssh rac2 cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
[grid@rac1 .ssh]$ scp authorized_keys rac2:~/.ssh/authorized_keys
驗證ssh對等性:
[grid@rac1 .ssh]$ ssh rac1 date
Fri Jan 22 13:38:04 CST 2016
[grid@rac1 .ssh]$ ssh rac2 date
Fri Jan 22 13:38:09 CST 2016
[grid@rac1 .ssh]$ ssh rac1-priv date
Fri Jan 22 13:38:15 CST 2016
[grid@rac1 .ssh]$ ssh rac2-priv date
Fri Jan 22 13:38:20 CST 2016
6、配置共享磁碟
1)建立6塊共享磁碟並fdisk格式化。
2)安裝asm rpm包:
[root@rac2 ~]# cd /mnt
[root@rac2 mnt]# ll
total 136
-rw-r--r--. 1 root root 33956 Jan 22 17:23 kmod-oracleasm-2.0.6.rh1-3.el6.x86_64.rpm
-rw-r--r--. 1 root root 13300 Jan 22 17:23 oracleasmlib-2.0.4-1.el6.x86_64.rpm
-rw-r--r--. 1 root root 74984 Jan 22 17:23 oracleasm-support-2.1.8-1.el6.x86_64.rpm
[root@rac2 mnt]# rpm -qa|grep oracleasm
[root@rac2 mnt]# rpm -ivh kmod-oracleasm-2.0.6.rh1-3.el6.x86_64.rpm
Preparing... ########################################### [100%]
1:kmod-oracleasm ########################################### [100%]
[root@rac2 mnt]# rpm -ivh oracleasm-support-2.1.8-1.el6.x86_64.rpm
warning: oracleasm-support-2.1.8-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing... ########################################### [100%]
1:oracleasm-support ########################################### [100%]
[root@rac2 mnt]# rpm -ivh oracleasmlib-2.0.4-1.el6.x86_64.rpm
warning: oracleasmlib-2.0.4-1.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Preparing... ########################################### [100%]
1:oracleasmlib ########################################### [100%]
[root@rac2 mnt]# rpm -qa|grep oracleasm
oracleasm-support-2.1.8-1.el6.x86_64
kmod-oracleasm-2.0.6.rh1-3.el6.x86_64
oracleasmlib-2.0.4-1.el6.x86_64
3)雙節點配置asm driver服務
[root@rac1 mnt]# /usr/sbin/oracleasm -h
Usage: oracleasm [--exec-path=<exec_path>] <command> [ <args> ]
oracleasm --exec-path
oracleasm -h
oracleasm -V
The basic oracleasm commands are:
configure Configure the Oracle Linux ASMLib driver
init Load and initialize the ASMLib driver
exit Stop the ASMLib driver
scandisks Scan the system for Oracle ASMLib disks
status Display the status of the Oracle ASMLib driver
listdisks List known Oracle ASMLib disks
querydisk Determine if a disk belongs to Oracle ASMlib
createdisk Allocate a device for Oracle ASMLib use
deletedisk Return a device to the operating system
renamedisk Change the label of an Oracle ASMlib disk
update-driver Download the latest ASMLib driver
[root@rac1 mnt]# /usr/sbin/oracleasm status
Checking if ASM is loaded: no
Checking if /dev/oracleasm is mounted: no
[root@rac1 mnt]# /usr/sbin/oracleasm configure -i
Configuring the Oracle ASM library driver.
This will configure the on-boot properties of the Oracle ASM library
driver. The following questions will determine whether the driver is
loaded on boot and what permissions it will have. The current values
will be shown in brackets ('[]'). Hitting <ENTER> without typing an
answer will keep that current value. Ctrl-C will abort.
Default user to own the driver interface []: grid
Default group to own the driver interface []: asmadmin
Start Oracle ASM library driver on boot (y/n) [n]: y
Scan for Oracle ASM disks on boot (y/n) [y]: y
Writing Oracle ASM library driver configuration: done
[root@rac1 mnt]# /usr/sbin/oracleasm status
Checking if ASM is loaded: no
Checking if /dev/oracleasm is mounted: no
[root@rac1 mnt]# /usr/sbin/oracleasm init
Creating /dev/oracleasm mount point: /dev/oracleasm
Loading module "oracleasm": oracleasm
Mounting ASMlib driver filesystem: /dev/oracleasm
[root@rac1 mnt]# /usr/sbin/oracleasm status
Checking if ASM is loaded: yes
Checking if /dev/oracleasm is mounted: yes
4)配置asm磁碟
節點1:
[root@rac1 mnt]# /usr/sbin/oracleasm -h
Usage: oracleasm [--exec-path=<exec_path>] <command> [ <args> ]
oracleasm --exec-path
oracleasm -h
oracleasm -V
The basic oracleasm commands are:
configure Configure the Oracle Linux ASMLib driver
init Load and initialize the ASMLib driver
exit Stop the ASMLib driver
scandisks Scan the system for Oracle ASMLib disks
status Display the status of the Oracle ASMLib driver
listdisks List known Oracle ASMLib disks
querydisk Determine if a disk belongs to Oracle ASMlib
createdisk Allocate a device for Oracle ASMLib use
deletedisk Return a device to the operating system
renamedisk Change the label of an Oracle ASMlib disk
update-driver Download the latest ASMLib driver
[root@rac1 mnt]# /usr/sbin/oracleasm listdisks
[root@rac1 mnt]# /usr/sbin/oracleasm createdisk VOL1 /dev/sdb1
Writing disk header: done
Instantiating disk: done
[root@rac1 mnt]# /usr/sbin/oracleasm createdisk VOL2 /dev/sdc1
Writing disk header: done
Instantiating disk: done
[root@rac1 mnt]# /usr/sbin/oracleasm createdisk VOL3 /dev/sdd1
Writing disk header: done
Instantiating disk: done
[root@rac1 mnt]# /usr/sbin/oracleasm createdisk VOL4 /dev/sde1
Writing disk header: done
Instantiating disk: done
[root@rac1 mnt]# /usr/sbin/oracleasm createdisk VOL5 /dev/sdf1
Writing disk header: done
Instantiating disk: done
[root@rac1 mnt]# /usr/sbin/oracleasm createdisk VOL6 /dev/sdg1
Writing disk header: done
Instantiating disk: done
[root@rac1 mnt]# /usr/sbin/oracleasm listdisks
VOL1
VOL2
VOL3
VOL4
VOL5
VOL6
6)節點2新增asm磁碟:
[root@rac2 mnt]# /usr/sbin/oracleasm -h
Usage: oracleasm [--exec-path=<exec_path>] <command> [ <args> ]
oracleasm --exec-path
oracleasm -h
oracleasm -V
The basic oracleasm commands are:
configure Configure the Oracle Linux ASMLib driver
init Load and initialize the ASMLib driver
exit Stop the ASMLib driver
scandisks Scan the system for Oracle ASMLib disks
status Display the status of the Oracle ASMLib driver
listdisks List known Oracle ASMLib disks
querydisk Determine if a disk belongs to Oracle ASMlib
createdisk Allocate a device for Oracle ASMLib use
deletedisk Return a device to the operating system
renamedisk Change the label of an Oracle ASMlib disk
update-driver Download the latest ASMLib driver
[root@rac2 mnt]# /usr/sbin/oracleasm listdisks
[root@rac2 mnt]# /usr/sbin/oracleasm scandisks
Reloading disk partitions: done
Cleaning any stale ASM disks...
Scanning system for ASM disks...
Instantiating disk "VOL1"
Instantiating disk "VOL2"
Instantiating disk "VOL3"
Instantiating disk "VOL5"
Instantiating disk "VOL4"
Instantiating disk "VOL6"
[root@rac2 mnt]# /usr/sbin/oracleasm listdisks
VOL1
VOL2
VOL3
VOL4
VOL5
VOL6
[root@rac2 mnt]#
7、安裝grid軟體
1)上傳安裝介質,解壓(一個節點即可)。
2)安裝grid前預檢查(一個節點即可)
[grid@rac1 grid]$ ./runcluvfy.sh stage -pre crsinst -n rac1,rac2 -fixup -verbose
3)圖形介面安裝grid軟體
以下圖形介面安裝略。