作为测试目的安装,环境如下:
OS: OEL 7.5 64-bit (12c 已经不支持32位系统)
db verions: 12.2
node: 2 (rac1.oracle.com,rac2.oracle.com)
IP规划: 1 2 3 4 5 6 7 8 9 10 192.0.2.11 rac1 rac1.oracle.com 192.0.2.13 rac1-vip 192.0.2.12 rac2 rac2.oracle.com 192.0.2.14 rac2-vip 192.0.2.15 rac-scan 192.168.2.11 rac1-priv 192.168.2.12 rac2-priv
安装介质
linuxx64_12201_database.zip
linuxx64_12201_grid_home.zip
oracle linux 7.5.iso
Oracle linux 7.5安装 操作步骤略过。
提下vmware 配置共享磁盘, 在vmx文件里添加如下参数
1 2 3 4 5 6 7 8 9 10 11 12 13 disk.enableUUID = "TRUE" disk.locking="FALSE" diskLib.dataCacheMaxSize = "0" diskLib.dataCacheMaxReadAheadSize = "0" diskLib.DataCacheMinReadAheadSize = "0" diskLib.dataCachePageSize = "4096" diskLib.maxUnsyncedWrites = "0" scsi1:1.SharedBus="Virtual" scsi1:2.SharedBus="Virtual" scsi1:3.SharedBus="Virtual" scsi1:4.SharedBus="Virtual"
配置yum 1 2 3 4 5 6 7 8 9 10 mkdir /opt/media createrepo . yum clean all yum list [myrepo] name=myrepo baseurl=file:///opt/media gpgcheck=0 enabled=1
必备参数 用户 组 1 2 3 yum install oracle-database-server-12cR2-preinstall [root@rac1 yum.repos.d]# id oracle uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba)
可以看到12c默认建了一些新的group分配给oracle用户,另外手动建grid相关的组和用户
1 2 3 4 5 6 7 /usr/sbin/groupadd -g 504 asmadmin /usr/sbin/groupadd -g 506 asmdba /usr/sbin/groupadd -g 507 asmoper /usr/sbin/useradd -u 501 -g oinstall -G asmadmin,asmdba,asmoper grid /usr/sbin/usermod -u 502 -g oinstall -G dba,asmdba oracle passwd oracle passwd grid
关闭selinux 1 2 edit file /etc/selinux/config. SELINUX=disabled
开启NTP(linux 7为chrony) –我采用ctss 没开启 1 2 systemctl enable chronyd.service systemctl start chronyd.service
关闭防火墙 1 2 systemctl stop firewalld.service systemctl disable firewalld.service
安装目录 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 mkdir -p /u01/app/oraInventory chown -R grid:oinstall /u01/app/oraInventory chmod -R 775 /u01/app/oraInventory mkdir -p /u01/app/12.2.0/grid chown -R grid:oinstall /u01/app/12.2.0/grid chmod -R 775 /u01/app/12.2.0/grid mkdir -p /u01/app/grid chown -R grid:oinstall /u01/app/grid chmod -R 775 /u01/app/grid mkdir -p /u01/app/oracle chown -R oracle:oinstall /u01/app/oracle chmod -R 775 /u01/app/oracle
环境变量 /home/oracle/.bash_profile
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 export TMP=/tmp export TMPDIR=$TMP export ORACLE_HOSTNAME=rac1.oracle.com export ORACLE_UNQNAME=rac export ORACLE_BASE=/u01/app/oracle export GRID_HOME=/u01/app/12.2.0/grid export DB_HOME=$ORACLE_BASE/product/12.2.0/db_1 export ORACLE_HOME=$DB_HOME export ORACLE_SID=rac1 export ORACLE_TERM=xterm export BASE_PATH=/usr/sbin:$PATH export PATH=$ORACLE_HOME/bin:$BASE_PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib alias grid_env='. /home/oracle/grid_env' alias db_env='. /home/oracle/db_env'
/home/oracle/grid_env
1 2 3 4 5 6 export ORACLE_SID=+ASM1 export ORACLE_HOME=$GRID_HOME export PATH=$ORACLE_HOME/bin:$BASE_PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
/home/oracle/db_env
1 2 3 4 5 6 export ORACLE_SID=rac1 export ORACLE_HOME=$DB_HOME export PATH=$ORACLE_HOME/bin:$BASE_PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
udev 在linux7 配置12c的udev有些不同
1 2 3 4 5 6 7 8 9 10 11 12 for i in b c d e; do echo "KERNEL==\"sd*\", ENV{DEVTYPE}==\"disk\", SUBSYSTEM==\"block\", PROGRAM==\"/usr/lib/udev/scsi_id -g -u -d \$devnode\", RESULT==\"`/usr/lib/udev/scsi_id -g -u /dev/sd$i`\", RUN+=\"/bin/sh -c 'mknod /dev/asmdisk$i b \$major \$minor; chown grid:asmadmin /dev/asmdisk$i; chmod 0660 /dev/asmdisk$i'"\" >>/etc/udev/rules.d/99-oracle-asmdevices.rules done /sbin/udevadm trigger --type=devices --action=change [root@rac1 rules.d]# ll /dev/asm* brw-rw---- 1 grid asmadmin 8, 16 Sep 17 14:51 /dev/asmdiskb brw-rw---- 1 grid asmadmin 8, 32 Sep 17 14:51 /dev/asmdiskc brw-rw---- 1 grid asmadmin 8, 48 Sep 17 14:51 /dev/asmdiskd brw-rw---- 1 grid asmadmin 8, 64 Sep 17 14:51 /dev/asmdiske
安装Grid Infrastructure 12.2的grid变成了镜像安装,所以先用grid用户软件解压到对应的目录
1 2 cd /u01/app/12.2.0.1/grid unzip -q /opt/linuxx64_12201_grid_home.zip
用root用户安装package,所有节点
1 2 3 4 5 6 7 8 9 su - # Local node. cd /u01/app/12.2.0.1/grid/cv/rpm rpm -Uvh cvuqdisk* # Remote node. scp ./cvuqdisk* root@rac2:/tmp ssh root@rac2 rpm -Uvh /tmp/cvuqdisk* exit
如果要使用AFD Driver (新版ASMLib) 参考如下操作,我这里用的udev
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 # Set environment. export ORACLE_HOME=/u01/app/12.2.0.1/grid export ORACLE_BASE=/tmp # Mark disks. $ORACLE_HOME/bin/asmcmd afd_label DISK1 /dev/asmdisk-c --init $ORACLE_HOME/bin/asmcmd afd_label DISK2 /dev/asmdisk-d --init $ORACLE_HOME/bin/asmcmd afd_label DISK3 /dev/asmdisk-d --init $ORACLE_HOME/bin/asmcmd afd_label DISK4 /dev/asmdisk-d --init # Test Disks. $ORACLE_HOME//bin/asmcmd afd_lslbl /dev/asmdisk-c $ORACLE_HOME//bin/asmcmd afd_lslbl /dev/asmdisk-c $ORACLE_HOME//bin/asmcmd afd_lslbl /dev/asmdisk-c $ORACLE_HOME//bin/asmcmd afd_lslbl /dev/asmdisk-c # unset environment. unset ORACLE_BASE exit
开始安装
1 2 [grid@rac1 grid]$ ./gridSetup.sh Launching Oracle Grid Infrastructure Setup Wizard...
标准cluster
填写cluster名称
添加节点2信息,我选择的两个都是hub节点
对于 12c 版本的集群,除了基本的公网( Public)和私网(private)之外,由于 flex ASM 的出现,我们还需要一个网络来负责在节点之间传递 ASM 的元数据(meta data)。由于 ASM 的元数据数据量很小,所以,对于大部分的系统可以选择集群的私网和 ASM 使用相同的网络。也就是选择 ASM&Private。
配置asm,我已经做了udev绑定
创建 GI management Repository(a.k.a management DB)。 又是一个 12c 的新特性。对于 12c 的集群, oracle 会创建一个小型的数据库,用于存放 CHM 产生的统计信息,这个数据库被称为 GI management Repository(a.k.a management DB). 当然,这个小型的数据库会和 OCR&VF 存放在相同的位置(磁盘组),我这里选择否
选择外部冗余
设置相同的密码
不配置EM
默认组
配置base路径
安装信息目录
点击fix and check again
可忽略的错误
点击install
root执行脚本
检查crs服务 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 [grid@rac2 ~]$ crsctl stat res -t -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.ASMNET1LSNR_ASM.lsnr ONLINE ONLINE rac1 STABLE ONLINE ONLINE rac2 STABLE ora.DATA.dg ONLINE ONLINE rac1 STABLE ONLINE ONLINE rac2 STABLE ora.LISTENER.lsnr ONLINE ONLINE rac1 STABLE ONLINE ONLINE rac2 STABLE ora.net1.network ONLINE ONLINE rac1 STABLE ONLINE ONLINE rac2 STABLE ora.ons ONLINE ONLINE rac1 STABLE ONLINE ONLINE rac2 STABLE ora.proxy_advm OFFLINE OFFLINE rac1 STABLE OFFLINE OFFLINE rac2 STABLE -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE rac1 STABLE ora.MGMTLSNR 1 OFFLINE OFFLINE STABLE ora.asm 1 ONLINE ONLINE rac1 Started,STABLE 2 ONLINE ONLINE rac2 Started,STABLE 3 OFFLINE OFFLINE STABLE ora.cvu 1 ONLINE ONLINE rac1 STABLE ora.qosmserver 1 ONLINE ONLINE rac1 STABLE ora.rac1.vip 1 ONLINE ONLINE rac1 STABLE ora.rac2.vip 1 ONLINE ONLINE rac2 STABLE ora.scan1.vip 1 ONLINE ONLINE rac1 STABLE --------------------------------------------------------------------------------
安装database 1 2 3 [oracle@rac1 database]$ ./runInstaller Starting Oracle Universal Installer...
Install database software only
安装rac
配置ssh互信
选择企业版
选择路径
都选择dba组
我这里没采用dns server 忽略相关错误
执行root.sh
新建实例 Create Database
Typical configuration
错误可忽略
检查rac状态 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 [grid@rac1 ~]$ srvctl config database -d xb Database unique name: xb Database name: xb Oracle home: /u01/app/oracle/product/12.2.0/dbhome_1 Oracle user: oracle Spfile: +DATA/XB/PARAMETERFILE/spfile.279.987348781 Password file: +DATA/XB/PASSWORD/pwdxb.258.987348279 Domain: Start options: open Stop options: immediate Database role: PRIMARY Management policy: AUTOMATIC Server pools: Disk Groups: DATA Mount point paths: Services: Type: RAC Start concurrency: Stop concurrency: OSDBA group: dba OSOPER group: dba Database instances: xb1,xb2 Configured nodes: rac1,rac2 CSS critical: no CPU count: 0 Memory target: 0 Maximum memory: 0 Default network number for database services: Database is administrator managed
通过一个新视图能查看所有实例的状态
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 [oracle@rac1 ~]$ sqlplus / as sysdba SQL*Plus: Release 12.2.0.1.0 Production on Thu Sep 20 15:43:41 2018 Copyright (c) 1982, 2016, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production SQL> desc v$active_instances; Name Null? Type ----------------------------------------- -------- ---------------------------- INST_NUMBER NUMBER INST_NAME VARCHAR2(240) CON_ID NUMBER SQL> select inst_name from v$active_instances; INST_NAME -------------------------------------------------------------------------------- rac1.oracle.com:xb1 rac2.oracle.com:xb2
至此12c rac在OEL7.5上基本安装完毕,后续需要对grid 和database打上最新补丁。