oracle rac添加service的过程(11gr2版本)

1,手工添加service

su - oracle

[oracle@dtydb3 ~]$ srvctl add service -d epmdb -s srv_epm1 -r epmdb1 -a epmdb2 -P basic -e select -m basic -z 180 -w 5


2,查看service状态和属性

sys@EPMDB1(10.4.124.233)> select name, failover_method, failover_type, goal, clb_goal from dba_services;

NAME                 FAILOVER_M FAILOVER_TYPE                                                    GOAL         CLB_G
-------------------- ---------- ---------------------------------------------------------------- ------------ -----
SYS$BACKGROUND                                                                                   NONE         SHORT
SYS$USERS                                                                                        NONE         SHORT
epmdb                                                                                                         LONG
srv_epm1             BASIC      SELECT                                                           NONE         LONG

[grid@dtydb3 ~]$ crsctl status resource ora.epmdb.srv_epm1.svc -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.epmdb.srv_epm1.svc
      1        ONLINE  ONLINE       dtydb3                                       
[grid@dtydb3 ~]$ srvctl status service -d epmdb
Service srv_epm1 is running on instance(s) epmdb1
[grid@dtydb3 ~]$ srvctl config service -d epmdb -s srv_epm1
Service name: srv_epm1
Service is enabled
Server pool: epmdb_srv_epm1
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: SELECT
Failover method: BASIC
TAF failover retries: 180
TAF failover delay: 5
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Edition:
Preferred instances: epmdb1
Available instances: epmdb2

[grid@dtydb3 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 13-JUN-2012 15:22:46

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date                04-MAY-2012 14:36:04
Uptime                    40 days 0 hr. 46 min. 42 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/11.2.0/grid/network/admin/listener.ora
Listener Log File         /oracle/app/oracle/diag/tnslsnr/dtydb3/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.4.124.243)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.4.124.233)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "epmdb" has 1 instance(s).
  Instance "epmdb1", status READY, has 1 handler(s) for this service...
Service "srv_epm1" has 1 instance(s).
  Instance "epmdb1", status READY, has 1 handler(s) for this service...
[grid@dtydb3 ~]$

3,修改服务,如果创建不正常的话
修改服务

---srvctl modify service -d epmdb -s srv_epm1 -r epmdb2 -a epmdb1 -P basic -e select -m basic -z 100 -w 2


--删除服务

srvctl remove service -d epmdb -s srv_epm1 -f

4,TAF测试


tnsname.ora配置
tydb_srv_epm1 =
  (DESCRIPTION =
    (LOAD_BALANCE = NO)
    (ADDRESS = (PROTOCOL = TCP)(HOST = db1-vip)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = db2_vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVICE_NAME = srv_epm1)
    )
  )
 

关闭实例1
shutdown immediate

sqlplus system/oracle@tydb_srv_epm1

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
epmdb2

成功切换到第二个节点

恢复还原

重启实例1 startup
切换service到实例1
su - oracle

srvctl relocate service -d epmdb -s srv_epm1 -i epmdb2 -t epmdb1

你可能感兴趣的:(oracle rac添加service的过程(11gr2版本))