ORACLE-RAC-11G-R2_INSTALL

haoge0205發表於2013-11-28
掛載映象:
mkdir /media/disk
mount /dev/cdrom /media/disk


安裝oracle-linux依賴的所有包:
vi /etc/yum.repos.d/public-yum-el5.repo
[oel5]
name = Enterprise Linux 5.7 DVD
baseurl=file:///media/disk/Server/
gpgcheck=0
enabled=1

yum install oracle-validated --執行並安裝依賴的包

修改hosts,配置域名:
vi /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
127.0.0.1 localhost
192.168.228.161 rac1
192.168.228.168 rac1-vip
1.1.1.161 rac1-priv
192.168.228.162 rac2
192.168.228.169 rac2-vip
1.1.1.162 rac2-priv
192.168.228.170 rac-scan


新增組和使用者:
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 -m -u 1100 -g oinstall -G asmadmin,asmdba,asmoper -d /home/grid -s /bin/bash grid
useradd -m -u 1101 -g oinstall -G dba,oper,asmdba -d /home/oracle -s /bin/bash oracle


建立oralce、grid 密碼:
id oracle
id grid
passwd oracle
passwd grid


建立安裝目錄:
mkdir -p /u01/app/grid/11.2.0
chown -R grid:oinstall /u01
mkdir -p /u01/app/oracle/11.2.0/db_1
chown -R oracle:oinstall /u01/app/oracle
chmod -R 775 /u01

配置伺服器時間同步:(10g需要配置,在11gR2中不用ntp配置)
rac1:
vi /etc/ntp.conf
server 127.127.1.0
fudge 127.127.1.0 stratum 11
driftfile /var/lib/ntp/drift
broadcastdelay 0.008
rac2:
vi /etc/ntp.conf
server 192.168.228.161 prefer --192.168.228.161為主節點的IP地址
driftfile /var/lib/ntp/drift
broadcastdelay 0.008
/etc/init.d/ntpd restart --重啟


配置SSH: (在10g需要配置ssh通訊,在11g R2新特性 無需配置SSH)
在rac1、rac2:
su - oracle
mkdir ~/.ssh
ssh-keygen -t rsa
ssh-keygen -t dsa
在rac1:
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
在rac1:
ssh rac1 date
ssh rac2 date
ssh rac1-priv date
ssh rac2-priv date
在rac2:
ssh rac1 date
ssh rac2 date
ssh rac1-priv date
ssh rac2-priv date


時間同步,配置ctss:(在11g r2中不需要配置)
在rac1、rac2:
/sbin/service ntpd stop
chkconfig ntpd off
mv /etc/ntp.conf /etc/ntp.conf.original
chkconfig ntpd --list
rm /var/run/ntpd.pid
安裝完後要確認ctssd處於活動狀態,用grid使用者輸入:
$ crsctl check ctss

在grid下配置.bash_profile:
rac1:
export ORACLE_SID=+ASM1
#export ORACLE_SID=+ASM2
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/grid/11.2.0
export PATH=$ORACLE_HOME/bin:$PATH:/usr/local/bin/:.
export TEMP=/tmp
export TMP=/tmp
export TMPDIR=/tmp
umask 022
rac2:
#export ORACLE_SID=+ASM1
export ORACLE_SID=+ASM2
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/grid/11.2.0
export PATH=$ORACLE_HOME/bin:$PATH:/usr/local/bin/:.
export TEMP=/tmp
export TMP=/tmp
export TMPDIR=/tmp
umask 022


在oracle下配置.bash_profile:
rac1和rac2: 注意SID
ORACLE_SID=yoon1; export ORACLE_SID
#ORACLE_SID=yoon2; export ORACLE_SID
ORACLE_UNQNAME=yoon; export ORACLE_UNQNAME
JAVA_HOME=/usr/local/java; export JAVA_HOME
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/11.2.0/db_1; export ORACLE_HOME
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
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11
PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORA_CRS_HOME/bin
PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/JRE
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export CLASSPATH
THREADS_FLAG=native; export THREADS_FLAG
export TEMP=/tmp
export TMPDIR=/tmp
# ---------------------------------------------------
# UMASK
# ---------------------------------------------------
# Set the default file mode creation mask
# (umask) to 022 to ensure that the user performing
# the Oracle software installation creates files
# with 644 permissions.
# ---------------------------------------------------
umask 022



關閉防火牆:
Service iptables status
Service iptables stop
chkconfig iptables off
chkconfig iptables --list

安裝ASMlib:
oracleasm-2.6.18-274.0.0.0.1.el5-2.0.5-1.el5.x86_64.rpm
oracleasm-2.6.18-274.el5-2.0.5-1.el5.x86_64.rpm
oracleasm-support-2.1.7-1.el5.x86_64.rpm


安裝配置oracleasm

/etc/init.d/oracleasm configure
/etc/init.d/oracleasm createdisk DATA /dev/mapper/Mpath2p1
/etc/init.d/oracleasm listdisks
/etc/init.d/oracleasm scandisks


在grid使用者下:

執行./ runInstaller

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL
ORACLE-RAC-11G-R2_INSTALL
ORACLE-RAC-11G-R2_INSTALL




oracle下執行./ runInstaller,安裝資料庫軟體

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL



在grid使用者下執行asmca建立ASM磁碟組:

su - grid

[grid@rac1 ~]$asmca

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

在oracle使用者下建立資料庫:

su - oracle

執行dbca

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

ORACLE-RAC-11G-R2_INSTALL

OK


--------------------------------------------------------------------------------------------------

Maclean Liu 所創指令碼:
####udev 建立裸裝置指令碼#######
for i in b c d e f g h i j k ;
do
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id -g -u -s %p\", RESULT==\"`scsi_id -g -u -s /block/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"oracle\", GROUP=\"oinstall\", MODE=\"0660\""
done
#############################


udev方式建立裸裝置:
vi /etc/udev/rules.d/60-raw.rules
ACTION=="add",KERNEL=="sdb1",RUN+="/bin/raw/dev/raw/raw1 %N"
ACTION=="add",KERNEL=="sdb2",RUN+="/bin/raw/dev/raw/raw2 %N"
ACTION=="add",KERNEL=="sdb3",RUN+="/bin/raw/dev/raw/raw3 %N"
ACTION=="add",KERNEL=="raw*",OWNER=="oracle",GROUP=="oinstall", MODE=="0660"
在root下執行:
start_udev


建立完oracleasm組後,無法刪除:
service oracleasm stop
service oracleasm deletedisk /dev/mapper/mpath2p1
service oracleasm start
/etc/init.d/oracleasm scandisks
/etc/init.d/oracleasm listdisks


ASM磁碟無法識別幾種現象:

1) gi家目錄或者其子目錄許可權錯誤

2)asm磁碟的許可權錯誤

3)asm例項未啟動或者asm磁碟組沒有mount上

4)asm磁碟組資源沒有線上

5)oracle使用者的許可權錯誤

6)oracle($ORACLE_HOME/bin)可執行檔案的許可權錯誤
OK,那我就按照上面的分析結果進行逐一排查:

1) gi家目錄或者其子目錄許可權錯誤
[root@rac1 ~]# ls -ld /u01/app/11.2.0/grid/
drwxr-x--- 66 root oinstall 4096 Apr 19 01:36 /u02/app/11.2.0/grid/
我先簡單檢視了GI的家目錄許可權,這是正常的。這裡想要提醒大家,有些DBA有意無意中看到這樣的目錄許可權,發現所屬主是root,以為出了問題,理所應當地透過命令去更改,如果只更改該目錄許可權問題也不大,回退方法很簡單,但一旦加上-R引數遞迴方式把子目錄、子檔案的許可權一併更改,那故障就發生了。所以,大家在操作的時候不要盲目去做沒有把握的事情,掌握每個操作後面的原理以及其帶來的後果,以至於充分準備好回退方法.
2) asm磁碟的許可權錯誤
[root@rac1 ~]# ls -l /dev/oracleasm/disks/
total 0
brw-rw---- 1 grid asmadmin 8, 17 Apr 19 01:22 ASMDISK1
brw-rw---- 1 grid asmadmin 8, 33 Apr 19 01:22 ASMDISK2
如果發現許可權不對,透過如下命令修改:
[root@rac1 ~]# oracleasm configure -I
或者
[root@rac1 ~]# /etc/init.d/oracleasm configure
修改之後檢視:
[root@rac1 ~]# oracleasm configure
ORACLEASM_ENABLED=true
ORACLEASM_UID=grid
ORACLEASM_GID=asmadmin
ORACLEASM_SCANBOOT=true
ORACLEASM_SCANORDER=""
ORACLEASM_SCANEXCLUDE=""
3) asm例項未啟動或者asm磁碟組沒有mount上
4) asm磁碟組資源沒有線上:
[grid@rac1 ~]$ crsctl stat res –t
---------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
---------------------------------------------------------------------
ora.DATA.dg
ONLINE ONLINE rac1
ora.FLASH.dg
ONLINE ONLINE rac1
ora.GRID.dg
ONLINE ONLINE rac1
ora.LISTENER.lsnr
ONLINE ONLINE rac1
ora.asm
ONLINE ONLINE rac1 Started
ora.ons
OFFLINE OFFLINE rac1
---------------------------------------------------------------------
Cluster Resources
---------------------------------------------------------------------
ora.cssd
1 ONLINE ONLINE rac1
ora.diskmon
1 OFFLINE OFFLINE
ora.evmd
1 ONLINE ONLINE rac1
5) oracle使用者的許可權錯誤
[root@rac1 ~]# id oracle
uid=1101(oracle) gid=1000(oinstall) groups=1000(oinstall),1300(dba),1301(oper),1201(asmdba)
oracle使用者需要加入到asmdba組,如果發現沒有加入,進行如下操作:
[root@rac1 ~]# gpasswd -a oracle asmdba
Adding user oracle to group asmdba
6) oracle($ORACLE_HOME/bin)可執行檔案的許可權錯誤
[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ cd $ORACLE_HOME/bin
[oracle@rac1 bin]$ ls -l oracle
-rwsr-s--x 1 oracle oinstall 232399473 Apr 19 07:04 oracle
oracle可執行檔案的許可權不正確:
[root@rac1 ~]# cd /u01/app/oracle/product/11.2.0/dbhome_1/bin/
[root@rac1 bin]# chown oracle.asmadmin oracle
[root@rac1 bin]# ls -l oracle
-rwxr-x--x 1 oracle asmadmin 232399473 Apr 19 07:04 oracle
[root@rac1 bin]# chmod +s oracle
[root@rac1 bin]# ls -l oracle
-rwsr-s--x 1 oracle asmadmin 232399473 Apr 19 07:04 oracle

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