文章目录
安装
安装LInux软件,只安装一个节点,另一个通过使用vbox克隆虚拟机创建
eth0 — public IP
eth1 — privte IP
IP 规划
主机名 | rac1 |
eth0的IP设置 | 192.168.56.161(公网地址) |
eth0的网关设置 | 192.168.56.1(公网地址) |
eth1的IP设置 | 172.168.56.191(私有地址) |
eth1的网关设置 | (不设置) |
主机名 | rac2 |
eth0的IP设置 | 192.168.56.163(公网地址) |
eth0的网关设置 | 192.168.56.1(公网地址) |
eth1的IP设置 | 172.168.56.193(私有地址) |
eth1的网关设置 | (不设置) |
配置IP
[root@rac1 ~]# more /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.56.161 rac1
192.168.56.162 rac1-vip
192.168.56.163 rac2
192.168.56.164 rac2-vip
192.168.56.176 rac-cluster rac-cluster-scan
172.168.56.191 rac1-priv
172.168.56.193 rac2-priv
################ standby db
192.168.56.165 rac3
192.168.56.166 rac3-vip
192.168.56.167 rac4
192.168.56.168 rac4-vip
192.168.56.177 rac-cluster rac-cluster-scan
172.168.56.195 rac3-priv
172.168.56.197 rac4-priv
测试配置是否成功
ping rac1
ping 192.168.56.161
创建组&用户
groupadd -g 5000 asmadmin
groupadd -g 5001 asmdba
groupadd -g 5002 asmoper
groupadd -g 6000 oinstall
groupadd -g 6001 dba
groupadd -g 6002 oper
useradd -g oinstall -G asmadmin,asmdba,asmoper grid
useradd -g oinstall -G dba,asmdba oracle
passwd oracle
passwd grid
mkdir /u01
mkdir /g01
chown oracle:oinstall /u01
chown grid:oinstall /g01
关闭ntpd
[root@rac1 ~]# service ntpd status
ntpd is stopped
[root@rac1 ~]# chkconfig ntpd off
安装Oracle所需的系统rpm包
[root@rac1~]# mkdir /media/disk
[root@rac1~]# mount /dev/cdrom /media/disk
mount: block device /dev/cdrom is write-protected, mounting read-only
touch /etc/yum.repos.d/public-yum-el5.repo
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
自动安装包,以及连带关系的包!
more /etc/sysctl.conf
查看配置情况,基本上与官方文档推荐的参数配置一致。
查看Oracle用户limit参数
[oracle@rac1 ~]$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31606
max locked memory (kbytes, -l) 50000000
max memory size (kbytes, -m) unlimited
open files (-n) 131072
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 131072
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
配置grid 用户的limit参数
more /etc/security/limits.conf
# Oracle-Validated setting for nofile soft limit is 131072
oracle soft nofile 131072
# Oracle-Validated setting for nofile hard limit is 131072
oracle hard nofile 131072
# Oracle-Validated setting for nproc soft limit is 131072
oracle soft nproc 131072
# Oracle-Validated setting for nproc hard limit is 131072
oracle hard nproc 131072
# Oracle-Validated setting for core soft limit is unlimited
oracle soft core unlimited
# Oracle-Validated setting for core hard limit is unlimited
oracle hard core unlimited
# Oracle-Validated setting for memlock soft limit is 50000000
oracle soft memlock 50000000
# Oracle-Validated setting for memlock hard limit is 50000000
oracle hard hemlock 50000000
拷贝Oracle 配置参数,把所有Oracle 替换为grid,并粘贴至文档后面
# Oracle-Validated setting for nofile soft limit is 131072
grid soft nofile 131072
# Oracle-Validated setting for nofile hard limit is 131072
grid hard nofile 131072
# Oracle-Validated setting for nproc soft limit is 131072
grid soft nproc 131072
# Oracle-Validated setting for nproc hard limit is 131072
grid hard nproc 131072
# Oracle-Validated setting for core soft limit is unlimited
grid soft core unlimited
# Oracle-Validated setting for core hard limit is unlimited
grid hard core unlimited
# Oracle-Validated setting for memlock soft limit is 50000000
grid soft memlock 50000000
# Oracle-Validated setting for memlock hard limit is 50000000
grid hard memlock 50000000
查看grid用户limit参数配置
[root@rac1 dev]# su - grid
[grid@rac1 ~]$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31606
max locked memory (kbytes, -l) 50000000
max memory size (kbytes, -m) unlimited
open files (-n) 131072
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 131072
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
克隆
关机 rac1
需要初始化 mac地址
修改ip 地址
可将节点二改为不启动图形界面模式
vi /etc/inittab
id::initdefault:
— 修改为3,表示不启动图形
在rac1 设置上创建disk(固定大小磁盘,非动态分配)
在虚拟介质管理界面中,双击需要共享的disk,修改模式为“可共享”
修改存储类型后,将共享磁盘添加入rac2.
rac1设置udev
启动rac1
cd /etc/udev/rules.d
touch 99-oracle-asmdevices.rules
ls -l /dev/sd*
for i in b c d e f;
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=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""
done
vi 99-oracle-asmdevices.rules
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB051d8c5d-836cbc77_", NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VBa3291062-69911271_", NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660"
KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id -g -u -s %p", RESULT=="SATA_VBOX_HARDDISK_VB9b81add8-0d634dc7_", NAME="asm-diskd", OWNER="grid", GROUP="asmadmin", MODE="0660"
[root@rac1 rules.d]# start_udev
Starting udev: [ OK ]
[root@rac1 rules.d]# ls -l /dev/asm*
brw-rw---- 1 grid asmadmin 8, 16 Mar 12 07:12 /dev/asm-diskb
brw-rw---- 1 grid asmadmin 8, 32 Mar 12 07:12 /dev/asm-diskc
brw-rw---- 1 grid asmadmin 8, 48 Mar 12 07:12 /dev/asm-diskd
[root@rac1 rules.d]# scp 99-oracle-asmdevices.rules rac2:/etc/udev/rules.d/
rac2启动udev服务
start_udev
[root@rac2 rules.d]# ls -l /dev/asm*
安装GRID
验证:./runcluvfy.sh stage -post whos -n rac1,rac2
运行./runcluvfy.sh
su - grid
此处如果报错,可检查 /etc/hosts 配置情况。
提示setup
test
ocr voting NOT DATA!!!
密码过于简单,会有这个小警告,可忽略
######################进度条
不管,,忽略。。确认后 就可以install啦~
环境变量
— rac1
CRS_HOME=/g01/app/11.2.0/grid/
ORACLE_BASE=/g01
ORACLE_SID=+ASM1
DISPLAY=:0.0
PATH=
C
R
S
H
O
M
E
/
b
i
n
:
CRS_HOME/bin:
CRSHOME/bin:PATH:$HOME/bin
export CRS_HOME ORACLE_BASE ORACLE_SID DISPLAY PATH
— rac2
CRS_HOME=/g01/app/11.2.0/grid/
ORACLE_BASE=/g01
ORACLE_SID=+ASM2
DISPLAY=:0.0
PATH=
C
R
S
H
O
M
E
/
b
i
n
:
CRS_HOME/bin:
CRSHOME/bin:PATH:$HOME/bin
export CRS_HOME ORACLE_BASE ORACLE_SID DISPLAY PATH
验证:
asmcmd —可看到 添加的asm disk group
[grid@rac2 ~]$ crsctl query crs activeversion
Oracle Clusterware active version on the cluster is [11.2.0.3.0]
crs_stat -t
[grid@rac2 ~]$ crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
[grid@rac2 ~]$ crsctl check cluster
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
创建存储DATA的磁盘组
## Log out / Log in
su - grid
再创建一个asm diskgroup,之前创建的是提供ocr 和 voting使用的
asmca
## install oracle software
./runInstaller
INS-35354
是由于oracle目录清单配置文件里的集群配置不对,修改即可:
$cat /g01/app/oraInventory/ContentsXML/inventory.xml
<HOME NAME="Ora11g_gridinfrahome1"LOC="/ocw/grid" TYPE="O" IDX="4"CRS="true">
<NODE_LIST>
<NODE NAME="racnode1"/>
<NODE NAME="racnode2"/>
<NODE NAME="racnode3"/>
</NODE_LIST>
</HOME>
将CRS=true添加到两个节点的配置文件里即可。
修改oracle用户 .bash_profile
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/dbhome_1
ORACLE_SID=DD1
PATH= O R A C L E H O M E / O P a t c h : ORACLE_HOME/OPatch: ORACLEHOME/OPatch:ORACLE_HOME/bin: P A T H : PATH: PATH:HOME/bin
export ORACLE_HOME ORACLE_BASE ORACLE_SID PATH
收尾
grid用户netca 创建监听
oracle用户dbca 创建数据库
参考文件
安装脚本
1. 配置/etc/hosts 网络
192.168.1.181 vmac1 vmac1.oracle.com
192.168.1.182 vmac1-vip
192.168.1.183 vmac2 vmac2.oracle.com
192.168.1.184 vmac2-vip
192.168.1.186 vmac-cluster vmac-cluster-scan
172.168.1.18 vmac1-priv
172.168.1.19 vmac2-priv
关闭FIREWALL和Disable SElinux
vi /etc/selinux/config ==>SELINUX=disabled
2. 创建用户和组
groupadd -g 5000 asmadmin
groupadd -g 5001 asmdba
groupadd -g 5002 asmoper
groupadd -g 6000 oinstall
groupadd -g 6001 dba
groupadd -g 6002 oper
useradd -g oinstall -G asmadmin,asmdba,asmoper grid
useradd -g oinstall -G dba,asmdba oracle
passwd oracle
passwd grid
mkdir /s01
mkdir /g01
chown oracle:oinstall /s01
chown grid:oinstall /g01
3. 安装
[root@vmac6 ~]# cd /etc/yum.repos.d
[root@vmac6 yum.repos.d]# mv public-yum-ol6.repo public-yum-ol6.repo.bak
[root@vmac6 yum.repos.d]# touch public-yum-ol6.repo
[root@vmac6 yum.repos.d]# vi public-yum-ol6.repo
[oel6]
name = Enterprise Linux 6.3 DVD
baseurl=file:///media/"OL6.3 x86_64 Disc 1 20120626"/Server
gpgcheck=0
enabled=1
[root@vmac1 ~]# yum install oracle-rdbms-server-11gR2-preinstall-1.0-6.el6
# grid-rdbms-server-11gR2-preinstall setting for nofile soft limit is 1024
grid soft nofile 1024
# grid-rdbms-server-11gR2-preinstall setting for nofile hard limit is 65536
grid hard nofile 65536
# grid-rdbms-server-11gR2-preinstall setting for nproc soft limit is 2047
grid soft nproc 2047
# grid-rdbms-server-11gR2-preinstall setting for nproc hard limit is 16384
grid hard nproc 16384
# grid-rdbms-server-11gR2-preinstall setting for stack soft limit is 10240KB
grid soft stack 10240
# grid-rdbms-server-11gR2-preinstall setting for stack hard limit is 32768KB
grid hard stack 32768
4.
修改vmac2的IP
cd /etc/udev/rules.d/
vi 70-persistent-net.rules
5. 配置共享存储
for i in b c d e f g ;
do
echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\", RESULT==\"`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\"" >> /etc/udev/rules.d/99-oracle-asmdevices.rules
done
/sbin/start_udev
6.配置grid 用户profile
mkdir /g01/orabase
1号节点:
export GRID_HOME=/g01/11ggrid/app/11.2.0/grid
export ORACLE_HOME=/g01/11ggrid/app/11.2.0/grid
export PATH=$GRID_HOME/bin:$GRID_HOME/OPatch:/sbin:/bin:/usr/sbin:/usr/bin
export ORACLE_SID=+ASM1
export LD_LIBRARY_PATH=$GRID_HOME/lib:$GRID_HOME/lib32
export ORACLE_BASE=/g01/orabase
export ORA_NLS10=$ORACLE_HOME/nls/data
export NLS_LANG="Simplified Chinese"_China.AL32UTF8
2号节点:
export GRID_HOME=/g01/11ggrid/app/11.2.0/grid
export ORACLE_HOME=/g01/11ggrid/app/11.2.0/grid
export PATH=$GRID_HOME/bin:$GRID_HOME/OPatch:/sbin:/bin:/usr/sbin:/usr/bin
export ORACLE_SID=+ASM2
export LD_LIBRARY_PATH=$GRID_HOME/lib:$GRID_HOME/lib32
export ORACLE_BASE=/g01/orabase
export ORA_NLS10=$ORACLE_HOME/nls/data
export NLS_LANG="Simplified Chinese"_China.AL32UTF8
root用户的环境变量
export GRID_HOME=/g01/11ggrid/app/11.2.0/grid
export ORACLE_HOME=/g01/11ggrid/app/11.2.0/grid
export PATH=$GRID_HOME/bin:$GRID_HOME/OPatch:/sbin:/bin:/usr/sbin:/usr/bin
oracle用户的环境变量
mkdir /s01/orabase
export ORACLE_HOME=/s01/oracle/app/oracle/product/11.2.0/dbhome_1
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:/sbin:/bin:/usr/sbin:/usr/bin
export ORACLE_SID=PROD1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32
export ORACLE_BASE=/s01/orabase
export ORA_NLS10=$ORACLE_HOME/nls/data
export NLS_LANG="Simplified Chinese"_China.AL32UTF8
7. 打PSU补丁
opatch lspatches ==> 检查PSU补丁
su - root
$GRID_HOME/crs/install/rootcrs.pl -unlock
AIX上: su - root; slibclean
su - grid
opatch napply -oh $GRID_HOME -local /tmp/patch/14727310
opatch napply -oh $GRID_HOME -local /tmp/patch/15876003/
su - oracle
[oracle@vmac1 scripts]$ /tmp/patch/15876003/custom/server/15876003/custom/scripts/prepatch.sh -dbhome $ORACLE_HOME
/tmp/patch/15876003/custom/server/15876003/custom/scripts/prepatch.sh completed successfully.
opatch napply -oh $ORACLE_HOME -local /tmp/patch/15876003/custom/server/15876003
opatch napply -oh $ORACLE_HOME -local /tmp/patch/14727310
/tmp/patch/15876003/custom/server/15876003/custom/scripts/postpatch.sh -dbhome $ORACLE_HOME
su - root
[root@vmac1 ~]# /g01/11ggrid/app/11.2.0/grid/rdbms/install/rootadd_rdbms.sh
[root@vmac1 ~]# /g01/11ggrid/app/11.2.0/grid/crs/install/rootcrs.pl -patch
SELECT x.ksppinm NAME, y.ksppstvl VALUE, x.ksppdesc describ
FROM SYS.x$ksppi x, SYS.x$ksppcv y
WHERE x.inst_id = USERENV ('Instance')
AND y.inst_id = USERENV ('Instance')
AND x.indx = y.indx
AND x.ksppinm like '%high%';
SQL> alter system set "_high_priority_processes"='LMS*' scope=spfile;
System altered.
安装命令文本
[root@maclean1 ~]# mkdir /media/disk
[root@maclean1 ~]# mount /dev/cdrom /media/disk
mount: block device /dev/cdrom is write-protected, mounting read-only
touch /etc/yum.repos.d/public-yum-el5.repo
[oel5]
name = Enterprise Linux 5.5 DVD
baseurl=file:///media/disk/Server/
gpgcheck=0
enabled=1
yum install oracle-validated
[root@maclean1 ~]# mkdir /s01
[root@maclean1 ~]# mkdir /g01
[root@maclean1 ~]# chown oracle:oinstall /s01
[root@maclean1 ~]# chown grid:oinstall /g01
[root@maclean1 ~]# passwd oracle
[root@maclean1 ~]# passwd grid
vi /etc/hosts
192.168.1.171 maclean1 maclean1.oracle.com
192.168.1.172 maclean1-vip
192.168.1.173 maclean2 maclean2.oracle.com
192.168.1.174 maclean2-vip
192.168.1.176 maclean-cluster maclean-cluster-scan
172.168.1.191 maclean1-priv
172.168.1.192 maclean2-priv
groupadd -g 5000 asmadmin
groupadd -g 5001 asmdba
groupadd -g 5002 asmoper
groupadd -g 6000 oinstall
groupadd -g 6001 dba
groupadd -g 6002 oper
useradd -g oinstall -G asmadmin,asmdba,asmoper grid
useradd -g oinstall -G dba,asmdba oracle
cd /etc/udev/rules.d
touch 99-oracle-asmdevices.rules
for i in b c d e f g h i ;
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=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\""
done