实验环境准备
虚拟机: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:\vmware\sharedisk\Shared_Virtual_Disk_OCR1.vmdk" vmware-vdiskmanager.exe -c -s 2g -a lsilogic -t 2 "D:\vmware\sharedisk\Shared_Virtual_Disk_OCR2.vmdk" vmware-vdiskmanager.exe -c -s 2g -a lsilogic -t 2 "D:\vmware\sharedisk\Shared_Virtual_Disk_OCR3.vmdk" vmware-vdiskmanager.exe -c -s 5g -a lsilogic -t 2 "D:\vmware\sharedisk\Shared_Virtual_Disk_FRA.vmdk" vmware-vdiskmanager.exe -c -s 6g -a lsilogic -t 2 "D:\vmware\sharedisk\Shared_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:\vmware\sharedisk\Shared_Virtual_Disk_OCR1.vmdk" scsi1:0.deviceType = "disk" scsi1:0.redo = "" scsi1:1.present = "TRUE" scsi1:1.mode = "independent-persistent" scsi1:1.fileName = "D:\vmware\sharedisk\Shared_Virtual_Disk_OCR2.vmdk" scsi1:1.deviceType = "disk" scsi1:1.redo = "" scsi1:2.present = "TRUE" scsi1:2.mode = "independent-persistent" scsi1:2.fileName = "D:\vmware\sharedisk\Shared_Virtual_Disk_OCR3.vmdk" scsi1:2.deviceType = "disk" scsi1:2.redo = "" scsi1:3.present = "TRUE" scsi1:3.mode = "independent-persistent" scsi1:3.fileName = "D:\vmware\sharedisk\Shared_Virtual_Disk_FRA.vmdk" scsi1:3.deviceType = "disk" scsi1:3.redo = "" scsi1:4.present = "TRUE" scsi1:4.mode = "independent-persistent" scsi1:4.fileName = "D:\vmware\sharedisk\Shared_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_profileexport ORACLE_SID=xdja1export ORACLE_BASE=/u01/app/oracleexport ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"export NLS_LANG=American_america.ZHS16GBKexport 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
选择第一项,集群部署
选择第二项,高级安装
默认选择即可
集群名称自己定义,SCAN Name按照/etc/hosts中规划的进行设置,端口默认1521,勾选掉Configure GNS的复选框
增加2节点的配置,按照/etc/hosts中的规划添加
配置SSH互信,输入grid用户的密码,点击Setup
选择网卡的类型,公网和私网要分清楚
选择第一项,ASM管理
磁盘组名称输入OCR,冗余级别选择Normal,磁盘选择asm-diskb/ asm-diskc/ asm-diskd
选择第二项,使用统一密码,密码根据需求自己定义
点Yes强制设置密码
选择第二项,不使用IPMI
检查用户组分配情况,一般默认都是对的
检查Oracle Base和Software Location,应该和环境变量中一致,否则检查环境变量
保持默认即可
界面上的2个报错点击忽略
点击Install安装
两个节点依次执行root脚本,一定要等第一个节点执行完成后,再在第二个节点上执行
点击OK忽略报错
点击Yes继续
安装完成,点击Close关闭安装界面
13. 创建ASM磁盘
创建磁盘组DATA,选择asm-diskf,冗余级别选择External 创建磁盘组FRA,选择asm-diske,冗余级别选择External
14. 安装database
勾选掉MOS的复选框 选择第三项,跳过升级 选择第二项,仅安装数据库软件 选择2个节点,输入oracle用户密码,点击Setup配置SSH互信 保持默认即可 现在第一项,企业版 检查Oracle Base和Software Location,应该与环境变量保持一致,否则检查环境变量 检查用户组设置,一般默认设置是对的 界面中的3个报错点击忽略即可 点击Yes继续 点击Install安装 依次在两节点执行root脚本 安装完成,点击Close关闭界面
15. dbca建库
选择RAC数据库 选择创建数据库
选择一般用途
输入实例名,要跟环境变量保持一致
选择配置EM
设置密码
选择ASM
Database Area 选择 +DATA
设置ASMSNMP的密码
为闪回区选择 +FRA
不创建示例
内存根据实际情况进行分配
设置连接数
设置字符集,一定要设置正确,无法修改
可以修改一些控制文件信息和Redo大小数量等,实验环境直接下一步即可
点击Finish开始创建数据库
原文地址:https://www.cnblogs.com/rayso/p/12170675.html