20.创建ASM磁盘组
在安装GI集群软件的时候我们就配置过asm磁盘,现在我们还有一个disk分区没有加入到asm磁盘组中,我们通过asmca来实现
su - grid
运行命令asmca,我们看到下面配置向导。这里可以看到我们之前配置过的disk group,我们点击create后
来到这里,我们给disk group起个名字,选择redundancy External,勾选VOL3,我们ok一下
会有一个10秒的等待创建磁盘组,完成后提示成功。
这里我们就能看到有两个disk group了!!!退出即可。。
21.配置Oracle database
我们直接su - oracle,运行dbca命令来配置数据库
来到如下界面后,我们选择第一项集群模式,然后next
这个就不用考虑了,直接选择create a database,继续next
这个也是选择general purpose,继续next
配置类型选择admin-managed,Global database name和sid相同为test,最下面我们选择”select all“,然后next
这里我们还是选择默认推荐的配置,EM和amt都选择配置,继续next
把sys、system、dbsnmp都给一个相同的密码,这里你自己给吧!!然后next
这里我们选择用存储类型为asm,使用omf管理数据文件。
我们这里不选择闪回恢复区,我这里就不配置了,以后手动改spfile吧!!
装上sample schemas,以后就有数据可以测试玩一把了!! 继续next
这里我们字符集会有所设置,ZHS16GBK-GBK,国际字符集默认的就行。其它的选项卡没有特殊配置,在以后都可以去改spfile,我们继续next
这个是数据库的存储配置页面,我们看一下控制文件等等都要开始安装了,next
继续finish
等待吧,这个也是比较久的,我的SSD和cpu比较给力,速度基本上10分钟吧!!
安装完后,点击exit
我们就退出安装配置向导了!!!
22.检查
检查crs资源状态
[grid@rac2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.DATA.dg ora....up.type ONLINE ONLINE rac1
ora....ER.lsnr ora....er.type ONLINE ONLINE rac1
ora....N1.lsnr ora....er.type ONLINE ONLINE rac2
ora.OCRVOTI.dg ora....up.type ONLINE ONLINE rac1
ora.asm ora.asm.type ONLINE ONLINE rac1
ora.eons ora.eons.type ONLINE ONLINE rac1
ora.gsd ora.gsd.type OFFLINE OFFLINE
ora....network ora....rk.type ONLINE ONLINE rac1
ora.oc4j ora.oc4j.type ONLINE ONLINE rac1
ora.ons ora.ons.type ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application OFFLINE OFFLINE
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip ora....t1.type ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application OFFLINE OFFLINE
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip ora....t1.type ONLINE ONLINE rac2
ora....ry.acfs ora....fs.type ONLINE ONLINE rac1
ora.scan1.vip ora....ip.type ONLINE ONLINE rac2
ora.test.db ora....se.type ONLINE ONLINE rac1
我们看到ora.gsd、ora.RAC2.gsd是offline状态,其实两个进程对我们的数据库是没有任何影响的,我们把他们打开就行了
[grid@rac2 ~]$ srvctl status nodeapps -n rac2
-n option has been deprecated.
VIP rac2-vip is enabled
VIP rac2-vip is running on node: rac2
Network is enabled
Network is running on node: rac2
GSD is disabled
GSD is not running on node: rac2
ONS is enabled
ONS daemon is running on node: rac2
eONS is enabled
eONS daemon is running on node: rac2
[grid@rac2 ~]$ srvctl enable nodeapps
PRKO-2415 : VIP is already enabled on node(s): rac1,rac2
PRKO-2416 : Network resource is already enabled.
PRKO-2417 : ONS is already enabled on node(s): rac1,rac2
PRKO-2418 : eONS is already enabled on node(s): rac1,rac2
[grid@rac2 ~]$ srvctl status nodeapps
VIP rac1-vip is enabled
VIP rac1-vip is running on node: rac1
VIP rac2-vip is enabled
VIP rac2-vip is running on node: rac2
Network is enabled
Network is running on node: rac1
Network is running on node: rac2
GSD is enabled
GSD is not running on node: rac1
GSD is not running on node: rac2
ONS is enabled
ONS daemon is running on node: rac1
ONS daemon is running on node: rac2
eONS is enabled
eONS daemon is running on node: rac1
eONS daemon is running on node: rac2
[grid@rac2 ~]$ srvctl start nodeapps
PRKO-2421 : Network resource is already started on node(s): rac1,rac2
PRKO-2420 : VIP is already started on node(s): rac1,rac2
PRKO-2420 : VIP is already started on node(s): rac1,rac2
PRKO-2422 : ONS is already started on node(s): rac1,rac2
PRKO-2423 : eONS is already started on node(s): rac1,rac2
我们在来查看一下所有的组件是否online
[grid@rac2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.DATA.dg ora....up.type ONLINE ONLINE rac1
ora....ER.lsnr ora....er.type ONLINE ONLINE rac1
ora....N1.lsnr ora....er.type ONLINE ONLINE rac2
ora.OCRVOTI.dg ora....up.type ONLINE ONLINE rac1
ora.asm ora.asm.type ONLINE ONLINE rac1
ora.eons ora.eons.type ONLINE ONLINE rac1
ora.gsd ora.gsd.type ONLINE ONLINE rac1
ora....network ora....rk.type ONLINE ONLINE rac1
ora.oc4j ora.oc4j.type ONLINE ONLINE rac1
ora.ons ora.ons.type ONLINE ONLINE rac1
ora....SM1.asm application ONLINE ONLINE rac1
ora....C1.lsnr application ONLINE ONLINE rac1
ora.rac1.gsd application ONLINE ONLINE rac1
ora.rac1.ons application ONLINE ONLINE rac1
ora.rac1.vip ora....t1.type ONLINE ONLINE rac1
ora....SM2.asm application ONLINE ONLINE rac2
ora....C2.lsnr application ONLINE ONLINE rac2
ora.rac2.gsd application ONLINE ONLINE rac2
ora.rac2.ons application ONLINE ONLINE rac2
ora.rac2.vip ora....t1.type ONLINE ONLINE rac2
ora....ry.acfs ora....fs.type ONLINE ONLINE rac1
ora.scan1.vip ora....ip.type ONLINE ONLINE rac2
ora.test.db ora....se.type ONLINE ONLINE rac1
这里还要强调一下11.2.0.1版本的一个bug,就是客户端无法通过scan连接到数据库解决方法如下:
[oracle@rac2 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 19 11:29:58 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> show parameter local_listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string (DESCRIPTION=(ADDRESS_LIST=(AD
DRESS=(PROTOCOL=TCP)(HOST=rac2
-vip)(PORT=1521))))
SQL> show parameter remot_listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_dependencies_mode string TIMESTAMP
remote_listener string scan-cluster.localdomain:1521
remote_login_passwordfile string EXCLUSIVE
remote_os_authent boolean FALSE
remote_os_roles boolean FALSE
result_cache_remote_expiration integer 0
SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.192.173)(PORT = 1521))))' sid='test2';
System altered.
SQL> alter system set remote_listener='scan-cluster.localdomain:1521';
System altered.
SQL> alter system register;
System altered.
最后配置客户端tnsname.ora文件指向scan listener
# tnsnames.ora.rac2 Network Configuration File: /u01/app/11.2.0/grid/network/admin/tnsnames.ora.rac2
# Generated by Oracle configuration tools.
TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.192.173)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = test)
)
)
我们这里安装完毕。