ORACLE 12C R2 RAC实战首发
Posted 踩点
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ORACLE 12C R2 RAC实战首发相关的知识,希望对你有一定的参考价值。
大家都知道ORACLE database 12cR2当前正式版并没有发布,当前网上所发布的但是ORACLE database 12cR2技术文档,大多是理论型的从ORACLE OWW会议上,及该会议流露出来的PPT上所摘抄下来,重新组织而发布的文档,对于实战应用操作文档,则较少甚至很难找到。
但是,子衿技术团队已经提前拿到了ORACLE database12cR2的Beta版,已经完全具备了实战应用操作条件,所以有了《ORACLE 12C R2 RAC实战首发》一文”。
实战的第一步,当然是把它安装部署起来了。这篇文章,就讲它的ORACLE12cR2 for Linux RAC + ASM的部署指南。
作者介绍
黎俊杰,性能优化专家,跟随国内知名性能优化大师白鳝(老白)多年,子衿技术团队性能优化主要技术骨干,具有12年以上大型制造物流、电力能源行业信息系统需求设计与管控、业务逻辑设计、软硬件架构设计、数据存储结构设计、数据库存储过程&函数&触发器&SQL语句的开发与优化、小机&X86服务器硬件维护与优化、AIX&Linux操作系统运维与优化、大型Oracle&PostgreSQL高可用设计实施运维及优化、Weblogic中间件运维与优化、HP&IBM&EMC存储设备运维与优化、大型园区主干网络设计与思科防火墙&路由器&三层交换机&二层交换机配置管理经验,积累了大量规划设计、故障分析诊断、优化调整的技术文档。对新系统需求设计与实现逻辑设计引导、数模设计、SQL优化审核、数据库自动化运维、趋势预测、智能告警、报表分析等方面具有独到的研究与实际开发应用经验 |
目录
4.5 配置/etc/security/limits.conf8
6.2 安装GI(Grid Infrastructure).14
1、ORACLE 12.2软硬件要求
1.1 硬件最低配置要求
序号 |
组件 |
内存需求 |
1 |
Oracle Grid Infrastructure installations |
4GB以上 |
2 |
Oracle Database installations |
最小1GB,建议2GB以上 |
1.2 ORACLE 12.2认证的OS软件版本
序号 |
组件 |
1 |
Oracle Linux 7 with the Unbreakable Enterprise kernel: |
2 |
Oracle Linux 7 with the Red Hat Compatible kernel: |
3 |
Oracle Linux 6.4 with the Unbreakable Enterprise kernel 2: |
4 |
Oracle Linux 6 with the Red Hat Compatible kernel: |
5 |
Red Hat Enterprise Linux 7: 3.10.0-123.el7.x86_64 or later |
6 |
Red Hat Enterprise Linux 6: 2.6.32-358.el6.x86_64 or later |
7 |
SUSE Linux Enterprise Server 12: 3.12.28-4-default or later |
8 |
SUSE Linux Enterprise Server 11 SP2: 3.0.13-0.27 or later |
2、整体规划部分
2.1 IP地址规划
序号 |
所属 |
主机名称 |
用途 |
IP地址 |
1 |
GNS |
|
GNS |
192.168.1.190 |
2 |
Node1 |
rac1 |
public |
192.168.1.191 |
3 |
Node1 |
vip |
192.168.1.192 |
|
4 |
Private1 |
10.1.1.191 |
||
5 |
Node1 |
Private2 |
10.1.1.192 |
|
7 |
Node2 |
rac2 |
public |
192.168.1.193 |
8 |
Node2 |
vip |
192.168.1.194 |
|
9 |
Private1 |
10.1.1.193 |
||
10 |
Node2 |
Private2 |
10.1.1.194 |
|
11 |
scan |
|
scan1 |
192.168.1.195 |
12 |
scan |
|
scan2 |
192.168.1.196 |
13 |
scan |
|
scan3 |
192.168.1.197 |
2.2 操作系统本地磁盘分区规划
序号 |
分区名称 |
大小 |
用途说明 |
1 |
/boot |
200MB |
引导分区 |
2 |
/ |
12288MB(12G) |
根分区 |
3 |
swap |
6144MB |
最少4.7303GB以上 |
4 |
/dba |
44850MB |
oracle安装目录 |
2.3 共享存储与ASM磁盘组规划
序号 |
磁盘名称 |
Asm磁盘名称 |
磁盘组名称 |
大小 |
用途 |
1 |
sdb1 |
asm-diskb |
OCR_VOT |
10G |
OCR+VOTINGDISK |
2 |
sdc1 |
asm_diskc |
DATA01 |
30G |
data |
3、操作系统配置部分
3.1 配置hosts文件
Vi /etc/hosts
192.168.1.189 GNS 192.168.1.191 rac1.li.com rac1 192.168.1.192 rac1-vip.li.com rac1-vip 10.1.1.191 rac1-pri1.li.com rac1-pri1 10.1.1.192 rac1-pri2.li.com rac1-pri2 192.168.1.193 rac2.li.com rac2 192.168.1.194 rac2-vip.li.com rac2-vip 10.1.1.193 rac2-pri1.li.com rac2-pri1 10.1.1.194 rac2-pri2.li.com rac2-pri2 192.168.1.195 rac-scan.li.com rac-scan 192.168.1.196 rac-scan.li.com rac-scan 192.168.1.197 rac-scan.li.com rac-scan |
3.2 安装RPM包
binutils-2.20.51.0.2-5.11.el6 (x86_64) compat-libcap1-1.10-1 (x86_64) compat-libstdc++-33-3.2.3-69.el6 (x86_64) compat-libstdc++-33-3.2.3-69.el6 (i686) gcc-4.4.4-13.el6 (x86_64) gcc-c++-4.4.4-13.el6 (x86_64) glibc-2.12-1.7.el6 (i686) glibc-2.12-1.7.el6 (x86_64) glibc-devel-2.12-1.7.el6 (x86_64) glibc-devel-2.12-1.7.el6 (i686) ksh libgcc-4.4.4-13.el6 (i686) libgcc-4.4.4-13.el6 (x86_64) libstdc++-4.4.4-13.el6 (x86_64) libstdc++-4.4.4-13.el6 (i686) libstdc++-devel-4.4.4-13.el6 (x86_64) libstdc++-devel-4.4.4-13.el6 (i686) libaio-0.3.107-10.el6 (x86_64) libaio-0.3.107-10.el6 (i686) libaio-devel-0.3.107-10.el6 (x86_64) libaio-devel-0.3.107-10.el6 (i686) libXext-1.1 (x86_64) libXext-1.1 (i686) libXtst-1.0.99.2 (x86_64) libXtst-1.0.99.2 (i686) libX11-1.3 (x86_64) libX11-1.3 (i686) libXau-1.0.5 (x86_64) libXau-1.0.5 (i686) libxcb-1.5 (x86_64) libxcb-1.5 (i686) libXi-1.3 (x86_64) libXi-1.3 (i686) make-3.81-19.el6 sysstat-9.0.4-11.el6 (x86_64) unixODBC.x86_64 0:2.2.14-12.el6_3
|
3.3创建用户组
#/usr/sbin/groupadd –g 501 oinstall
#/usr/sbin/groupadd –g 502dba
#/usr/sbin/groupadd –g 503oper
#/usr/sbin/groupadd –g 504asmadmin
#/usr/sbin/groupadd –g 505asmdba
#/usr/sbin/groupadd –g 506 asmoper
#/usr/sbin/useradd –u 501 –g oinstall –G asmadmin,asmdba,asmoper grid
#/usr/sbin/useradd –u 502 –goinstall –G dba,asmdba oracle
passwd oracle
passwd grid
3.4 创建文件目录及权限配置
--this is the GI ORACLE_BASE
#mkdir -p /dba/app/12.2.0/grid
--this is the ORACLE_HOME FOR GI
--this is the RDBMS ORACLE_BASE
#mkdir -p /dba/app/oracle/product/12.2.0/db_1
--this is the RDBMSORACLE_HOME
#mkdir -p /dba/app/oraInventory
--this is oraInventory location
#chown -R grid:oinstall/dba/app
#chown -Roracle:oinstall /dba/app/oracle
3.5 配置环境变量
#su – grid
$vi .bash_profile
export TMPDIR=$TMP export ORACLE_BASE=/dba/app/grid export ORACLE_HOME=/dba/app/12.2.0/grid export ORACLE_SID=+ASM1 export PATH=/usr/sbin:$PATH 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
alias sqlplus="rlwrap sqlplus" |
$source .bash_profile
#su – oracle
$vi .bash_profile
export TMP=/tmp export TMPDIR=$TMP export ORACLE_BASE=/dba/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1 export ORACLE_SID=naridb export PATH=/usr/sbin:$PATH 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
alias sqlplus="rlwrap sqlplus" alias rman="rlwrap rman" |
3.6 安装cvuqdisk
cvuqdisk存于oracle GI安装介质的cv/rpm目录下
export CVUQDISK_GRP=asmadmin
rpm –ivh cvuqdisk-1.0.10-1.rpm
4、修改操作系统配置
4.1 开启nscd
#chkconfig nscd on
4.2 关闭防火墙
#chkconfig ip6tables off
#service iptables stop
#service ip6tables stop
4.3 禁用selinux
修改/etc/selinux/config
编辑文本中的SELINUX=enforcing为SELINUX=disabled
4.4 关闭TransparentHugePages
(1)查看验证transparent_hugepage的状态
cat/sys/kernel/mm/redhat_transparent_hugepage/enabled
always madvise [never] 结果为never表示关闭
(2)关闭transparent_hugepage的配置
#vi /etc/rc.local #注释:编辑rc.local文件,增加以下内容 if test -f /sys/kernel/mm/redhat_transparent_hugepage/enabled; then echo never > /sys/kernel/mm/redhat_transparent_hugepage/enabled fi |
4.5 配置/etc/security/limits.conf
grid hard nproc 16384 grid soft nofile 1024 grid hard nofile 65536 grid soft stack 10240 grid hard stack 32768
oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 oracle hard stack 32768 |
4.6 配置/etc/sysctl.conf
增加以下内容
fs.file-max = 6815744 kernel.shmall = 67108864 kernel.shmmax = 274877906944 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.ipv4.tcp_rmem = 4096 87380 4194304 net.ipv4.tcp_wmem = 4096 16384 4194304 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 net.ipv4.conf.eth2.rp_filter = 2 net.ipv4.conf.eth1.rp_filter = 2 net.ipv4.conf.eth0.rp_filter = 1 |
针对rp_filter部分,如果没有多张私有网卡,则不需要配置,文档 ID1286796.1有描述。
4.7 配置/etc/pam.d/login
增加以下内容:
session required pam_limits.so |
4.8 配置DNS
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
配置了/etc/resolv.conf还要在/etc/sysconfig/network-scripts/ifcfg-eth0中增加DNS1=192.168.1.190的原因是,如果不配置后者,在OS重启后,resolv.conf中配置的nameserver信息会自动丢失
4.9 修改时间同步方式
(1)vi/etc/ntp.conf
#增加下面内容 Server 192.168.1.190 |
(2)Vi /etc/sysconfig/ntpd
OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -g" 修改成 OPTIONS="-x -u ntp:ntp -p /var/run/ntpd.pid -g" |
#chkconfig ntpd on
#service ntpd restart
4.10 修改nsswitch.conf
nsswitch.conf保存的是域名检索顺序。在一些系统配置中,NIS(Network Information System)可能会引起SCAN域名解析异常。为了避免这种问题的发生,对nsswitch.conf做如下调整。
修改行 hosts: files dns 为 hosts: files dns nis |
4.10 配置NOZEROCONF
vi /etc/sysconfig/network增加以下内容
4.11 配置互信
方法:使用sshUserSetup.sh快速创建互信
sshUserSetup.sh在GI安装介质解压缩后的oui/prov/resources/scripts目录下。
下面两条命令在一个节点上执行即可(可以在root用户下执行):
#./sshUserSetup.sh -user grid -hosts "rac2 rac1" -advanced -exverify –confirm
#./sshUserSetup.sh -user oracle -hosts "rac2 rac1" -advanced -exverify -confirm |
5、ASM磁盘配置部分
5.1 UDEV配置asm磁盘(两个节点都执行)
(1)查出两个磁盘的UUID
[[email protected] ~]# /sbin/scsi_id -g -u -d /dev/sdb
36000c29a206f9c0ff78ea1f8b17f4c68
[[email protected] ~]# /sbin/scsi_id-g -u -d /dev/sdc
36000c293dee9cf6e31fe7eeaf2f5bba7
(2)vi/etc/udev/rules.d/99-oracle-asmdevices.rules
KERNEL=="sdb", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c29a206f9c0ff78ea1f8b17f4c68", NAME="asm-diskb", OWNER="grid", GROUP="asmadmin", MODE="0660" KERNEL=="sdc", BUS=="scsi", PROGRAM=="/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/$name", RESULT=="36000c293dee9cf6e31fe7eeaf2f5bba7", NAME="asm-diskc", OWNER="grid", GROUP="asmadmin", MODE="0660" |
(3)重启UDEV
# /sbin/udevadm control --reload-rules
5.2 验证asm disk生成
查询asm磁盘是否生成
#cd /dev
#ls –l asm*
[[email protected] dev]# ls -l asm*
brw-rw---- 1 grid asmadmin 8,17 Feb 22 06:35 asm-disk1
brw-rw---- 1 grid asmadmin 8,33 Feb 22 06:35 asm-disk2
5.2 修改磁盘属性
(1)修改磁盘属性
#echo deadline >/sys/block/sdb/queue/scheduler
#echo deadline > /sys/block/sdc/queue/scheduler
(2)验证属性修改结果:
[[email protected] dev]# more /sys/block/sdb/queue/scheduler
noop anticipatory [deadline]cfq
[[email protected] dev]# more /sys/block/sdc/queue/scheduler
noop anticipatory [deadline]cfq
6、grid软件安装
6.1 检测安装环境
--全面检查:
./runcluvfy.sh stage -precrsinst -n rac1,rac2 -verbose
--检查网络和等效性
./runcluvfy.sh comp nodecon -nrac1,rac2 -verbose
[[email protected] grid]$ ./runcluvfy.sh comp nodecon -n rac1,rac2 -verbose
Verifying Node Connectivity ... Verifying Hosts File ... Node Name Status ------------------------------------ ------------------------ rac1 passed rac2 passed Verifying Hosts File ...PASSED
Interface information for node "rac1"
Name IP Address Subnet Gateway Def. Gateway HW Address MTU ------ --------------- --------------- --------------- --------------- ----------------- ------ eth0 192.168.2.191 192.168.2.0 0.0.0.0 192.168.2.2 00:0C:29:7E:7E:8E 1500 eth1 10.1.1.191 10.1.1.0 0.0.0.0 192.168.2.2 00:0C:29:7E:7E:98 1500 eth2 10.1.1.192 10.1.1.0 0.0.0.0 192.168.2.2 00:0C:29:7E:7E:A2 1500
Interface information for node "rac2"
Name IP Address Subnet Gateway Def. Gateway HW Address MTU ------ --------------- --------------- --------------- --------------- ----------------- ------ eth0 192.168.2.193 192.168.2.0 0.0.0.0 192.168.2.2 00:0C:29:4D:85:CF 1500 eth1 10.1.1.193 10.1.1.0 0.0.0.0 192.168.2.2 00:0C:29:4D:85:D9 1500 eth2 10.1.1.194 10.1.1.0 0.0.0.0 192.168.2.2 00:0C:29:4D:85:E3 1500
Node Name IP Address Subnet MTU -------- ------- ------------ ------------ ------------- rac1 eth0 192.168.2.191 192.168.2.0 1500 rac2 eth0 192.168.2.193 192.168.2.0 1500
Node Name IP Address Subnet MTU -------- -------- ------------ ------------ ------------ rac1 eth1 10.1.1.191 10.1.1.0 1500 rac1 eth2 10.1.1.192 10.1.1.0 1500 rac2 eth1 10.1.1.193 10.1.1.0 1500 rac2 eth2 10.1.1.194 10.1.1.0 1500 Verifying Check that maximum (MTU) size packet goes through subnet ...PASSED Verifying Node Connectivity ...PASSED Verifying Multicast check ...PASSED
Verification of node connectivity was successful.
CVU operation performed: node connectivity Date: Feb 22, 2016 8:17:50 PM CVU home: /dba/soft/grid/ User: grid |
6.2 安装GI(Grid Infrastructure)
./gridSetup.sh
Scan name需要和/etc/hosts中的scan名称一致,否则会报下面错误:
ins-40718 single client accessname(scan):XXclustername could not be resolved
如果选择flex,必须3块磁盘,以及剩余空间36352MB以上,如下图所示:
[[email protected] tmp]$ crs_stat -t Name Type Target State Host ------------------------------------------------------------ ora....SM.lsnr ora....er.type ONLINE ONLINE rac1 ora....ER.lsnr ora....er.type ONLINE ONLINE rac1 ora....AF.lsnr ora....er.type OFFLINE OFFLINE ora....N1.lsnr ora....er.type ONLINE ONLINE rac2 ora....N2.lsnr ora....er.type ONLINE ONLINE rac1 ora....N3.lsnr ora....er.type ONLINE ONLINE rac1 ora.MGMTLSNR ora....nr.type ONLINE ONLINE rac1 ora.OCR_VOT.dg ora....up.type ONLINE ONLINE rac1 ora.asm ora.asm.type ONLINE ONLINE rac1 ora.cvu ora.cvu.type ONLINE ONLINE rac1 ora.gns ora.gns.type ONLINE ONLINE rac1 ora.gns.vip ora....ip.type ONLINE ONLINE rac1 ora.ioserver ora....er.type OFFLINE OFFLINE ora.mgmtdb ora....db.type ONLINE ONLINE rac1 ora....network ora....rk.type ONLINE ONLINE rac1 ora.ons ora.ons.type ONLINE ONLINE rac1 ora.proxy_advm ora....vm.type OFFLINE OFFLINE ora.qosmserver ora....er.type ONLINE ONLINE rac1 ora....C1.lsnr application ONLINE ONLINE rac1 ora.rac1.ons application ONLINE ONLINE rac1 ora.rac1.vip ora....t1.type ONLINE ONLINE rac1 ora....C2.lsnr application ONLINE ONLINE rac2 ora.rac2.ons application ONLINE ONLINE rac2 ora.rac2.vip ora....t1.type ONLINE ONLINE rac2 ora.scan1.vip ora....ip.type ONLINE ONLINE rac2 ora.scan2.vip ora....ip.type ONLINE ONLINE rac1 ora.scan3.vip ora....ip.type ONLINE ONLINE rac1 |
7 、asmca创建其它asmdiskgroup
8、database软件安装
#su – oracle
$./runInstaller
按照上图提示,在两个节点上分别执行:
./dba/app/oracle/product/12.2.0/db_1/root.sh
9、创建CDB
#su - oracle
$dbca
查看创建的容器数据库:
SQL> select name,cdb from v$database;
NAME CDB
--------- ---
LITESTDB YES
查看存在的插拨数据库:
SQL> col pdb_name for a30
SQL> selectpdb_id,pdb_name,dbid,status,creation_scn from dba_pdbs;
PDB_ID PDB_NAME DBID STATUS CREATION_SCN
------ --------------------------- ---------- -----------
2 PDB$SEED 33618433 NORMAL 2717802
10、创建PDB
10.1 以命令方式创建PDB
$sqlplus “/as sysdba”
SQL> CREATE PLUGGABLEDATABASE lipdb
ADMIN USER lipdbdba IDENTIFIED BY lipdbdba
STORAGE (MAXSIZE 5G MAX_SHARED_TEMP_SIZE100M)
DEFAULT TABLESPACE tbs_pdb2 DATAFILE‘+DATA01‘ SIZE 100M AUTOEXTEND ON;
Pluggable database created.
10.2 查看创建成功的PDB
SQL> col pdb_name for a30
SQL> selectpdb_id,pdb_name,dbid,status,creation_scn from dba_pdbs;
PDB_ID PDB_NAME DBID STATUS CREATION_SCN
------ --------- ------------------ ------------
3 LIPDB 182063881 NEW 3294239
2 PDB$SEED 33618433 NORMAL 2717802
以上是关于ORACLE 12C R2 RAC实战首发的主要内容,如果未能解决你的问题,请参考以下文章