您好,登录后才能下订单哦!
Oracle 中的12C新特性-容器数据库
---12.1.0.2_GI_RAC_Create_CDB_Blog
安装两个节点的 12.1.0.2 GI/RAC ,创建 CDB 数据库。
vim /etc/selinux/config * Change the SELINUX value to "SELINUX=disabled". 另外,关闭OS iptable等服务 service NetworkManager stop service iptables stop chkconfig NetworkManager off chkconfig iptables off
cat /etc/hosts # vastdata11 192.168.56.11 vastdata11.us.oracle.com vastdata11 192.168.56.21 vastdata11-vip.us.oracle.com vastdata11-vip 10.0.0.2 vastdata11-priv1.us.oracle.com vastdata11-priv1 10.0.0.3 vastdata11-priv2.us.oracle.com vastdata11-priv2 # vastdata12 192.168.56.12 vastdata12.us.oracle.com vastdata12 192.168.56.22 vastdata12-vip.us.oracle.com vastdata12-vip 10.0.0.4 vastdata12-priv1.us.oracle.com vastdata12-priv1 10.0.0.5 vastdata12-priv2.us.oracle.com vastdata12-priv2 # rac-scan 192.168.56.33 vastdata-scan.us.oracle.com vastdata-scan 192.168.56.34 vastdata-scan.us.oracle.com vastdata-scan 192.168.56.35 vastdata-scan.us.oracle.com vastdata-scan
Oracle Linux 6 and Red Hat Linux 6 需要安装下面系统RPM包, 其他OS版本请参考在线文档: http://docs.oracle.com/database/121/CWLIN/prelinux.htm#CEGCECCC
配置YUM源
cd /etc/yum.repos.d/ cat yum.repo [oel6] name=OEL6.5 baseurl=file:///media/OL6.5\ x86_64\ Disc\ 1\ 20131125 gpgcheck=0 enabled=1
安装RPM包
yum install binutils compat-libcap1 compat-libstdc++-33 iptraf gcc gcc-c++ glibc-devel glibc elfutils-libelf-devel compat-libcap1 compat-libstdc++-33 libaio-devel ksh libgcc libstdc libstdc++ libstdc++-devel libaio libaio-devel make sysstat unixODBC unixODBC-devel -y yum install binutils-2.20.51.0.2-5.11.el6 compat-libcap1-1.10-1 compat-libstdc++-33-3.2.3-69.el6 compat-libstdc++-33-3.2.3-69.el6.i686 gcc-4.4.4-13.el6 gcc-c++-4.4.4-13.el6 glibc-2.12-1.7.el6 glibc-2.12-1.7.el6 glibc-devel-2.12-1.7.el6 glibc-devel-2.12-1.7.el6.i686 ksh libgcc-4.4.4-13.el6 libgcc-4.4.4-13.el6 libstdc++-4.4.4-13.el6 libstdc++-4.4.4-13.el6.i686 libstdc++-devel-4.4.4-13.el6 libstdc++-devel-4.4.4-13.el6.i686 libaio-0.3.107-10.el6 libaio-0.3.107-10.el6.i686 libaio-devel-0.3.107-10.el6 libaio-devel-0.3.107-10.el6.i686 libXext-1.1 libXext-1.1 libXtst-1.0.99.2 libXtst-1.0.99.2 libX11-1.3 libX11-1.3 libXau-1.0.5 libXau-1.0.5 libxcb-1.5 libxcb-1.5 libXi-1.3 libXi-1.3 make-3.81-19.el6 sysstat-9.0.4-11.el6 nfs-utils-1.2.3-15.0.1 -y
设置/etc/security/limits.conf,详细参考在线文档:
http://docs.oracle.com/database/121/LADBI/usr_grps.htm#LADBI7674
oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft stack 10240 oracle hard stack 10240 grid soft nproc 2047 grid hard nproc 16384 grid soft nofile 1024 grid hard nofile 65536 grid soft stack 10240 grid hard stack 10240
groupadd -g 54321 oinstall groupadd -g 54322 dba groupadd -g 54328 asmadmin groupadd -g 54325 asmdba useradd -u 54322 -g oinstall -G asmadmin,asmdba grid useradd -u 54321 -g oinstall -G dba,asmdba oracle echo "oracle" | passwd --stdin oracle echo "grid" | passwd --stdin grid
--创建 GRID_BASE mkdir -p /u01/app/grid --创建 GRID_HOME mkdir -p /u01/12.1.0/grid chown -R grid:oinstall /u01 chmod -R 775 /u01/ chmod -R 775 /u01/12.1.0/grid --创建 ORACLE_BASE mkdir -p /u01/app/oracle chown oracle:oinstall /u01/app/oracle chmod -R 775 /u01/
GRID环境变量 export TMP=/tmp export TMPDIR=$TMP export ORACLE_HOSTNAME=vastdata11.us.oracle.com export ORACLE_SID=+ASM1 export ORACLE_BASE=/u01/app/grid export ORACLE_HOME=/u01/12.1.0/grid export NLS_DATE_FORMAT="yy-mm-dd hh34:mi:ss" export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK umask 022 ------------------------------------------------------------------------------- ORACLE环境变量 export TMP=/tmp export TMPDIR=$TMP export ORACLE_HOSTNAME=vastdata11.us.oracle.com export ORACLE_BASE=/u01/app/oracle export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1 export ORACLE_UNQNAME=PROD export ORACLE_SID=PROD1 export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib export NLS_DATE_FORMAT="yyyy-mm-dd hh34:mi:ss" export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK umask 022
vim /etc/sysconfig/network-scripts/ifcfg-eth3 DEVICE=eth3 IPADDR=10.0.0.2 NETMASK=255.255.255.0 TYPE=Ethernet NM_CONTROLLED=yes USERCTL=no BOOTPROTO=none ONBOOT=yes
modprobe --first-time bonding lsmod | grep bonding
vim /etc/sysconfig/network-scripts/ifcfg-bond0 DEVICE=bond0 TYPE=Bond IPADDR=192.168.56.11 NETMASK=255.255.255.0 USERCTL=no BOOTPROTO=none ONBOOT=yes BONDING_MASTER=yes BONDING_OPTS="mode=0 miimon=100" vim /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 USERCTL=no ONBOOT=yes MASTER=bond0 SLAVE=yes BOOTPROTO=none vim /etc/sysconfig/network-scripts/ifcfg-eth2 DEVICE=eth2 USERCTL=no ONBOOT=yes MASTER=bond0 SLAVE=yes BOOTPROTO=none vim /etc/modprobe.d/dist.conf alias bond0 bonding options bonding miimon=100 mode=0
service network restart cat /proc/net/bonding/bond0 ifconfig
yum install bind bind-chroot -y cp -p /etc/named.conf /etc/named.conf.bak vim /etc/named.conf // // named.conf // // Provided by Red Hat bind package to configure the ISC BIND named(8) DNS // server as a caching only nameserver (as a localhost DNS resolver only). // // See /usr/share/doc/bind*/sample/ for example named configuration files. // options { listen-on port 53 { any; }; directory "/var/named"; allow-query { any; }; allow-query-cache { any; }; recursion no; }; zone "." IN { type hint; file "named.ca"; }; zone "us.oracle.com" IN { type master; file "us.oracle.com.zone"; }; zone "56.168.192.in-addr.arpa" IN { type master; file "192.168.56.local"; }; cd /var/named/ cp -p named.localhost us.oracle.com.zone cp -p us.oracle.com.zone 192.168.56.local vim /var/named/us.oracle.com.zone $TTL 1D @ IN SOA vastdata11.us.oracle.com. root.us.oracle.com. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum NS dns.us.oracle.com. vastdata11 A 192.168.56.11 vastdata12 A 192.168.56.12 vastdata-scan A 192.168.56.33 vastdata-scan A 192.168.56.34 vastdata-scan A 192.168.56.35 dns A 192.168.56.44 vastdata11-vip A 192.168.56.21 vastdata12-vip A 192.168.56.22 vastdata11-priv1 A 10.0.0.2 vastdata11-priv2 A 10.0.0.3 vastdata12-priv1 A 10.0.0.4 vastdata12-priv2 A 10.0.0.5 vim /var/named/192.168.56.local $TTL 1D @ IN SOA vastdata11.us.oracle.com. root.us.oracle.com. ( 0 ; serial 1D ; refresh 1H ; retry 1W ; expire 3H ) ; minimum IN NS dns.us.oracle.com. 11 IN PTR vastdata11.us.oracle.com. 12 IN PTR vastdata12.us.oracle.com. 33 IN PTR vastdata-scan.us.oracle.com. 34 IN PTR vastdata-scan.us.oracle.com. 35 IN PTR vastdata-scan.us.oracle.com. 44 IN PTR dns 21 IN PTR vastdata11-vip.us.oracle.com. 22 IN PTR vastdata12-vip.us.oracle.com. service network restart service named restart chkconfig named on chkconfig named --list ----------------------------------------------- nslookup vastdata-scan.us.oracle.com
cd /etc/ vim named.conf options { directory "/var/named"; allow-query { any; }; recursion no; }; zone "us.oracle.com" IN { type slave; file "slave/us.oracle.com.zone"; masters { 192.168.56.11; }; allow-transfer { none; }; }; zone "56.168.192.in-addr.arpa" IN { type slave; file "slave/192.168.56.rev"; masters { 192.168.56.11; }; }; CLIENT DNS配置 vim /etc/resolv.conf nameserver 192.168.56.11 service named restart nslookup vastdata-scan.us.oracle.com
第一种:使用 udev 第二种:使用 asmlib ------------------------------------------------------------------------------- --首先OS层面配置disk fdisk /dev/sdb --配置后的disk信息: ls -l /dev/sd* --标记新加卷组 vim 1.sh for i in b c d ; do echo "KERNEL==\"sd*\", BUS==\"scsi\", PROGRAM==\"/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/\$name\", RESULT==\"`/sbin/scsi_id --whitelisted --replace-whitespace --device=/dev/sd$i`\", NAME=\"asm-disk$i\", OWNER=\"grid\", GROUP=\"asmadmin\", MODE=\"0660\"" >> /etc/udev/rules.d/99-oracle-asmdevices.rules done chmod +x 1.sh ./1.sh cat /etc/udev/rules.d/99-oracle-asmdevices.rules start_udev ls -al /dev/asm-disk*
(root、grid、oracle,这三个用户都需要配置互信,以及与自己配置互信)
ssh-keygen -t rsa cd /root/.ssh/ cat id_rsa.pub >> authorized_keys service sshd restart
在主DNS服务器重启后则变成active,否则就是观望者(observer)
关闭两台机器的时间同步功能:
rm -rf /etc/ntp.conf rm -rf /etc/sysconfig/ntpd
运行 CVU 检查系统配置是否满足条件,在运行 CVU 之前需要手动配置 SSH
./runcluvfy.sh stage -pre crsinst -n vastdata11,vastdata12 -fixup -verbose
export DISPLAY=192.168.56.1:1.0 xhost +
再次检查
忽略可ignore的warning
[grid@vastdata11 ~]$ crsctl stat res -t -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATA.dg ONLINE ONLINE vastdata11 STABLE ONLINE ONLINE vastdata12 STABLE ora.LISTENER.lsnr ONLINE ONLINE vastdata11 STABLE ONLINE ONLINE vastdata12 STABLE ora.asm ONLINE ONLINE vastdata11 Started,STABLE ONLINE ONLINE vastdata12 Started,STABLE ora.net1.network ONLINE ONLINE vastdata11 STABLE ONLINE ONLINE vastdata12 STABLE ora.ons ONLINE ONLINE vastdata11 STABLE ONLINE ONLINE vastdata12 STABLE -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE vastdata12 STABLE ora.LISTENER_SCAN2.lsnr 1 ONLINE ONLINE vastdata11 STABLE ora.LISTENER_SCAN3.lsnr 1 ONLINE ONLINE vastdata11 STABLE ora.MGMTLSNR 1 ONLINE ONLINE vastdata11 169.254.62.144 10.0. 0.2 10.0.0.2,STABLE ora.cvu 1 ONLINE ONLINE vastdata11 STABLE ora.mgmtdb 1 ONLINE ONLINE vastdata11 Open,STABLE ora.oc4j 1 ONLINE ONLINE vastdata11 STABLE ora.scan1.vip 1 ONLINE ONLINE vastdata12 STABLE ora.scan2.vip 1 ONLINE ONLINE vastdata11 STABLE ora.scan3.vip 1 ONLINE ONLINE vastdata11 STABLE ora.vastdata11.vip 1 ONLINE ONLINE vastdata11 STABLE ora.vastdata12.vip 1 ONLINE ONLINE vastdata12 STABLE -------------------------------------------------------------------------------- [grid@vastdata11 ~]$ crsctl stat res -t -init -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.asm 1 ONLINE ONLINE vastdata11 Started,STABLE ora.cluster_interconnect.haip 1 ONLINE ONLINE vastdata11 STABLE ora.crf 1 ONLINE ONLINE vastdata11 STABLE ora.crsd 1 ONLINE ONLINE vastdata11 STABLE ora.cssd 1 ONLINE ONLINE vastdata11 STABLE ora.cssdmonitor 1 ONLINE ONLINE vastdata11 STABLE ora.ctssd 1 ONLINE ONLINE vastdata11 ACTIVE:0,STABLE ora.diskmon 1 OFFLINE OFFLINE STABLE ora.drivers.acfs 1 ONLINE ONLINE vastdata11 STABLE ora.evmd 1 ONLINE ONLINE vastdata11 STABLE ora.gipcd 1 ONLINE ONLINE vastdata11 STABLE ora.gpnpd 1 ONLINE ONLINE vastdata11 STABLE ora.mdnsd 1 ONLINE ONLINE vastdata11 STABLE ora.storage 1 ONLINE ONLINE vastdata11 STABLE -------------------------------------------------------------------------------- [grid@vastdata12 ~]$ crsctl stat res -t -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATA.dg ONLINE ONLINE vastdata11 STABLE ONLINE ONLINE vastdata12 STABLE ora.LISTENER.lsnr ONLINE ONLINE vastdata11 STABLE ONLINE ONLINE vastdata12 STABLE ora.asm ONLINE ONLINE vastdata11 Started,STABLE ONLINE ONLINE vastdata12 Started,STABLE ora.net1.network ONLINE ONLINE vastdata11 STABLE ONLINE ONLINE vastdata12 STABLE ora.ons ONLINE ONLINE vastdata11 STABLE ONLINE ONLINE vastdata12 STABLE -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE vastdata12 STABLE ora.LISTENER_SCAN2.lsnr 1 ONLINE ONLINE vastdata11 STABLE ora.LISTENER_SCAN3.lsnr 1 ONLINE ONLINE vastdata11 STABLE ora.MGMTLSNR 1 ONLINE ONLINE vastdata11 169.254.62.144 10.0. 0.2 10.0.0.2,STABLE ora.cvu 1 ONLINE ONLINE vastdata11 STABLE ora.mgmtdb 1 ONLINE ONLINE vastdata11 Open,STABLE ora.oc4j 1 ONLINE ONLINE vastdata11 STABLE ora.scan1.vip 1 ONLINE ONLINE vastdata12 STABLE ora.scan2.vip 1 ONLINE ONLINE vastdata11 STABLE ora.scan3.vip 1 ONLINE ONLINE vastdata11 STABLE ora.vastdata11.vip 1 ONLINE ONLINE vastdata11 STABLE ora.vastdata12.vip 1 ONLINE ONLINE vastdata12 STABLE -------------------------------------------------------------------------------- [grid@vastdata12 ~]$ crsctl stat res -t -init -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.asm 1 ONLINE ONLINE vastdata12 Started,STABLE ora.cluster_interconnect.haip 1 ONLINE ONLINE vastdata12 STABLE ora.crf 1 ONLINE ONLINE vastdata12 STABLE ora.crsd 1 ONLINE ONLINE vastdata12 STABLE ora.cssd 1 ONLINE ONLINE vastdata12 STABLE ora.cssdmonitor 1 ONLINE ONLINE vastdata12 STABLE ora.ctssd 1 ONLINE ONLINE vastdata12 ACTIVE:0,STABLE ora.diskmon 1 OFFLINE OFFLINE STABLE ora.drivers.acfs 1 ONLINE ONLINE vastdata12 STABLE ora.evmd 1 ONLINE ONLINE vastdata12 STABLE ora.gipcd 1 ONLINE ONLINE vastdata12 STABLE ora.gpnpd 1 ONLINE ONLINE vastdata12 STABLE ora.mdnsd 1 ONLINE ONLINE vastdata12 STABLE ora.storage 1 ONLINE ONLINE vastdata12 STABLE --------------------------------------------------------------------------------
[grid@vastdata12 ~]$ crsctl stat res -t -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATA.dg ONLINE ONLINE vastdata11 STABLE ONLINE ONLINE vastdata12 STABLE ora.FRA.dg ONLINE ONLINE vastdata11 STABLE ONLINE ONLINE vastdata12 STABLE ora.LISTENER.lsnr ONLINE ONLINE vastdata11 STABLE ONLINE ONLINE vastdata12 STABLE ora.asm ONLINE ONLINE vastdata11 Started,STABLE ONLINE ONLINE vastdata12 Started,STABLE ora.net1.network ONLINE ONLINE vastdata11 STABLE ONLINE ONLINE vastdata12 STABLE ora.ons ONLINE ONLINE vastdata11 STABLE ONLINE ONLINE vastdata12 STABLE -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE vastdata12 STABLE ora.LISTENER_SCAN2.lsnr 1 ONLINE ONLINE vastdata11 STABLE ora.LISTENER_SCAN3.lsnr 1 ONLINE ONLINE vastdata11 STABLE ora.MGMTLSNR 1 ONLINE OFFLINE 169.254.67.242 10.0. 0.4,STABLE ora.cdb.db 1 ONLINE ONLINE vastdata11 Open,STABLE 2 ONLINE ONLINE vastdata12 Open,STABLE ora.cvu 1 ONLINE ONLINE vastdata11 STABLE ora.mgmtdb 1 ONLINE OFFLINE STABLE ora.oc4j 1 ONLINE ONLINE vastdata11 STABLE ora.scan1.vip 1 ONLINE ONLINE vastdata12 STABLE ora.scan2.vip 1 ONLINE ONLINE vastdata11 STABLE ora.scan3.vip 1 ONLINE ONLINE vastdata11 STABLE ora.vastdata11.vip 1 ONLINE ONLINE vastdata11 STABLE ora.vastdata12.vip 1 ONLINE ONLINE vastdata12 STABLE -------------------------------------------------------------------------------- [grid@vastdata12 ~]$ crsctl stat res -t -init -------------------------------------------------------------------------------- Name Target State Server State details -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.asm 1 ONLINE ONLINE vastdata12 Started,STABLE ora.cluster_interconnect.haip 1 ONLINE ONLINE vastdata12 STABLE ora.crf 1 ONLINE ONLINE vastdata12 STABLE ora.crsd 1 ONLINE ONLINE vastdata12 STABLE ora.cssd 1 ONLINE ONLINE vastdata12 STABLE ora.cssdmonitor 1 ONLINE ONLINE vastdata12 STABLE ora.ctssd 1 ONLINE ONLINE vastdata12 ACTIVE:0,STABLE ora.diskmon 1 OFFLINE OFFLINE STABLE ora.drivers.acfs 1 ONLINE ONLINE vastdata12 STABLE ora.evmd 1 ONLINE ONLINE vastdata12 STABLE ora.gipcd 1 ONLINE ONLINE vastdata12 STABLE ora.gpnpd 1 ONLINE ONLINE vastdata12 STABLE ora.mdnsd 1 ONLINE ONLINE vastdata12 STABLE ora.storage 1 ONLINE ONLINE vastdata12 STABLE --------------------------------------------------------------------------------
[oracle@vastdata11 ~]$ export ORACLE_SID=cdb1 [oracle@vastdata11 ~]$ sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Wed May 15 06:49:24 2019 Copyright (c) 1982, 2014, Oracle. All rights reserved. Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Advanced Analytics and Real Application Testing options SQL> SELECT NAME, CDB, CON_ID FROM V$DATABASE; NAME CDB CON_ID ------------------ ------ ---------- CDB YES 0 SQL> select name,cdb,con_id from v$database; NAME CDB CON_ID ------------------ ------ ---------- CDB YES 0 SQL> SELECT SYS_CONTEXT ('USERENV', 'CON_NAME') FROM DUAL; SYS_CONTEXT('USERENV','CON_NAME') -------------------------------------------------------------------------------- CDB$ROOT SQL> select sys_context('userenv','con_name') from dual; SYS_CONTEXT('USERENV','CON_NAME') -------------------------------------------------------------------------------- CDB$ROOT
SQL> alter pluggable database pdb open; alter pluggable database pdb open * ERROR at line 1: ORA-65019: pluggable database PDB already open SQL> alter session set container=pdb; Session altered.
SQL> col name format a15 SQL> set linesize 160 SQL> col pdb_name format a15 SQL> select con_id, dbid, guid, name , open_mode from v$pdbs; CON_ID DBID GUID NAME OPEN_MODE ---------- ---------- -------------------------------- --------------- -------------------- 3 3454107755 88EB774565FA4F12E0530B38A8C09990 PDB READ WRITE
至此,本次12C-CDB容器数据库部署完成。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。