今天是2014-02-19,在前段时间已经安装完rac,那么安装完成后,要做的就是验证Rac是否是正确安装以及如何启动与关闭Rac。今天开始学习Rac,再次记录一下笔记!
第一:验证RAC:
验证监听:
node 1:
SQL> show parameter local_listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string (ADDRESS=(PROTOCOL=TCP)(HOST=
192.168.4.114)(PORT=1521))
SQL> show parameter remote_listener
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_listener string rac-two-cluster-scan.grid.exam
ple.com:1521
SQL>
node 2:
SQL> show parameter local_listener
NAME TYPE VALUE
------------------------------------ ---------- ------------------------------
local_listener string (ADDRESS=(PROTOCOL=TCP)(HOST=
192.168.4.113)(PORT=1521))
SQL> show parameter remote_listener
NAME TYPE VALUE
------------------------------------ ---------- ------------------------------
remote_listener string rac-two-cluster-scan.grid.exam
ple.com:1521
SQL>
ple.com:1521
SQL> !lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-FEB-2014 20:54:52
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 19-FEB-2014 20:03:17
Uptime 0 days 0 hr. 51 min. 35 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/app/grid/diag/tnslsnr/rac-one/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.4.111)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.4.113)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "Rac" has 1 instance(s).
Instance "Rac2", status READY, has 1 handler(s) for this service...
Service "RacXDB" has 1 instance(s).
Instance "Rac2", status READY, has 1 handler(s) for this service...
The command completed successfully
SQL>
注:
LOCAL_LISTENER
Property | Description |
---|---|
Parameter type | String |
Syntax |
LOCAL_LISTENER = network_name
|
Default value |
(ADDRESS = (PROTOCOL=TCP)(HOST= hostname )(PORT=1521)) where hostname is
the network name of the local host. |
Modifiable | ALTER SYSTEM |
Basic | No |
LOCAL_LISTENER
specifies a network name that resolves to an address or address list of Oracle Net local listeners (that is, listeners that are running on the same machine as
this instance). The address or address list is specified in the TNSNAMES.ORA
file or other address repository as configured for your system.
REMOTE_LISTENER
Property | Description |
---|---|
Parameter type | String |
Syntax |
REMOTE_LISTENER = network_name
|
Default value | There is no default value. |
Modifiable | ALTER SYSTEM |
Basic | Yes |
REMOTE_LISTENER
specifies a network name that resolves to an address or address list of Oracle Net remote listeners (that is, listeners that are not running on the same machine
as this instance). The address or address list is specified in the TNSNAMES.ORA
file or other address repository as configured for your system.
也就是说:local_listener是单主机服务器本地监听,remote_listener是oracle网络远程监听器也就是scan vip的监听参数。
另外还可以手动将服务名动态注册到本地监听和远程监听上:alter system register;
查看Rac资源信息:
[grid@rac-two ~]$ crsctl status resource -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATADG.dg ONLINE ONLINE rac-one ONLINE ONLINE rac-two ora.GIDG.dg ONLINE ONLINE rac-one ONLINE ONLINE rac-two ora.LISTENER.lsnr ONLINE ONLINE rac-one ONLINE ONLINE rac-two ora.asm ONLINE ONLINE rac-one Started ONLINE ONLINE rac-two Started ora.gsd OFFLINE OFFLINE rac-one OFFLINE OFFLINE rac-two ora.net1.network ONLINE ONLINE rac-one ONLINE ONLINE rac-two ora.ons ONLINE ONLINE rac-one ONLINE ONLINE rac-two ora.registry.acfs ONLINE ONLINE rac-one ONLINE ONLINE rac-two -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE rac-two ora.LISTENER_SCAN2.lsnr 1 ONLINE ONLINE rac-one ora.LISTENER_SCAN3.lsnr 1 ONLINE ONLINE rac-one ora.cvu 1 ONLINE ONLINE rac-one ora.oc4j 1 ONLINE ONLINE rac-one ora.rac-one.vip 1 ONLINE ONLINE rac-one ora.rac-two.vip 1 ONLINE ONLINE rac-two ora.rac.db 1 ONLINE ONLINE rac-two Open 2 ONLINE ONLINE rac-one Open ora.scan1.vip 1 ONLINE ONLINE rac-two ora.scan2.vip 1 ONLINE ONLINE rac-one ora.scan3.vip 1 ONLINE ONLINE rac-one [grid@rac-two ~]$
关闭rac:
1、关闭数据库:
/u01/app/11.2.0/grid/bin/srvctl stop database -d Rac
2、查看数据库状态:
[root@rac-one ~]# /u01/app/11.2.0/grid/bin/srvctl status database -d Rac Instance Rac2 is not running on node rac-one Instance Rac1 is not running on node rac-two [root@rac-one ~]#
2、关闭Rac所有节点的asm以及集群:
[root@rac-one ~]# /u01/app/11.2.0/grid/bin/crsctl stop cluster -all CRS-2673: Attempting to stop ‘ora.crsd‘ on ‘rac-one‘ CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on ‘rac-one‘ CRS-2673: Attempting to stop ‘ora.LISTENER_SCAN2.lsnr‘ on ‘rac-one‘ CRS-2673: Attempting to stop ‘ora.LISTENER_SCAN3.lsnr‘ on ‘rac-one‘ CRS-2673: Attempting to stop ‘ora.oc4j‘ on ‘rac-one‘ CRS-2673: Attempting to stop ‘ora.LISTENER.lsnr‘ on ‘rac-one‘ CRS-2673: Attempting to stop ‘ora.cvu‘ on ‘rac-one‘ CRS-2673: Attempting to stop ‘ora.GIDG.dg‘ on ‘rac-one‘ CRS-2673: Attempting to stop ‘ora.registry.acfs‘ on ‘rac-one‘ CRS-2673: Attempting to stop ‘ora.DATADG.dg‘ on ‘rac-one‘ CRS-2677: Stop of ‘ora.cvu‘ on ‘rac-one‘ succeeded CRS-2677: Stop of ‘ora.LISTENER.lsnr‘ on ‘rac-one‘ succeeded CRS-2673: Attempting to stop ‘ora.rac-one.vip‘ on ‘rac-one‘ CRS-2677: Stop of ‘ora.LISTENER_SCAN3.lsnr‘ on ‘rac-one‘ succeeded CRS-2673: Attempting to stop ‘ora.scan3.vip‘ on ‘rac-one‘ CRS-2677: Stop of ‘ora.LISTENER_SCAN2.lsnr‘ on ‘rac-one‘ succeeded CRS-2673: Attempting to stop ‘ora.scan2.vip‘ on ‘rac-one‘ CRS-2673: Attempting to stop ‘ora.crsd‘ on ‘rac-two‘ CRS-2677: Stop of ‘ora.scan3.vip‘ on ‘rac-one‘ succeeded CRS-2677: Stop of ‘ora.rac-one.vip‘ on ‘rac-one‘ succeeded CRS-2790: Starting shutdown of Cluster Ready Services-managed resources on ‘rac-two‘ CRS-2677: Stop of ‘ora.scan2.vip‘ on ‘rac-one‘ succeeded CRS-2673: Attempting to stop ‘ora.LISTENER.lsnr‘ on ‘rac-two‘ CRS-2673: Attempting to stop ‘ora.LISTENER_SCAN1.lsnr‘ on ‘rac-two‘ CRS-2673: Attempting to stop ‘ora.GIDG.dg‘ on ‘rac-two‘ CRS-2673: Attempting to stop ‘ora.registry.acfs‘ on ‘rac-two‘ CRS-2673: Attempting to stop ‘ora.DATADG.dg‘ on ‘rac-two‘ CRS-2677: Stop of ‘ora.registry.acfs‘ on ‘rac-one‘ succeeded CRS-2677: Stop of ‘ora.LISTENER_SCAN1.lsnr‘ on ‘rac-two‘ succeeded CRS-2673: Attempting to stop ‘ora.scan1.vip‘ on ‘rac-two‘ CRS-2677: Stop of ‘ora.LISTENER.lsnr‘ on ‘rac-two‘ succeeded CRS-2673: Attempting to stop ‘ora.rac-two.vip‘ on ‘rac-two‘ CRS-2677: Stop of ‘ora.scan1.vip‘ on ‘rac-two‘ succeeded CRS-2677: Stop of ‘ora.rac-two.vip‘ on ‘rac-two‘ succeeded CRS-2677: Stop of ‘ora.registry.acfs‘ on ‘rac-two‘ succeeded CRS-2677: Stop of ‘ora.DATADG.dg‘ on ‘rac-two‘ succeeded CRS-2677: Stop of ‘ora.GIDG.dg‘ on ‘rac-two‘ succeeded CRS-2673: Attempting to stop ‘ora.asm‘ on ‘rac-two‘ CRS-2677: Stop of ‘ora.asm‘ on ‘rac-two‘ succeeded CRS-2673: Attempting to stop ‘ora.ons‘ on ‘rac-two‘ CRS-2677: Stop of ‘ora.ons‘ on ‘rac-two‘ succeeded CRS-2673: Attempting to stop ‘ora.net1.network‘ on ‘rac-two‘ CRS-2677: Stop of ‘ora.net1.network‘ on ‘rac-two‘ succeeded CRS-2792: Shutdown of Cluster Ready Services-managed resources on ‘rac-two‘ has completed CRS-2677: Stop of ‘ora.DATADG.dg‘ on ‘rac-one‘ succeeded CRS-2677: Stop of ‘ora.GIDG.dg‘ on ‘rac-one‘ succeeded CRS-2673: Attempting to stop ‘ora.asm‘ on ‘rac-one‘ CRS-2677: Stop of ‘ora.asm‘ on ‘rac-one‘ succeeded CRS-2677: Stop of ‘ora.crsd‘ on ‘rac-two‘ succeeded CRS-2673: Attempting to stop ‘ora.ctssd‘ on ‘rac-two‘ CRS-2673: Attempting to stop ‘ora.evmd‘ on ‘rac-two‘ CRS-2673: Attempting to stop ‘ora.asm‘ on ‘rac-two‘ CRS-2677: Stop of ‘ora.evmd‘ on ‘rac-two‘ succeeded CRS-2677: Stop of ‘ora.ctssd‘ on ‘rac-two‘ succeeded CRS-2677: Stop of ‘ora.oc4j‘ on ‘rac-one‘ succeeded CRS-2673: Attempting to stop ‘ora.ons‘ on ‘rac-one‘ CRS-2677: Stop of ‘ora.ons‘ on ‘rac-one‘ succeeded CRS-2673: Attempting to stop ‘ora.net1.network‘ on ‘rac-one‘ CRS-2677: Stop of ‘ora.net1.network‘ on ‘rac-one‘ succeeded CRS-2792: Shutdown of Cluster Ready Services-managed resources on ‘rac-one‘ has completed CRS-2677: Stop of ‘ora.crsd‘ on ‘rac-one‘ succeeded CRS-2673: Attempting to stop ‘ora.ctssd‘ on ‘rac-one‘ CRS-2673: Attempting to stop ‘ora.evmd‘ on ‘rac-one‘ CRS-2673: Attempting to stop ‘ora.asm‘ on ‘rac-one‘ CRS-2677: Stop of ‘ora.asm‘ on ‘rac-two‘ succeeded CRS-2673: Attempting to stop ‘ora.cluster_interconnect.haip‘ on ‘rac-two‘ CRS-2677: Stop of ‘ora.evmd‘ on ‘rac-one‘ succeeded CRS-2677: Stop of ‘ora.cluster_interconnect.haip‘ on ‘rac-two‘ succeeded CRS-2673: Attempting to stop ‘ora.cssd‘ on ‘rac-two‘ CRS-2677: Stop of ‘ora.cssd‘ on ‘rac-two‘ succeeded CRS-2677: Stop of ‘ora.ctssd‘ on ‘rac-one‘ succeeded CRS-2677: Stop of ‘ora.asm‘ on ‘rac-one‘ succeeded CRS-2673: Attempting to stop ‘ora.cluster_interconnect.haip‘ on ‘rac-one‘ CRS-2677: Stop of ‘ora.cluster_interconnect.haip‘ on ‘rac-one‘ succeeded CRS-2673: Attempting to stop ‘ora.cssd‘ on ‘rac-one‘ CRS-2677: Stop of ‘ora.cssd‘ on ‘rac-one‘ succeeded [root@rac-one ~]#
3、查看集群资源信息:
[root@rac-one ~]# /u01/app/11.2.0/grid/bin/crsctl status resource -t CRS-4535: Cannot communicate with Cluster Ready Services CRS-4000: Command Status failed, or completed with errors. [root@rac-one ~]#
启动Rac:
1、启动asm以及资源信息:
[root@rac-one ~]# /u01/app/11.2.0/grid/bin/crsctl start cluster -all CRS-2672: Attempting to start ‘ora.cssdmonitor‘ on ‘rac-one‘ CRS-2672: Attempting to start ‘ora.cssdmonitor‘ on ‘rac-two‘ CRS-2676: Start of ‘ora.cssdmonitor‘ on ‘rac-one‘ succeeded CRS-2676: Start of ‘ora.cssdmonitor‘ on ‘rac-two‘ succeeded CRS-2672: Attempting to start ‘ora.cssd‘ on ‘rac-one‘ CRS-2672: Attempting to start ‘ora.diskmon‘ on ‘rac-one‘ CRS-2672: Attempting to start ‘ora.cssd‘ on ‘rac-two‘ CRS-2672: Attempting to start ‘ora.diskmon‘ on ‘rac-two‘ CRS-2676: Start of ‘ora.diskmon‘ on ‘rac-one‘ succeeded CRS-2676: Start of ‘ora.diskmon‘ on ‘rac-two‘ succeeded CRS-2676: Start of ‘ora.cssd‘ on ‘rac-one‘ succeeded CRS-2672: Attempting to start ‘ora.ctssd‘ on ‘rac-one‘ CRS-2676: Start of ‘ora.cssd‘ on ‘rac-two‘ succeeded CRS-2672: Attempting to start ‘ora.cluster_interconnect.haip‘ on ‘rac-one‘ CRS-2672: Attempting to start ‘ora.ctssd‘ on ‘rac-two‘ CRS-2676: Start of ‘ora.ctssd‘ on ‘rac-one‘ succeeded CRS-2672: Attempting to start ‘ora.evmd‘ on ‘rac-one‘ CRS-2676: Start of ‘ora.ctssd‘ on ‘rac-two‘ succeeded CRS-2672: Attempting to start ‘ora.evmd‘ on ‘rac-two‘ CRS-2672: Attempting to start ‘ora.cluster_interconnect.haip‘ on ‘rac-two‘ CRS-2676: Start of ‘ora.evmd‘ on ‘rac-two‘ succeeded CRS-2676: Start of ‘ora.evmd‘ on ‘rac-one‘ succeeded CRS-2676: Start of ‘ora.cluster_interconnect.haip‘ on ‘rac-one‘ succeeded CRS-2672: Attempting to start ‘ora.asm‘ on ‘rac-one‘ CRS-2676: Start of ‘ora.cluster_interconnect.haip‘ on ‘rac-two‘ succeeded CRS-2672: Attempting to start ‘ora.asm‘ on ‘rac-two‘ CRS-2676: Start of ‘ora.asm‘ on ‘rac-one‘ succeeded CRS-2672: Attempting to start ‘ora.crsd‘ on ‘rac-one‘ CRS-2676: Start of ‘ora.asm‘ on ‘rac-two‘ succeeded CRS-2672: Attempting to start ‘ora.crsd‘ on ‘rac-two‘ CRS-2676: Start of ‘ora.crsd‘ on ‘rac-one‘ succeeded CRS-2676: Start of ‘ora.crsd‘ on ‘rac-two‘ succeeded [root@rac-one ~]#
注:如果启动单个主机实例需要指定主机名:/u01/app/11.2.0/grid/bin/crsctl start cluster -n rac-one rac-two(启动rac-one和rac-two两个主机集群资源)
2、查看资源信息:
[root@rac-one ~]# /u01/app/11.2.0/grid/bin/crsctl status resource -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATADG.dg ONLINE ONLINE rac-one ONLINE ONLINE rac-two ora.GIDG.dg ONLINE ONLINE rac-one ONLINE ONLINE rac-two ora.LISTENER.lsnr ONLINE ONLINE rac-one ONLINE ONLINE rac-two ora.asm ONLINE ONLINE rac-one Started ONLINE ONLINE rac-two Started ora.gsd OFFLINE OFFLINE rac-one OFFLINE OFFLINE rac-two ora.net1.network ONLINE ONLINE rac-one ONLINE ONLINE rac-two ora.ons ONLINE ONLINE rac-one ONLINE ONLINE rac-two ora.registry.acfs ONLINE ONLINE rac-one ONLINE ONLINE rac-two -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE rac-two ora.LISTENER_SCAN2.lsnr 1 ONLINE ONLINE rac-one ora.LISTENER_SCAN3.lsnr 1 ONLINE ONLINE rac-one ora.cvu 1 ONLINE ONLINE rac-one ora.oc4j 1 ONLINE ONLINE rac-one ora.rac-one.vip 1 ONLINE ONLINE rac-one ora.rac-two.vip 1 ONLINE ONLINE rac-two ora.rac.db 1 OFFLINE OFFLINE Instance Shutdown 2 OFFLINE OFFLINE Instance Shutdown ora.scan1.vip 1 ONLINE ONLINE rac-two ora.scan2.vip 1 ONLINE ONLINE rac-one ora.scan3.vip 1 ONLINE ONLINE rac-one [root@rac-one ~]#
3、启动数据库:
[root@rac-one ~]# /u01/app/11.2.0/grid/bin/srvctl start database -d Rac [root@rac-one ~]# /u01/app/11.2.0/grid/bin/crsctl status resource -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATADG.dg ONLINE ONLINE rac-one ONLINE ONLINE rac-two ora.GIDG.dg ONLINE ONLINE rac-one ONLINE ONLINE rac-two ora.LISTENER.lsnr ONLINE ONLINE rac-one ONLINE ONLINE rac-two ora.asm ONLINE ONLINE rac-one Started ONLINE ONLINE rac-two Started ora.gsd OFFLINE OFFLINE rac-one OFFLINE OFFLINE rac-two ora.net1.network ONLINE ONLINE rac-one ONLINE ONLINE rac-two ora.ons ONLINE ONLINE rac-one ONLINE ONLINE rac-two ora.registry.acfs ONLINE ONLINE rac-one ONLINE ONLINE rac-two -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE rac-two ora.LISTENER_SCAN2.lsnr 1 ONLINE ONLINE rac-one ora.LISTENER_SCAN3.lsnr 1 ONLINE ONLINE rac-one ora.cvu 1 ONLINE ONLINE rac-one ora.oc4j 1 ONLINE ONLINE rac-one ora.rac-one.vip 1 ONLINE ONLINE rac-one ora.rac-two.vip 1 ONLINE ONLINE rac-two ora.rac.db 1 ONLINE ONLINE rac-two Open 2 ONLINE ONLINE rac-one Open ora.scan1.vip 1 ONLINE ONLINE rac-two ora.scan2.vip 1 ONLINE ONLINE rac-one ora.scan3.vip 1 ONLINE ONLINE rac-one [root@rac-one ~]#