dbca create service in rac

oracle rac环境中,service可以通过DBCA,srvctl来添加,这篇先简单介绍dbca创建service。

在GUI中,执行dbca会出现图形的窗口,如下:

 

//dbca创建完毕service之后,查看service的状态,数据库的数据字典中已经有了反应
SQL> show parameter service

NAME TYPE VALUE
———————————— ———– ——————————
service_names                            string                  service1

//再看看listener中是否有”反应”,service1.world就是这个反应

LSNRCTL> set current_listener listener_rac1
Current Listener is listener_rac1
LSNRCTL> services
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.201.149)(PORT=1521)(IP=FIRST)))
Services Summary…
Service “rac.world” has 2 instance(s).
Instance “rac1”, status READY, has 2 handler(s) for this service…
Handler(s):
“DEDICATED” established:0 refused:0 state:ready
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=rac1-vip.localdomain)(PORT=1521))
“DEDICATED” established:0 refused:0 state:ready
LOCAL SERVER
Instance “rac2”, status READY, has 1 handler(s) for this service…
Handler(s):
“DEDICATED” established:0 refused:0 state:ready
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=rac2-vip.localdomain)(PORT=1521))
Service “racXDB.world” has 2 instance(s).
Instance “rac1”, status READY, has 1 handler(s) for this service…
Handler(s):
“D000” established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER <machine: rac1, pid: 19622>
(ADDRESS=(PROTOCOL=tcp)(HOST=rac1.localdomain)(PORT=32827))
Instance “rac2”, status READY, has 1 handler(s) for this service…
Handler(s):
“D000” established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER <machine: rac2, pid: 18599>
(ADDRESS=(PROTOCOL=tcp)(HOST=rac2.localdomain)(PORT=32811))
Service “rac_XPT.world” has 2 instance(s).
Instance “rac1”, status READY, has 2 handler(s) for this service…
Handler(s):
“DEDICATED” established:0 refused:0 state:ready
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=rac1-vip.localdomain)(PORT=1521))
“DEDICATED” established:0 refused:0 state:ready
LOCAL SERVER
Instance “rac2”, status READY, has 1 handler(s) for this service…
Handler(s):
“DEDICATED” established:0 refused:0 state:ready
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=rac2-vip.localdomain)(PORT=1521))
Service “service1.world” has 1 instance(s).
Instance “rac1”, status READY, has 2 handler(s) for this service…
Handler(s):
“DEDICATED” established:0 refused:0 state:ready
REMOTE SERVER
(ADDRESS=(PROTOCOL=TCP)(HOST=rac1-vip.localdomain)(PORT=1521))
“DEDICATED” established:0 refused:0 state:ready
LOCAL SERVER
The command completed successfully

//再看看CRS中是否已经注册service的信息?
crs_stat |more
有如下的片段,说明新创建的service已经注册到了ocr中
NAME=ora.rac.service1.rac1.srv
TYPE=application
TARGET=ONLINE
STATE=ONLINE on rac1

//使用srvctl看看ocr中的信息,查看service的信息,首选的节点是rac1,备选节点是rac2,TAF策略中的method是basic,
//但是没有显示type,retries,delay这三个TAF策略

[oracle@rac1 ~]$ srvctl config service -d rac -a
service1 PREF: rac1 AVAIL: rac2 TAF: basic

//再看看dba_services中记录的东西
SQL> select name,FAILOVER_METHOD,FAILOVER_TYPE,FAILOVER_RETRIES,FAILOVER_DELAY from dba_services;

NAME                  FAILOVER_METHOD                      FAILOVER_TYPE             FAILOVER_RETRIES      FAILOVER_DELAY
—————————— —————————————- —————————————- —————- ————–
SYS$BACKGROUND
SYS$USERS
seeddataXDB
seeddata
racXDB
rac.world
service1

//dba_services中关于TAF的几个策略都没”反应”上,看来还需要dbms包来配置如下策略

(FAILOVER_METHOD,FAILOVER_TYPE,FAILOVER_RETRIES,FAILOVER_DELAY)

//使用dbms_service包来添加TAF的策略

SQL> begin
2 dbms_service.modify_service(
3 service_name=>’service1′,
4 failover_method=>dbms_service.failover_method_basic,
5 failover_type=>dbms_service.failover_type_select,
6 failover_retries=>170,
7 failover_delay=>4
8 );
9 end;
10 /

PL/SQL procedure successfully completed.

//再次查看dba_services中的TAF策略信息,retry、delay、FAILOVER_TYPE、FAILOVER_METHOD
SQL>  select name,FAILOVER_METHOD,FAILOVER_TYPE,FAILOVER_RETRIES,FAILOVER_DELAY from dba_services

NAME                               FAILOVER_METHOD                   FAILOVER_TYPE            FAILOVER_RETRIES FAILOVER_DELAY
—————————— ——————————     ——————————      —————-        ————–
SYS$BACKGROUND
SYS$USERS
seeddataXDB
seeddata
racXDB
rac.world
service1                BASIC                                          SELECT                                         170                                     4

 

–EOF–