本篇目錄結(jié)構(gòu):
讓客戶滿意是我們工作的目標(biāo),不斷超越客戶的期望值來(lái)自于我們對(duì)這個(gè)行業(yè)的熱愛(ài)。我們立志把好的技術(shù)通過(guò)有效、簡(jiǎn)單的方式提供給客戶,將通過(guò)不懈努力成為客戶在信息化領(lǐng)域值得信任、有價(jià)值的長(zhǎng)期合作伙伴,公司提供的服務(wù)項(xiàng)目有:域名申請(qǐng)、虛擬主機(jī)、營(yíng)銷(xiāo)軟件、網(wǎng)站建設(shè)、武岡網(wǎng)站維護(hù)、網(wǎng)站推廣。
安裝linux的環(huán)境,我就不介紹了,這一部分如果不會(huì)的童鞋就去百度吧,一百度一大堆,如果還是不會(huì)的話就直接下載我已經(jīng)安裝好的系統(tǒng)吧,下載下來(lái)直接可用(http://yunpan.cn/cgkEsf8wpHC2G (提取碼:90f5)),復(fù)制3份,直接命名為rac1、rac2和dg即可,如圖:
在rac1和rac2 2個(gè)節(jié)點(diǎn)上分別執(zhí)行如下語(yǔ)句:
[root@rac01 ~]# service iptables stop
[root@rac01 ~]# chkconfig iptables off
[root@rac01 ~]# chkconfig iptables --list
iptables 0:off 1:off 2:off 3:off 4:off 5:off 6:off
chkconfig iptables off ---永久
service iptables stop ---臨時(shí)
/etc/init.d/iptables status ----會(huì)得到一系列信息,說(shuō)明防火墻開(kāi)著。
/etc/rc.d/init.d/iptables stop ----------關(guān)閉防火墻
#vi /etc/sysconfig/network
HOSTNAME=rac1
# hostname rac1
Rac 2 上同樣執(zhí)行
hosts文件:
[grid@rac1 ~]$ more /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
#Public IP
192.168.59.135 rac1
192.168.59.136 rac2
#Private IP
192.168.116.133 rac1-priv
192.168.116.134 rac2-priv
#Virtual IP
192.168.59.137 rac1-vip
192.168.59.138 rac2-vip
#Scan IP
192.168.59.139 rac-scan
[root@rac01 ~]# vi /etc/sysctl.conf
# for oracle 11g
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2147483648
kernel.shmmax = 68719476736
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
使修改參數(shù)立即生效:
[root@rac01 ~]# /sbin/sysctl -p
[root@rac01 ~]# vi /etc/security/limits.conf
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
[root@rac01 ~]# vi /etc/pam.d/login
session required pam_limits.so
[root@rac01 ~]# 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
[root@rac01 ~]# 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
getsebool
getsebool: SELinux is disabled
root 用戶雙節(jié)點(diǎn)運(yùn)行:
gird時(shí)間同步所需要的設(shè)置(11gR2新增檢查項(xiàng))
#Network Time Protocol Setting
/sbin/service ntpd stop
mv /etc/ntp.conf /etc/ntp.conf.bak (這時(shí)候oracle會(huì)自動(dòng)啟用自己的NTP服務(wù))
[root@node1 ~]# service ntpd status
ntpd is stopped
[root@node1 ~]# chkconfig ntpd stop
[root@node1 ~]# cat /etc/ntp
ntp/ ntp.conf
[root@node1 ~]# cp /etc/ntp.conf /etc/ntp.conf.bak
[root@node1 ~]# rm -rf /etc/ntp.conf
[root@node1 ~]#
解決方法:
例如:為了將/dev/shm的大小增加到1GB,修改/etc/fstab的這行:默認(rèn)的:
none /dev/shm tmpfs defaults 0 0
改成:
none /dev/shm tmpfs defaults,size=1024m 0 0
size參數(shù)也可以用G作單位:size=1G。
或者使用命令: mount -o remount,size=4G /dev/shm
重新mount /dev/shm使之生效:
# mount -o remount /dev/shm
或者:
# umount /dev/shm
# mount -a
馬上可以用"df -h"命令檢查變化。
groupadd -g 501 oinstall
groupadd -g 502 dba
groupadd -g 503 oper
groupadd -g 504 asmadmin
groupadd -g 505 asmoper
groupadd -g 506 asmdba
useradd -g oinstall -G dba,asmdba,oper oracle
useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
為oracle和grid用戶設(shè)密碼:
[root@rac01 ~]# passwd oracle
[root@rac01 ~]# passwd grid
檢查:
[root@ora1 ~]# id oracle
uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),503(oper),506(asmdba)
[root@ora1 ~]# id grid
uid=502(grid) gid=501(oinstall)
groups=501(oinstall),502(dba),503(oper),504(asmadmin),505(asmoper),506(asmdba)
? GRID 軟件的 ORACLE_HOME 不能是 ORACLE_BASE 的子目錄
--在2個(gè)節(jié)點(diǎn)均創(chuàng)建,root用戶下創(chuàng)建目錄:
mkdir -p /u01/app/oracle
mkdir -p /u01/app/grid
mkdir -p /u01/app/11.2.0/grid
chown -R grid:oinstall /u01/app/grid
chown -R grid:oinstall /u01/app/11.2.0
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01
mkdir -p /u01/app/oraInventory
chown -R grid:oinstall /u01/app/oraInventory
chmod -R 775 /u01/app/oraInventory
修改gird、oracle用戶的.bash_profile文件,以oracle賬號(hào)登陸,編輯.bash_profile
或者在root直接編輯:
vi /home/oracle/.bash_profile
vi /home/grid/.bash_profile
--------Oracle User----切換到Oracle用戶下------
[root@rhel_linux_asm ~]# su - oracle
[oracle@rhel_linux_asm ~]$ vi ~/.bash_profile
export ORACLE_SID=rac1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export TMP=/tmp
export TMPDIR=$TMP
export PATH=$PATH:$ORACLE_HOME/bin
--------Grid User-----切換到grid用戶下-----
[grid@rhel_linux_asm ~]$ vim .bash_profile
export ORACLE_SID=+ASM1
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export PATH=$ORACLE_HOME/bin:$PATH
注意:另外一臺(tái)數(shù)據(jù)庫(kù)實(shí)例名須做相應(yīng)修改:
Oracle:export ORACLE_SID=rac2
grid:export ORACLE_SID=+ASM2
依據(jù)官方文檔要求,Red Hat Enterprise Linux 5須安裝如下軟件包
一般情況下除了compat的一些包沒(méi)有安裝外,其他的包都已經(jīng)安裝了,可以使用rpm –qa |grep
rpm -qa | grep binutils-
rpm -qa | grep compat-libstdc++-
rpm -qa | grep elfutils-libelf-
rpm -qa | grep elfutils-libelf-devel-
rpm -qa | grep glibc-
rpm -qa | grep glibc-common-
rpm -qa | grep glibc-devel-
rpm -qa | grep gcc-
rpm -qa | grep gcc-c++-
rpm -qa | grep libaio-
rpm -qa | grep libaio-devel-
rpm -qa | grep libgcc-
rpm -qa | grep libstdc++-
rpm -qa | grep libstdc++-devel-
rpm -qa | grep make-
rpm -qa | grep sysstat-
rpm -qa | grep unixODBC-
rpm -qa | grep unixODBC-devel-
rpm -ivh compat-libstdc++-33-3.2.3-69.el6.i686.rpm --force --nodeps
rpm -ivh unixODBC-* --force --nodeps
rhel6 還應(yīng)該安裝一個(gè)包:compat-libcap1-1.10-1.x86_64.rpm
chkconfig autofs off
chkconfig acpid off
chkconfig sendmail off
chkconfig cups-config-daemon off
chkconfig cpus off
chkconfig xfs off
chkconfig lm_sensors off
chkconfig gpm off
chkconfig openibd off
chkconfig pcmcia off
chkconfig cpuspeed off
chkconfig nfslock off
chkconfig ip6tables off
chkconfig rpcidmapd off
chkconfig apmd off
chkconfig sendmail off
chkconfig arptables_jf off
chkconifg microcode_ctl off
chkconfig rpcgssd off
chkconfig ntpd off
雖然在安裝軟件的過(guò)程中,oracle 會(huì)自動(dòng)配置 SSH 對(duì)等性,建議在安裝軟件之前手工配置。
以oracle身份在每個(gè)節(jié)點(diǎn)執(zhí)行
為ssh和scp創(chuàng)建連接,檢驗(yàn)是否存在:
ls -l /usr/local/bin/ssh
ls -l /usr/local/bin/scp
不存在則創(chuàng)建
/bin/ln -s /usr/bin/ssh /usr/local/bin/ssh
/bin/ln -s /usr/bin/scp /usr/local/bin/scp
[root@rac01 ~]# /bin/ln -s /usr/bin/ssh /usr/local/bin/ssh
[root@rac01 ~]# /bin/ln -s /usr/bin/scp /usr/local/bin/scp
為oracle用戶配置SSH:
生成用戶的公匙和私匙,在每個(gè)節(jié)點(diǎn)上:
[root@rac01 ~]# su – oracle
[oracle@rac01 ~]# mkdir ~/.ssh
[oracle@rac01 ~]#cd .ssh
[oracle@rac01 ~]# ssh-keygen -t rsa
[oracle@rac01 ~]# ssh-keygen -t dsa
在節(jié)點(diǎn)1上,把所有節(jié)點(diǎn)的authorized_keys文件合成一個(gè),再用這個(gè)文件覆蓋各個(gè)節(jié)點(diǎn).ssh下的同名文件:
[oracle@rac01 ~]# touch authorized_keys
[oracle@rac01 ~]# ssh rac01 cat /home/oracle/.ssh/id_rsa.pub >> authorized_keys
[oracle@rac01 ~]# ssh rac02 cat /home/oracle/.ssh/id_rsa.pub >> authorized_keys
[oracle@rac01 ~]# ssh rac01 cat /home/oracle/.ssh/id_dsa.pub >> authorized_keys
[oracle@rac01 ~]# ssh rac02 cat /home/oracle/.ssh/id_dsa.pub >> authorized_keys
[oracle@rac01 ~]# scp authorized_keys rac02:/home/oracle/.ssh/
分別在每個(gè)節(jié)點(diǎn)上執(zhí)行檢驗(yàn)操作:
[oracle@rac01 ~]# ssh rac01 date
[oracle@rac01 ~]# ssh rac02 date
[oracle@rac01 ~]# ssh-agent $SHELL
[oracle@rac01 ~]# ssh-add
為grid用戶配置SSH:
在每個(gè)節(jié)點(diǎn)上:
[root@rac01 ~]# su – grid
[grid@rac01 ~]# mkdir ~/.ssh
[grid@rac01 ~]#cd .ssh
[grid@rac01 ~]# ssh-keygen -t rsa
[grid@rac01 ~]# ssh-keygen -t dsa
在節(jié)點(diǎn)1上
:
[grid@rac01 ~]# touch authorized_keys
[grid@rac01 ~]# ssh rac01 cat /home/grid/.ssh/id_rsa.pub >> authorized_keys
[grid@rac01 ~]# ssh rac02 cat /home/grid/.ssh/id_rsa.pub >> authorized_keys
[grid@rac01 ~]# ssh rac01 cat /home/grid/.ssh/id_dsa.pub >> authorized_keys
[grid@rac01 ~]# ssh rac02 cat /home/grid/.ssh/id_dsa.pub >> authorized_keys
[grid@rac01 ~]# scp authorized_keys rac02:/home/grid/.ssh/
分別在每個(gè)節(jié)點(diǎn)上:
[grid@rac01 ~]# ssh rac01 date
[grid@rac01 ~]# ssh rac02 date
[grid@rac01 ~]# ssh-agent $SHELL
[grid@rac01 ~]# ssh-add
--------------------------------------------------------------------------------------自己:
為Oracle用戶配置SSH:
以oracle身份在每個(gè)節(jié)點(diǎn)執(zhí)行以下代碼
su - oracle
mkdir ~/.ssh
cd .ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
cat *rsa.pub >> authorized_keys
cat *dsa.pub >> authorized_keys
然后在rac1下:
ssh rac2 cat /home/oracle/.ssh/authorized_keys >> authorized_keys
scp authorized_keys rac2:/home/oracle/.ssh/
然后分別在每個(gè)節(jié)點(diǎn)上執(zhí)行檢驗(yàn)操作:
ssh rac1 date
ssh rac2 date
ssh-agent $SHELL
ssh-add
為grid用戶配置SSH:
以grid身份在每個(gè)節(jié)點(diǎn)執(zhí)行
su - grid
mkdir ~/.ssh
cd ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
cat *rsa.pub >> authorized_keys
cat *dsa.pub >> authorized_keys
然后在rac1節(jié)點(diǎn)下執(zhí)行:
ssh rac2 cat /home/grid/.ssh/authorized_keys >> authorized_keys
scp authorized_keys rac2:/home/grid/.ssh/
然后分別在每個(gè)節(jié)點(diǎn)上執(zhí)行檢驗(yàn)操作:
ssh rac1 date
ssh rac2 date
ssh rac1-priv date
ssh rac2-priv date
第二次執(zhí)行時(shí)不再提示輸入口令,并且可以成功執(zhí)行命令,則表示 oracle 用戶 SSH 對(duì)等性
配置成功,至此,Oracle 用戶 SSH 對(duì)等性配置完成!重復(fù)上述步驟,以 grid 用戶配置對(duì)等性。
ssh-agent $SHELL
ssh-add
注意: 該步驟可以不配置然后在安裝的過(guò)程中有如下的界面可以來(lái)配置:
root用戶下執(zhí)行:
A. sed -i 's/OPTIONS/#OPTIONS/g' /etc/sysconfig/ntpd
B.
cat >> /etc/sysconfig/ntpd << EOF
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"
EOF
C.
mv /etc/ntp.conf /etc/ntp.confbak
D.
cat > /etc/ntp.conf << EOF
restrict 0.0.0.0 mask 0.0.0.0 nomodify
server 127.127.1.0
fudge 127.127.1.0 stratum 10
driftfile /var/lib/ntp/drift
broadcastdelay 0.008
authenticate no
keys /etc/ntp/keys
EOF
A.
sed -i 's/OPTIONS/#OPTIONS/g' /etc/sysconfig/ntpd
B.
cat >> /etc/sysconfig/ntpd << EOF
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"
EOF
C.
mv /etc/ntp.conf /etc/ntp.confbak
D.
cat >> /etc/ntp.conf << XL
restrict default kod nomodify notrap nopeer noquery
restrict 182.168.8.0 mask 255.255.255.0 nomodify notrap
restrict 127.0.0.1
server 182.168.8.61
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
driftfile /var/lib/ntp/drift
broadcastdelay 0.008
authenticate no
keys /etc/ntp/keys
XL
#service ntpd restart
#chkconfig ntpd on