Oracle 11g+RAC+RHEL6.5+udev+ASM+PSU安裝總結

來源:互聯網
上載者:User

Oracle 11g+RAC+RHEL6.5+udev+ASM+PSU安裝總結

1.安裝前準備:

  • 作業系統:RHEL6.5
  • 儲存:華為,已配置多重路徑
  • 業務網卡,心跳網卡綁定,並通過冗餘測試
  • YUM源配置
  • BASH/SSL漏洞補丁

2.檢查系統要求

A.LINUX版本

cat /etc/issue

B.記憶體(至少1G)

grep MemTotal /proc/meminfo

C.SWAP分區
當記憶體為2.5GB-16GB時,Swap等於系統記憶體大小。
當記憶體大於16GB時,Swap等於16GB即可。

D.TMP空間

df -h /tmp
lvcreate -L 2G -n lv_tmp vg_temp
mount /dev/vg_temp/lv_tmp /tmp
df -h /tmp

E.檢查補丁包

# rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libgcc libstdc++ libstdc++-devel libaio libaio-devel make sysstat
binutils-2.20.51.0.2-5.36.el6.x86_64
compat-libcap1-1.10-1.x86_64
compat-libstdc++-33-3.2.3-69.el6.x86_64
gcc-4.4.7-4.el6.x86_64
gcc-c++-4.4.7-4.el6.x86_64
glibc-2.12-1.132.el6.x86_64
glibc-2.12-1.132.el6.i686
glibc-devel-2.12-1.132.el6.x86_64
ksh-20120801-10.el6.x86_64
libgcc-4.4.7-4.el6.x86_64
libgcc-4.4.7-4.el6.i686
libstdc++-4.4.7-4.el6.x86_64
libstdc++-devel-4.4.7-4.el6.x86_64
libaio-0.3.107-10.el6.x86_64
libaio-devel-0.3.107-10.el6.x86_64
make-3.81-20.el6.x86_64
sysstat-9.0.4-22.el6.x86_64

F.禁用防火牆

service iptables status
service iptables stop
chkconfig iptables off

G. 關閉SELinux

#vi /etc/selinux/config
將檔案中的SELINUX="" 為 disabled ,然後重啟。
如果不想重啟系統,使用命令setenforce 0
註:   
setenforce 1 設定SELinux 成為enforcing模式
setenforce 0 設定SELinux 成為permissive模式
getenforce/setenforce查看和設定SELinux的當前工作模式

H.核心參數調整

vim /etc/sysctl.conf
# Oracle install config

fs.aio-max-nr = 1048576 
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 270853791744 --設定為實體記憶體大小(B)
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

2.設定/etc/hosts:
 要求:
私人IP地址必需與公網分離,兩個節點可互相訪問可以ping通,必須在 /etc/hosts裡有;

虛擬IP地址同公網IP地址是一個網段的,如果有DNS就註冊在DNS中,如果沒有DNS就寫在/etc/hosts檔案裡;

公網IP地址,是主機真正的IP地址,主機管理員預先分配,如果有DNS就註冊在DNS中,如果沒有DNS就寫在/etc/hosts檔案裡),並且保證寫入每個客戶系統中的hosts檔案。

在各個節點的網卡配置必須相同,例如:第一個節點公用IP是用bind0,那麼其他節點也得用bind0

3.建立oracle、grid使用者和dba組:

建立組

/usr/sbin/groupadd -g 1000 oinstall
/usr/sbin/groupadd -g 1020 asmadmin
/usr/sbin/groupadd -g 1021 asmdba
/usr/sbin/groupadd -g 1022 asmoper
/usr/sbin/groupadd -g 1031 dba
/usr/sbin/groupadd -g 1032 oper
建立使用者

/usr/sbin/useradd -g oinstall -G asmadmin,asmdba,asmoper,oper,dba -u 1100 grid
/usr/sbin/useradd -g oinstall -G dba,asmdba,oper -u 1101 oracle

4.設定系統限制:
--在每個節點上執行相同操作

im /etc/security/limits.conf
SETTING for ORACLE

racle soft nproc 2047

racle hard nproc 16384
racle soft nofile 4096
racle hard nofile 65536
racle soft stack 10240
racle hard stack 32768

rid soft nproc 2047

grid hard nproc 16384
grid soft nofile 4096
grid hard nofile 65536
grid soft stack 10240
grid hard stack 32768

5.建立GRID及RAC安裝目錄:
--分別在2個節點建立以下目錄

mkdir -p /oracle/app/11.2.0/grid
mkdir -p /oracle/app/grid
mkdir -p /oracle/app/oracle
chown -R grid:oinstall /oracle
chown grid:oinstall /oracle/app/11.2.0/grid
chown grid:oinstall /oracle/app/grid
chown oracle:oinstall /oracle/app/oracle
chmod -R 775 /oracle/
 
6.設定NTP服務:
分別在2個節點設定NTP服務

vim /etc/ntp.conf
driftfile /var/lib/ntp/drift
restrict default kod nomodify notrap nopeer noquery
restrict -6 default kod nomodify notrap nopeer noquery
restrict 127.0.0.1 
restrict -6 ::1
server 202.106.5.193 prefer
server 172.16.66.92
restrict 202.106.5.193
 restrict 172.16.66.92
 includefile /etc/ntp/crypto/pw
 keys /etc/ntp/keys


vim /etc/sysconfig/ntpd
# Drop root to id 'ntp:ntp' by default.
OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid"
修改完這兩個檔案,就可以啟動服務了。

rpm -q ntp
ntp-4.2.6p5-1.el6.x86_64
service ntpd start
可以通過下面兩條命令查看ntp服務的狀態是否正常:

ntpq -p
ntpstat

7.設定使用者的環境變數:
grid使用者:

# vim ~/.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 ORACLE_BASE=/oracle/app/grid
 export ORACLE_HOME=/oracle/app/11.2.0/grid
 export ORACLE_SID=+ASM2
 export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
 export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
 export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch
 export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
 export PATH=${PATH}:$ORACLE_BASE/common/oracle/bin
 export ORACLE_TERM=xterm
 export LD_LIBRARY_PATH=$ORACLE_HOME/lib
 export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
 export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
 export CLASSPATH=$ORACLE_HOME/JRE
 export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
 export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
 export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
 export THREADS_FLAG=native
 export TEMP=/tmp
 export TMPDIR=/tmp
 umask 022
 export TMOUT=0

oracle使用者:

#vim ~/.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 ORACLE_BASE=/oracle/app/oracle
 export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
 export ORACLE_SID=test
 export LANG=en_US.UTF-8

 export NLS_LANG=american_america.ZHS16GBK
 export NLS_DATE_FORMAT="yyyy-mm-dd hh24:mi:ss"
 export PATH=.:${PATH}:$HOME/bin:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch
 export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
 export PATH=${PATH}:$ORACLE_BASE/common/oracle/bin:/home/oracle/run
 export ORACLE_TERM=xterm
 export LD_LIBRARY_PATH=$ORACLE_HOME/lib
 export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
 export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
 export CLASSPATH=$ORACLE_HOME/JRE
 export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
 export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
 export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
 export THREADS_FLAG=native
 export TEMP=/tmp
 export TMPDIR=/tmp
 export GI_HOME=/oracle/app/11.2.0/grid
 export PATH=${PATH}:$GI_HOME/bin
 export ORA_NLS10=$GI_HOME/nls/data
 umask 022
 export TMOUT=0
 
8.配置UDEV:

以下操作需要2個節點都執行:

# cd /etc/udev/rules.d
# vim 99-oracle-asmdevices.rules
KERNEL=="sd*", SUBSYSTEM=="block", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="364862761000560eb82f364f700000014", NAME="asmdisk001", OWNER="grid", GROUP="asmadmin", MODE="0660"
其中RESULT的值為磁碟的UUID
擷取磁碟UUID的命令如下:
# scsi_id --whitelisted --replace-whitespace --device=/dev/sdb
建議使用指令碼將所有磁碟的UUID輸出到x.log,然後使用列編輯搞定所有asm磁碟
 ./test.sh > x.log
 
執行並核對完99-oracle-asmdevices.rules後,便可以執行命令啟動udev了:

# ./sbin/start_udev
# ls -al /dev/asm*
brw-rw---- 1 grid asmadmin 8, 16 Aug 7 14:57 /dev/asmdisk001

9.安裝cvudisk包

# cd $INSTALL_MEDIA/grid/rpm/
## CVUQDISK_GRP=oinstall;export CVUQDISK_GRP  --可以在此處自訂安裝使用者組

# rpm -ivh cvuqdisk-1.0.9-1.rpm
Preparing... ########################################### [100%]
Using default group oinstall to install package
1:cvuqdisk ########################################### [100%]

10.配置SSH互信

# cp $INSTALL_MEDIA/grid/sshsetup/sshUserSetup.sh /home/grid
# cd /home/grid
# chown grid:oinstall sshUserSetup.sh
# su - grid
$ ./sshUserSetup.sh -user grid -hosts "test1 test1-priv test2 test2-priv" -advanced -noPromptPassphrase
$ date;ssh test2 date; ssh test1-priv date; ssh test2-priv date


# cp $INSTALL_MEDIA/grid/sshsetup/sshUserSetup.sh /home/oracle
# cd /home/oracle

 # chown oracle:oinstall sshUserSetup.sh
 # su - oracle
 $ ./sshUserSetup.sh -user oracle -hosts "test1 test1-priv test2 test2-priv" -advanced -noPromptPassphrase
 $ ./date;ssh test date; ssh test1-priv date; ssh test2-priv date

11.運行GI的安裝前檢查

# su - grid
$ cd $INSTALL_MEDIA/grid/
$ ./runcluvfy.sh stage -pre crsinst -n test1,test2 -fixup -verbose
12.安裝GI軟體
# su - grid
 $ cd $INSTALL_MEDIA/grid
 $ ./runInstaller
後面的就略了,不想貼圖...累...

13.安裝Database軟體

 

# su - oracle
$ cd $INSTALL_MEDIA/database/
$ ./runcluvfy.sh stage -pre dbcfg -n test1,test2
後面同略,點點點的操作請自己琢磨著選。
PS:官方建議GI和Database都把中文語言套件裝上去,以後可能會用到。

14.Opatch補丁更新
首先需要替換更新/u01/app/11.2.0/grid/和$ORACLE_HOME下的OPatch檔案,記得停crs。
然後執行以下程式:

 

root使用者執行:
# /oracle/app/11.2.0/grid/crs/install/rootcrs.pl -unlock


grid使用者執行:
$ /oracle/app/11.2.0/grid/OPatch/opatch napply -oh /oracle/app/11.2.0/grid -local /oracle/app/11.2.0/grid/OPatch/20996923/20831122
$ /oracle/app/11.2.0/grid/OPatch/opatch napply -oh /oracle/app/11.2.0/grid -local /oracle/app/11.2.0/grid/OPatch/20996923/20299019
$ /oracle/app/11.2.0/grid/OPatch/opatch apply -oh /oracle/app/11.2.0/grid -local /oracle/app/11.2.0/grid/OPatch/20996923/20760982


oracle使用者執行:
 $ /oracle/app/11.2.0/grid/OPatch/20996923/20831122/custom/server/20831122/custom/scripts/prepatch.sh -dbhome /oracle/app/oracle/product/11.2.0/dbhome_1
 $ /oracle/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch napply -oh /oracle/app/oracle/product/11.2.0/dbhome_1 -local /oracle/app/11.2.0/grid/OPatch/20996923/20831122/custom/server/20831122
 $ /oracle/app/oracle/product/11.2.0/dbhome_1/OPatch/opatch apply -oh /oracle/app/oracle/product/11.2.0/dbhome_1 -local /oracle/app/11.2.0/grid/OPatch/20996923/20760982
 $ /oracle/app/11.2.0/grid/OPatch/20996923/20831122/custom/server/20831122/custom/scripts/postpatch.sh -dbhome /oracle/app/oracle/product/11.2.0/dbhome_1
 

 root使用者執行:
 # /oracle/app/11.2.0/grid/rdbms/install/rootadd_rdbms.sh
 # /oracle/app/11.2.0/grid/crs/install/rootcrs.pl -patch
 

 安裝完成後運行一下命令檢查版本是否更新:
 $ opatch lsinventory
 Oracle Interim Patch Installer version 11.2.0.3.11
 Copyright (c) 2015, Oracle Corporation. All rights reserved.
15.ASM參數設定

alter diskgroup DATA set attribute 'disk_repair_time'='2400h';
alter diskgroup ARCH set attribute 'disk_repair_time'='2400h';
alter diskgroup OCRDG set attribute 'disk_repair_time'='2400h';
alter system set asm_diskgroups='DATA','ARCH' SCOPE=SPFILE sid='*';
alter system set memoey_max_target=4096M scope=spfile;
alter system set memoey_target=4096M scope=spfile;

16.建立資料庫
此處也略了...大家懂得。

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.