1.安装前准备:
-
操作系统:RHEL6.5 x86_64
-
存储:华为,已配置多路径
-
业务网卡,心跳网卡绑定,并通过冗余测试
-
YUM源配置
-
BASH/SSL漏洞补丁
2.检查系统要求
A.LINUX版本
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 = 1073741824
-
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.设置系统限制:
--在每个节点上执行相同操作
-
vim /etc/security/limits.conf
-
#SETTING for ORACLE
-
oracle soft nproc 2047
-
oracle hard nproc 16384
-
oracle soft nofile 4096
-
oracle hard nofile 65536
-
oracle soft stack 10240
-
oracle hard stack 32768
-
grid 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=/u01/app/grid
-
export ORACLE_HOME=/u01/app/11.2.0/grid
-
export ORACLE_SID=+ASM1
-
export NLS_LANG=american_america.al32utf8
-
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=/u01/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.al32utf8
-
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 "node1 node1-priv node2 node2-priv" -advanced -noPromptPassphrase
-
$ date;ssh node2 date; ssh node1-priv date; ssh node2-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 "node1 node1-priv node2 node2-priv" -advanced -noPromptPassphrase
-
$ date;ssh node2 date; ssh node1-priv date; ssh node2-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.创建数据库
此处也略了...大家懂得。
阅读(4550) | 评论(0) | 转发(0) |