实验环境准备
虚拟机:VMware® Workstation 14 Pro
操作系统:Red Hat Enterprise Linux 6.6 x86_64
rhel-server-6.6-x86_64-dvd.iso
oracle软件:oracle 11.2.0.4
p13390677_112040_Linux-x86-64_1of7.zip
p13390677_112040_Linux-x86-64_2of7.zip
p13390677_112040_Linux-x86-64_3of7.zip
虚拟服务器配置
cpu:1核心
内存:2G
硬盘:30G
共享磁盘:2G*3 + 5G + 6G
网卡*3
操作系统安装
分区:(实验环境以最小化原则进行安装,实际生产环境需要根据需求进行合理规划)
/boot 200M
swap 3200M
/ 剩余所有空间
软件包:
选择Desktop
时区:
选择shanghai
创建共享磁盘
vmware-vdiskmanager.exe -c -s 2g -a lsilogic -t 2 "D:vmwaresharediskShared_Virtual_Disk_OCR1.vmdk" vmware-vdiskmanager.exe -c -s 2g -a lsilogic -t 2 "D:vmwaresharediskShared_Virtual_Disk_OCR2.vmdk" vmware-vdiskmanager.exe -c -s 2g -a lsilogic -t 2 "D:vmwaresharediskShared_Virtual_Disk_OCR3.vmdk" vmware-vdiskmanager.exe -c -s 5g -a lsilogic -t 2 "D:vmwaresharediskShared_Virtual_Disk_FRA.vmdk" vmware-vdiskmanager.exe -c -s 6g -a lsilogic -t 2 "D:vmwaresharediskShared_Virtual_Disk_DATA.vmdk"
虚拟机关机后,在srac1.vmx/srac2.vmx文件最后追加以下内容
#shared disks configure disk.EnableUUID="TRUE" disk.locking = "FALSE" scsi1.shared = "TRUE" diskLib.dataCacheMaxSize = "0" diskLib.dataCacheMaxReadAheadSize = "0" diskLib.dataCacheMinReadAheadSize = "0" diskLib.dataCachePageSize= "4096" diskLib.maxUnsyncedWrites = "0" scsi1.present = "TRUE" scsi1.virtualDev = "lsilogic" scsil.sharedBus = "VIRTUAL" scsi1:0.present = "TRUE" scsi1:0.mode = "independent-persistent" scsi1:0.fileName = "D:vmwaresharediskShared_Virtual_Disk_OCR1.vmdk" scsi1:0.deviceType = "disk" scsi1:0.redo = "" scsi1:1.present = "TRUE" scsi1:1.mode = "independent-persistent" scsi1:1.fileName = "D:vmwaresharediskShared_Virtual_Disk_OCR2.vmdk" scsi1:1.deviceType = "disk" scsi1:1.redo = "" scsi1:2.present = "TRUE" scsi1:2.mode = "independent-persistent" scsi1:2.fileName = "D:vmwaresharediskShared_Virtual_Disk_OCR3.vmdk" scsi1:2.deviceType = "disk" scsi1:2.redo = "" scsi1:3.present = "TRUE" scsi1:3.mode = "independent-persistent" scsi1:3.fileName = "D:vmwaresharediskShared_Virtual_Disk_FRA.vmdk" scsi1:3.deviceType = "disk" scsi1:3.redo = "" scsi1:4.present = "TRUE" scsi1:4.mode = "independent-persistent" scsi1:4.fileName = "D:vmwaresharediskShared_Virtual_Disk_DATA.vmdk" scsi1:4.deviceType = "disk" scsi1:4.redo = ""
IP规划
hostname |
IP |
|
Public Network |
srac1 |
92.0.2.101 |
srac2 |
92.0.2.102 |
|
Virtual IP (VIP) |
srac1 |
92.0.2.103 |
srac2 |
92.0.2.104 |
|
Private Interconnect |
srac1 |
192.168.0.101 |
srac2 |
192.168.0.102 |
|
SCAN IP |
srac1/srac2 |
92.0.2.105 |
hosts规划
##Public Network
92.0.2.101 srac1.example.com srac1
92.0.2.102 srac2.example.com srac2
##Public Virtual IP (VIP) addresses
92.0.2.103 srac1-vip.example.com srac1-vip
92.0.2.104 srac2-vip.example.com srac2-vip
##Private Interconnect
192.168.0.101 srac1-priv.example.com srac1-priv
192.168.0.102 srac2-priv.example.com srac2-priv
##SCAN IP
92.0.2.105 srac-scan.example.com srac-scan
安装
1. 关闭防火墙、SELinux
# chkconfig iptables off # chkconfig ip6tables off # vi /etc/selinux/config # This file controls the state of SELinux on the system. # SELINUX= can take one of these three values: # enforcing - SELinux security policy is enforced. # permissive - SELinux prints warnings instead of enforcing. # disabled - No SELinux policy is loaded. SELINUX=disabled # SELINUXTYPE= can take one of these two values: # targeted - Targeted processes are protected, # mls - Multi Level Security protection. SELINUXTYPE=targeted 重启后生效
2. 查看修改主机名
# hostname (查看hostname) # vi /etc/sysconfig/network (如果hostname不合适修改该文件) 建议在安装操作系统时设置合适的主机名
3. 修改/etc/hosts
# vi /etc/hosts增加以下内容 ##Public Network 92.0.2.101 srac1.example.com srac1 92.0.2.102 srac2.example.com srac2 ##Public Virtual IP (VIP) addresses 92.0.2.103 srac1-vip.example.com srac1-vip 92.0.2.104 srac2-vip.example.com srac2-vip ##Private Interconnect 192.168.0.101 srac1-priv.example.com srac1-priv 192.168.0.102 srac2-priv.example.com srac2-priv ##SCAN IP 92.0.2.105 srac-scan.example.com srac-scan
4. 创建用户和组
# /usr/sbin/groupadd -g 501 oinstall # /usr/sbin/groupadd -g 502 dba # /usr/sbin/groupadd -g 503 oper # /usr/sbin/groupadd -g 504 asmadmin # /usr/sbin/groupadd -g 505 asmoper # /usr/sbin/groupadd -g 506 asmdba # /usr/sbin/useradd -u 501 -g oinstall -G dba,oper,asmdba,asmadmin,asmoper grid # /usr/sbin/useradd -u 502 -g oinstall -G dba,oper,asmdba oracle # passwd grid # passwd oracle
# id grid
# id oracle
5. 配置内核参数
# vi /etc/sysctl.conf fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 4294967296 # kernel.shmmax/kernel.shmmni可以大不能小 kernel.shmmax = 68719476736 #超过memory_target,现在配置为64G kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 #(PROCESSES+10 (PROCESSES+10)*128 PROCESSES+10 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 # /sbin/sysctl -p 注:kernel.shmall= kernel.shmmax/ kernel.shmmni是理论值,一般设置偏大一点,按照kernel.shmmax/8设置即可 # vi /etc/security/limits.conf grid soft nproc 2047 grid hard nproc 16384 grid soft nofile 1024是 grid hard nofile 65536 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 # vi /etc/pam.d/login session required pam_limits.so # vi /etc/profile if [ $USER = "oracle" ] || [ $USER = "grid" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi umask 022 fi
6. 停止NTP服务
# /sbin/service ntpd stop # service ntpd status # mv /etc/ntp.conf /etc/ntp.conf.bak 停用NTP服务后,grid组件安装时会自动启用oracle自带的时钟同步服务。
7. 增加/dev/shm大小
大小要超过memery_target # mount -o remount,size=4G /dev/shm # vi /etc/fstab tmpfs /dev/shm tmpfs defaults,size=4G 0 0
8. 创建目录并修改权限
# mkdir -p /u01/app/oracle # mkdir -p /u01/app/grid # mkdir -p /u01/app/11.2.0/grid # chown -R grid:oinstall /u01/app/grid # chown -R grid:oinstall /u01/app/11.2.0 # chown -R oracle:oinstall /u01/app/oracle # chmod -R 775 /u01 # mkdir -p /u01/app/oraInventory # chown -R grid:oinstall /u01/app/oraInventory # chmod -R 775 /u01/app/oraInventory
9. 修改环境变量
# su – grid $ vi .bash_profile export ORACLE_SID=+ASM1 export ORACLE_BASE=/u01/app/grid export ORACLE_HOME=/u01/app/11.2.0/grid export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32 export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS" export NLS_LANG=American_america.ZHS16GBK export PATH=$ORACLE_HOME/bin:$PATH $ source .bash_profile
# su - oracle
$ vi .bash_profile
export ORACLE_SID=xdja1
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export NLS_LANG=American_america.ZHS16GBK
export PATH=$PATH:$ORACLE_HOME/bin
$ source .bash_profile
注:srac2节点上需要把红色部分分别改为对应的+ASM2和xdja2;
oracle用户的ORACLE_SID按照规划的实例名进行相应设置,例如规划实例名为xdja,这里的ORACLE_SID分别设置为xdja1/xdja2
10. 安装依赖包
首先配置本地yum源,软后使用yum命令安装所有依赖包 # yum -y install binutils compat-libcap1 compat-libstdc++-33 elfutils-libelf-devel gcc gcc-c++ glibc glibc-devel ksh libgcc libstdc++ libstdc++-devel libaio libaio-devel make sysstat unixODBC unixODBC-devel libXp parted vim xorg-x11-utils xorg-x11-xauth unzip
11. 配置共享存储
查看是否认出前面配置的共享磁盘 # ll /dev/sd* 查出每块共享磁盘的wwid # scsi_id --whitelisted --replace-whitespace --device=/dev/sdb 36000c29cc2059bd2971fa2c85def1bb7 # scsi_id --whitelisted --replace-whitespace --device=/dev/sdc 36000c29291defedaa634a5b6edcf005d # scsi_id --whitelisted --replace-whitespace --device=/dev/sdd 36000c29b22662652d2aed62610921779 # scsi_id --whitelisted --replace-whitespace --device=/dev/sde 36000c297efa48942f5c92f20c5301103 # scsi_id --whitelisted --replace-whitespace --device=/dev/sdf 36000c295385cc5aec648a12c665d88e0 根据wwid对共享磁盘进行绑定 # vim /etc/udev/rules.d/99-oracle-asmdevices.rules KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29cc2059bd2971fa2c85def1bb7", NAME="asm-diskb", OWNER="grid",GROUP="oinstall", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29291defedaa634a5b6edcf005d", NAME="asm-diskc", OWNER="grid",GROUP="oinstall", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c29b22662652d2aed62610921779", NAME="asm-diskd", OWNER="grid",GROUP="oinstall", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c297efa48942f5c92f20c5301103", NAME="asm-diske", OWNER="grid",GROUP="oinstall", MODE="0660" KERNEL=="sd*", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name",RESULT=="36000c295385cc5aec648a12c665d88e0", NAME="asm-diskf", OWNER="grid",GROUP="oinstall", MODE="0660" 重启udev,使配置生效 # start_udev
12. 安装GI
选择第三项,跳过update
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109111814533-423272163.png)
选择第一项,集群部署
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109111840679-1448213700.png)
选择第二项,高级安装
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109111853951-692750014.png)
默认选择即可
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109111906668-459408702.png)
集群名称自己定义,SCAN Name按照/etc/hosts中规划的进行设置,端口默认1521,勾选掉Configure GNS的复选框
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109111918030-631086910.png)
增加2节点的配置,按照/etc/hosts中的规划添加
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112021115-555682937.png)
配置SSH互信,输入grid用户的密码,点击Setup
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112025080-1104400145.png)
选择网卡的类型,公网和私网要分清楚
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112028310-962671415.png)
选择第一项,ASM管理
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112031666-2013497766.png)
磁盘组名称输入OCR,冗余级别选择Normal,磁盘选择asm-diskb/ asm-diskc/ asm-diskd
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112035588-1339020050.png)
选择第二项,使用统一密码,密码根据需求自己定义
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112039265-2098940447.png)
点Yes强制设置密码
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112044857-219795498.png)
选择第二项,不使用IPMI
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112048836-692769938.png)
检查用户组分配情况,一般默认都是对的
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112053305-255117582.png)
检查Oracle Base和Software Location,应该和环境变量中一致,否则检查环境变量
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112058345-1965371905.png)
保持默认即可
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112102166-707446570.png)
界面上的2个报错点击忽略
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112106890-2103036962.png)
点击Install安装
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112111686-1151862219.png)
两个节点依次执行root脚本,一定要等第一个节点执行完成后,再在第二个节点上执行
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112116628-995634604.png)
点击OK忽略报错
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112131170-647892412.png)
点击Yes继续
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112141160-713501715.png)
安装完成,点击Close关闭安装界面
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112146449-339211779.png)
13. 创建ASM磁盘
创建磁盘组DATA,选择asm-diskf,冗余级别选择External
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112547124-341689891.png)
创建磁盘组FRA,选择asm-diske,冗余级别选择External
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112611014-171236580.png)
14. 安装database
勾选掉MOS的复选框
选择第三项,跳过升级
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112641986-808385313.png)
选择第二项,仅安装数据库软件
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112651267-1093552724.png)
选择2个节点,输入oracle用户密码,点击Setup配置SSH互信
保持默认即可
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112701420-1545979976.png)
现在第一项,企业版
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112716931-821076388.png)
检查Oracle Base和Software Location,应该与环境变量保持一致,否则检查环境变量
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112722275-1004744783.png)
检查用户组设置,一般默认设置是对的
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112727416-1958410277.png)
界面中的3个报错点击忽略即可
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112732445-1650424364.png)
点击Yes继续
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112738019-520615399.png)
点击Install安装
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112744255-2054924465.png)
依次在两节点执行root脚本
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109112858243-1375859337.png)
安装完成,点击Close关闭界面
15. dbca建库
选择RAC数据库
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109113123876-1477419679.png)
选择创建数据库
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109113128723-1490760298.png)
选择一般用途
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109113132880-234720921.png)
输入实例名,要跟环境变量保持一致
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109113136337-1475114395.png)
选择配置EM
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109113139671-379337636.png)
设置密码
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109113142834-1397440331.png)
选择ASM
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109113146082-598979573.png)
Database Area 选择 +DATA
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109113149528-1985554789.png)
设置ASMSNMP的密码
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109113152956-1635508956.png)
为闪回区选择 +FRA
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109113157055-408677558.png)
不创建示例
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109113200851-134145265.png)
内存根据实际情况进行分配
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109113204860-1407556649.png)
设置连接数
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109113209398-2108155501.png)
设置字符集,一定要设置正确,无法修改
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109113212980-449277139.png)
可以修改一些控制文件信息和Redo大小数量等,实验环境直接下一步即可
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109113216793-513524653.png)
点击Finish开始创建数据库
![](https://img2018.cnblogs.com/i-beta/1419258/202001/1419258-20200109113220657-1976459260.png)