IPADDR=172.16.3.11
-- 重启网卡
service network restart
ifconfig
-- 关闭selinux和防火墙
setenforce 0
vim /etc/sysconfig/selinux
SELINUX=disabled
service iptables stop
chkconfig iptables off
service iptables status
-- 配置yum
注意事项:
1.yum配置完成后,用yum list |grep vsftpd测试一下
2.如果要让挂载永远生效,可写入/etc/fstab
vim /etc/fstab
/dev/sr0 /mnt iso9660 defaults,loop 0 0
mount /dev/cdrom /mnt
vim /etc/yum.repos.d/server.repo
[base]
name=Red Hat
baseurl=file:///mnt/Server
enabled=1
gpgcheck=0
-- 配置hosts
vim /etc/hosts
#Public
192.168.3.11 rac01
192.168.3.12 rac02
#Private
172.16.3.11 rac01-priv
172.16.3.12 rac02-priv
#Virtual
192.168.3.13 rac01-vip
192.168.3.14 rac02-vip
#SCAN
192.168.3.15 racscan
192.168.3.16 racscan
192.168.3.17 racscan
-- 修改内核参数
vim /etc/sysctl.conf
#for oracle softe
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
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
sysctl -p
--添加资源限制参数
vim /etc/security/limits.conf
#for oracle
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
#for grid
grid soft nproc 2047
grid hard nproc 16384
grid soft nofile 1024
grid hard nofile 65536
grid soft stack 10240
-- 配置login
vim /etc/pam.d/login
session required pam_limits.so
-- 重命名ntp.conf文件
mv /etc/ntp.conf /etc/ntp.conf.bak
-- 创建必要的用户、组、目录,并授权
注意事项:
1.oracle用户密码设置为oracle,grid用户密码设置为grid
/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
useradd -u 1100 -g oinstall -G asmadmin,asmdba,asmoper,oper,dba grid
useradd -u 1101 -g oinstall -G dba,asmdba,oper oracle
passwd oracle
passwd grid
mkdir -p /u01/app/11.2.0/grid
mkdir -p /u01/app/grid
mkdir /u01/app/oracle
chown -R grid:oinstall /u01
chown oracle:oinstall /u01/app/oracle
chmod -R 775 /u01/
-- 配置grid和oracle用户环境变量
vim /home/grid/.bash_profile
export TEMP=/tmp
export TMP=/tmp
export TMPDIR=/tmp
export ORACLE_SID=+ASM1 #其他节点注意修改
export ORACLE_BASE=/u01/app/grid
export ORACLE_HOME=/u01/app/11.2.0/grid
export PATH=$ORACLE_HOME/bin:$PATH:/usr/local/bin/;
umask 022
if [ $USER = "grid" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
vim /home/oracle/.bash_profile
export TEMP=/tmp
export TMP=/tmp
export TMPDIR=/tmp
export ORACLE_SID=proc1 #其他节点注意修改
export ORACLE_UNQNAME=proc
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_TERM=xterm; export ORACLE_TERM
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
umask 022
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
source /home/oracle/.bash_profile
source /home/grid/.bash_profile
-- 安装必要的软件包
yum -y install binutils compat-libstdc++-33 compat-libcap1 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat
-----------------------------------------------------------------------------------------------------------------------------------------------------
-----------------------------------------节点1------------------------------------------------------------------------------------------------------
-- 搭建DNS
yum list |grep bind-chroot
yum -y install bind-chroot.x86_64
vim /etc/named.conf
options {
listen-on port 53 { any; };
listen-on-v6 port 53 { ::1; };
directory "/var/named";
dump-file "/var/named/data/cache_dump.db";
statistics-file "/var/named/data/named_stats.txt";
memstatistics-file "/var/named/data/named_mem_stats.txt";
allow-query { any; };
recursion yes;
vim /etc/named.rfc1912.zones
zone "zm.cn" IN {
type master;
file "zm.cn.zone";
allow-update { none; };
};
zone "3.168.192.in-addr.arpa" IN {
type master;
file "3.168.192.local";
allow-update { none; };
};
vim /var/named/zm.cn.zone
$TTL 86400
@ IN SOA rac01.zm.cn. root.zm.cn. (
20180319 ; serial (d. adams)
1D ; refresh
1H ; retry
1W ; expiry
3H) ; minimum
IN NS rac01.zm.cn.
rac01 IN A 192.168.3.11
rac02 IN A 192.168.3.12
racscan IN A 192.168.3.15
racscan IN A 192.168.3.16
racscan IN A 192.168.3.17
vim /var/named/3.168.192.local
$TTL 86400
@ IN SOA rac01.zm.cn. root.zm.cn (
20180319 ; serial (d. adams)
1D ; refresh
1H ; retry
1W ; expiry
3H) ; minimum
IN NS rac01.zm.cn.
11 IN PTR rac01.zm.cn.
12 IN PTR rac02.zm.cn.
15 IN PTR racscan.zm.cn.
16 IN PTR racscan.zm.cn.
17 IN PTR racscan.zm.cn.
----------------------------------------------节点1,节点2-------------------------------------
-- 配置/etc/resolv.conf
vim /etc/resolv.conf
search zm.cn
nameserver 192.168.3.11
----------------------------------------------节点1-------------------------------------------
-- 重启dns,并设置开启启动
service named restart
chkconfig named on;
----------------------------------------------节点1,节点2-------------------------------------
-- 验证dns正向解析和反向解析
nslookup racscan
nslookup rac01
nslookup rac02
nslookup 192.168.3.11
nslookup 192.168.3.12
nslookup 192.168.3.15
nslookup 192.168.3.16
nslookup 192.168.3.17
---------------------------------------------------节点1-----------------------------------------------------------
-- 创建共享存储
D:\Program Files (x86)\VMware\VMware Workstation>
vmware-vdiskmanager.exe -c -s 2000Mb -a lslogic -t 2 "D:\VM machine\sharedisk\ocr1.vmdk"
vmware-vdiskmanager.exe -c -s 2000M -a lslogic -t 2 "D:\VM machine\sharedisk\ocr2.vmdk"
vmware-vdiskmanager.exe -c -s 500M -a lslogic -t 2 "D:\VM machine\sharedisk\fra.vmdk"
vmware-vdiskmanager.exe -c -s 10000M -a lslogic -t 2 "D:\VM machine\sharedisk\data1.vmdk"
vmware-vdiskmanager.exe -c -s 10000M -a lslogic -t 2 "D:\VM machine\sharedisk\data2.vmdk"
vmware-vdiskmanager.exe -c -s 5000M -a lslogic -t 2 "D:\VM machine\sharedisk\arch.vmdk"
-- 编辑虚拟机设置,添加磁盘,选择使用现有虚拟磁盘(选择永久,保持现有格式)
--编辑虚拟机设置, 高级选择scsi1,不和系统磁盘在一个通道上
-- 节点1的.vmx文件添加
scsi1:0.writeThrough="TRUE"
scsi1:0.sharedBus="virtual"
scsi1:1.writeThrough="TRUE"
scsi1:1.sharedBus="virtual"
scsi1:2.writeThrough="TRUE"
scsi1:2.sharedBus="virtual"
scsi1:3.writeThrough="TRUE"
scsi1:3.sharedBus="virtual"
scsi1:4.writeThrough="TRUE"
scsi1:4.sharedBus="virtual"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.dataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize = "4096"
diskLib.maxUnsyncedWrites = "0"
disk.locking = "FALSE"
disk.EnableUUID = "TRUE"
-------------------------------------------------------------节点2-----------------------------------------------------------------------------------------
-- 节点2的.vmx文件添加
scsi1.present = "TRUE"
scsi1.virtualDev = "lsilogic"
scsi1:0.present = "TRUE"
scsi1:0.fileName = "D:\VM machine\sharedisk\data.vmdk"
scsi1:0.mode = "independent-persistent"
scsi1:1.present = "TRUE"
scsi1:1.fileName = "D:\VM machine\sharedisk\data2.vmdk"
scsi1:1.mode = "independent-persistent"
scsi1:2.present = "TRUE"
scsi1:2.fileName = "D:\VM machine\sharedisk\fra.vmdk"
scsi1:2.mode = "independent-persistent"
scsi1:3.present = "TRUE"
scsi1:3.fileName = "D:\VM machine\sharedisk\ocr1.vmdk"
scsi1:3.mode = "independent-persistent"
scsi1:4.present = "TRUE"
scsi1:4.fileName = "D:\VM machine\sharedisk\ocr2.vmdk"
scsi1:4.mode = "independent-persistent"
diskLib.dataCacheMaxSize = "0"
diskLib.dataCacheMaxReadAheadSize = "0"
diskLib.dataCacheMinReadAheadSize = "0"
diskLib.dataCachePageSize = "4096"
diskLib.maxUnsyncedWrites = "0"
disk.locking = "FALSE"
disk.EnableUUID = "TRUE"
--------------------------------------节点1,节点2------------------------------------
-- 开启节点1,节点2
--------------------------------------节点1-----------------------------------------
-- 格式化共享磁盘,重复下面步骤,格式化其他盘
fdisk /dev/sdb
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
回车,回车
w
-----------------------------------------------节点1,节点2-----------------------------------------
vim /etc/udev/rules.d/60-raw.rules
ACTION=="add",KERNEL=="/dev/sdb",RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add",ENV{MAJOR}=="8",ENV{MINOR}=="17",RUN+="/bin/raw /dev/raw/raw1 %M %m"
ACTION=="add",KERNEL=="/dev/sdc",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add",ENV{MAJOR}=="8",ENV{MINOR}=="33",RUN+="/bin/raw /dev/raw/raw2 %M %m"
ACTION=="add",KERNEL=="/dev/sdd",RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add",ENV{MAJOR}=="8",ENV{MINOR}=="49",RUN+="/bin/raw /dev/raw/raw3 %M %m"
ACTION=="add",KERNEL=="/dev/sde",RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add",ENV{MAJOR}=="8",ENV{MINOR}=="65",RUN+="/bin/raw /dev/raw/raw4 %M %m"
ACTION=="add",KERNEL=="/dev/sdf",RUN+="/bin/raw /dev/raw/raw5 %N"
ACTION=="add",ENV{MAJOR}=="8",ENV{MINOR}=="81",RUN+="/bin/raw /dev/raw/raw5 %M %m"
KERNEL=="raw[1-5]",OWNER="grid",GROUP="asmadmin",MODE="660"
-- 重启udev,查看绑定的磁盘(如果没有绑定成功,检查是否.vmx文件参数配置错误或者重启一下系统)
start_udev
-------------------------------------------------节点1--------------------------------------------------------------------
-- 上传软件包(1和2的数据库,3是grid)
mkdir /soft
p13390677_112040_Linux-x86-64_1of7.zip
p13390677_112040_Linux-x86-64_2of7.zip
p13390677_112040_Linux-x86-64_3of7.zip
-- 解压,修改grid目录权限,安装cvuqdisk包,并传给节点2
unzip p13390677_112040_Linux-x86-64_3of7.zip
cd grid/rpm/
rpm -ivh cvuqdisk-1.0.9-1.rpm
scp cvuqdisk-1.0.9-1.rpm rac02:/tmp
mv grid /home/grid/
--配置xhost(没有图形化桌面配置需开启xmanager passive)
root用户下执行:xhost + (正常显示:access control disabled, clients can connect from any host)
grid用户下执行: export DISPLAY=192.168.3.1:0.0
xdpyinfo(有数据说明正常)
---------------------------节点2-----------------------------------------------------------------------------
-- 安装cvuqdisk包
cd /tmp
rpm -ivh cvuqdisk-1.0.9-1.rpm
---------------------------节点1-----------------------------------------------------------------------
注意事项:
1.在安装grid过程中配置每个节点的grid用户ssh互信
-- 安装grid软件
su - grid
-------------------------------------------节点1、节点2----------------------------------
-- 安装到76% 在节点1、节点2执行下面两个脚本
注意事项:
必须先在节点1执行完了,再去节点2执行
/u01/app/oraInventory/orainstRoot.sh
/u01/app/11.2.0/grid/root.sh
---------------------------------------------节点1--------------------------------------
-- 检查集群状态
su - grid
crsctl check crs
crs_stat -t -v
olsnodes -n
--解压数据库安装包,安装数据库软件
注意事项:
1.这里只是安装数据库软件,选择:install database software only
2.在安装数据库软件过程中配置每个节点的oracle用户ssh互信
unzip p13390677_112040_Linux-x86-64_1of7.zip
unzip p13390677_112040_Linux-x86-64_2of7.zip
mv database/ /home/oracle/
su - oracle
cd database/
./runInstaller
-------------------------------------------节点1、节点2----------------------------------
-- 安装到94% 在节点1、节点2执行下面两个脚本
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/db_1/root.sh
---------------------------------------------节点1--------------------------------------
--- 添加asm磁盘组
注意事项:
1.确保添加完后两个节点的磁盘组都mount了
su - grid
asmca
create (添加DATA和FRA磁盘组)
-- 建库
注意事项:
1.填写sid后记得select all,选择所有节点
2.字符集设置
dbca