Oracle12CRACCDB数据库部署
Oracle 中的12C新特性-容器数据库
让客户满意是我们工作的目标,不断超越客户的期望值来自于我们对这个行业的热爱。我们立志把好的技术通过有效、简单的方式提供给客户,将通过不懈努力成为客户在信息化领域值得信任、有价值的长期合作伙伴,公司提供的服务项目有:申请域名、网络空间、营销软件、网站建设、茂南网站维护、网站推广。
---12.1.0.2_GI_RAC_Create_CDB_Blog
一、 安装前的准备
安装两个节点的 12.1.0.2 GI/RAC ,创建 CDB 数据库。
1. 关闭 SELINUX
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
2. 网络IP配置(HOSTS文件)
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
3. 安装OS系统RPM包
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
4. Ulimit 资源设置
设置/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
5. 添加用户组
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
6. 创建目录结构
--创建 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/
7. 配置oracle、grid用户环境变量
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
8. private- 配置私网
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
9. 绑定网卡-Bond
1) 加载bond功能
modprobe --first-time bonding lsmod | grep bonding
2) 配置网卡文件
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
3) 重启网卡服务
service network restart cat /proc/net/bonding/bond0 ifconfig
10. 配置解析服务器
1) 主域名解析服务器
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
2) 从域名解析服务器
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
11. 配置 ASM Disk
第一种:使用 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*
12. 配置互信
(root、grid、oracle,这三个用户都需要配置互信,以及与自己配置互信)
ssh-keygen -t rsa cd /root/.ssh/ cat id_rsa.pub >> authorized_keys service sshd restart
13. 时间同步功能
在主DNS服务器重启后则变成active,否则就是观望者(observer)
关闭两台机器的时间同步功能:
rm -rf /etc/ntp.conf rm -rf /etc/sysconfig/ntpd
14. CVU 检查
运行 CVU 检查系统配置是否满足条件,在运行 CVU 之前需要手动配置 SSH
./runcluvfy.sh stage -pre crsinst -n vastdata11,vastdata12 -fixup -verbose
二、 安装配置集群 GRID
1. 运行OUI
1) 运行 runInstaller
export DISPLAY=192.168.56.1:1.0 xhost +
2) 选择安装集群
3) 配置标准集群
4) 高级安装
5) 选择语言
6) 配置集群名和 SCAN
7) 选择节点信息
8) 配置测试 SSH
9)
配置网卡
10) 选择标准 ASM 存储
11) 创建 diskgroup
12) ASM Password
13) 配置失败隔离
14) 配置 EM
15) 配置 OS group
16) 配置GI安装目录和数据目录,以及oraInventory目录
17) 选择 root 脚本自动运行,如果不选择,那么按照 12c 之前的方法手动运行 root.sh
18) 前提检查
执行修复脚本
再次检查
忽略可ignore的warning
19) 总结
20) 开始安装,提示自动运行 root.sh 脚本
21) 继续配置集群
2. 资源状态
[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 --------------------------------------------------------------------------------
三、 安装/创建 Database
1. 运行 OUI/runInstaller
1)
运行 runInstaller
2) 忽略 update 配置
3) 只安装软件
4) 选择安装 RAC 数据库
5) 选择 RAC 节点
6) 选择语言
7) 选择版本
8) 选择 ORACLE_HOME
9) 配置 OS 组
10) 前提检查
11) 总结
12) 开始安装,并执行root.sh脚本
2. ASMCA创建磁盘组
3. DBCA 建库(CDB)
1)
运行 dbca
2) 创建数据库
3) 高级安装
4) 选择数据库类型是 RAC 类型, 配置类型是 Admin-Managed
5) 设置数据库名,并且选择创建 Container database
6) 选择节点
7) OEM 和 CVU 配置
8) 密码设置
9) 选择 ASM 存储
10) 在 CDB 数据库类型中, 默认所有组件都选择
11) 其他配置选项
12) 内存和字符集配置
13) 创建选项
14) 前提检查
15) 总结
16) 开始安装
4. 资源检查
[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 &n
文章名称:Oracle12CRACCDB数据库部署
标题URL:http://cdiso.cn/article/pdjgoi.html