大家都知道Oracle database 12cR2当前正式版并没有发布,当前网上所发布的但是ORACLE database 12cR2技术文档,大多是理论型的从ORACLE OWW会议上,及该会议流露出来的PPT上所摘抄下来,重新组织而发布的文档,对于实战应用操作文档,则较少甚至很难找到。
目录
1、ORACLE 12.2软硬件要求.3
1.1 硬件最低配置要求.3
1.2 ORACLE 12.2认证的OS软件版本.3
2、整体规划部分.3
2.1 IP地址规划.3
2.2 操作系统本地磁盘分区规划.4
2.3 共享存储与ASM磁盘组规划.4
3、操作系统配置部分.4
3.1 配置hosts文件.4
3.2 安装RPM包.5
3.3 创建用户组.6
3.4 创建文件目录及权限配置.6
3.5 配置环境变量.6
3.6 安装cvuqdisk7
4、修改操作系统配置.8
4.1 开启nscd8
4.2 关闭防火墙.8
4.3 禁用selinux8
4.4 关闭Transparent HugePages8
4.5 配置/etc/security/limits.conf8
4.6配置/etc/sysctl.conf9
4.7 配置/etc/pam.d/login9
4.8 配置DNS10
4.9 修改时间同步方式.10
4.11 修改nsswitch.conf10
4.12 配置NOZEROCONF11
4.13 配置互信.11
5、ASM磁盘配置部分.11
5.1 UDEV配置asm磁盘(两个节点都执行).11
5.2 验证asm disk生成.12
5.2 修改磁盘属性.12
6、grid软件安装.12
6.1 检测安装环境.12
6.2 安装GI(Grid Infrastructure).14
7 、asmca创建其它asmdiskgroup23
8、database软件安装.23
9、创建CDB28
10、创建PDB32
10.1 以命令方式创建PDB32
10.2 查看创建成功的PDB33
序号 |
组件 |
内存需求 |
1 |
Oracle Grid Infrastructure installations |
4GB以上 |
2 |
Oracle Database installations |
最小1GB,建议2GB以上 |
序号 |
组件 |
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 |
序号 |
所属 |
主机名称 |
用途 |
IP地址 |
1 |
GNS |
|
GNS |
192.168.1.190 |
2 |
Node1 |
rac1 |
public |
192.168.1.191 |
3 |
Node1 |
vip |
192.168.1.192 |
|
4 |
Node1 |
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 |
Node2 |
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 |
序号 |
分区名称 |
大小 |
用途说明 |
1 |
/boot |
200MB |
引导分区 |
2 |
/ |
12288MB(12G) |
根分区 |
3 |
swap |
6144MB |
最少4.7303GB以上 |
4 |
/dba |
44850MB |
oracle安装目录 |
序号 |
磁盘名称 |
Asm磁盘名称 |
磁盘组名称 |
大小 |
用途 |
1 |
sdb1 |
asm-diskb |
OCR_VOT |
10G |
OCR+VOTINGDISK |
2 |
sdc1 |
asm_diskc |
DATA01 |
30G |
data |
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 |
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
|
#/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
#mkdir -p /dba/app/grid
--this is the GI ORACLE_BASE
#mkdir -p /dba/app/12.2.0/grid
--this is the ORACLE_HOME FOR GI
#mkdir -p /dba/app/oracle
--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
#chmod -R 775 /dba/app
#su – grid
$vi .bash_profile
export TMP=/tmp 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 PATH 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" |
cvuqdisk存于oracle GI安装介质的cv/rpm目录下
export CVUQDISK_GRP=asmadmin
rpm –ivh cvuqdisk-1.0.10-1.rpm
#chkconfig nscd on
chkconfig --level 35 nscd on
service nscd start
#chkconfig iptables off
#chkconfig ip6tables off
#service iptables stop
#service ip6tables stop
修改/etc/selinux/config
编辑文本中的SELINUX=enforcing为SELINUX=disabled
(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 |
grid soft nproc 2047 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 |
增加以下内容
fs.aio-max-nr = 1048576 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有描述。
增加以下内容:
session required pam_limits.so |
#vi /etc/resolv.conf
nameserver192.168.1.190 |
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
DNS1=192.168.1.190 |
配置了/etc/resolv.conf还要在/etc/sysconfig/network-scripts/ifcfg-eth0中增加DNS1=192.168.1.190的原因是,如果不配置后者,在OS重启后,resolv.conf中配置的nameserver信息会自动丢失
(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
nsswitch.conf保存的是域名检索顺序。在一些系统配置中,NIS(Network Information System)可能会引起SCAN域名解析异常。为了避免这种问题的发生,对nsswitch.conf做如下调整。
#vi /etc/nsswitch.conf
修改行 hosts: files dns 为 hosts: files dns nis |
vi /etc/sysconfig/network增加以下内容
NOZEROCONF=yes |
方法:使用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 |
(1)查出两个磁盘的UUID
[root@rac1 ~]# /sbin/scsi_id -g -u -d /dev/sdb
36000c29a206f9c0ff78ea1f8b17f4c68
[root@rac1 ~]# /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
#/sbin/start_udev
查询asm磁盘是否生成
#cd /dev
#ls –l asm*
[root@rac2 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
(1)修改磁盘属性
#echo deadline >/sys/block/sdb/queue/scheduler
#echo deadline > /sys/block/sdc/queue/scheduler
(2)验证属性修改结果:
[root@rac1 dev]# more /sys/block/sdb/queue/scheduler
noop anticipatory [deadline]cfq
[root@rac1 dev]# more /sys/block/sdc/queue/scheduler
noop anticipatory [deadline]cfq
--全面检查:
./runcluvfy.sh stage -precrsinst -n rac1,rac2 -verbose
--检查网络和等效性
./runcluvfy.sh comp nodecon -nrac1,rac2 -verbose
[grid@rac1 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 |
./gridSetup.sh
Scan name需要和/etc/hosts中的scan名称一致,否则会报下面错误:
ins-40718 single client accessname(scan):XXclustername could not be resolved
如果选择flex,必须3块磁盘,以及剩余空间36352MB以上,如下图所示:
[grid@rac1 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 |
#su – oracle
$./runInstaller
按照上图提示,在两个节点上分别执行:
./dba/app/oracle/product/12.2.0/db_1/root.sh
#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
$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.
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