欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

手工方式配置Service的过程。

程序员文章站 2022-04-28 16:29:52
...

在使用srvctl创建service时,需要注意TAF策略选项必须通过dbms_service包来配置。下面例子演示了如何创建一个服务felix_ora: 1.创建之前查看系统现有的service: SQL show parameter service NAME TYPE VALUE ------------------------------------ -------

在使用srvctl创建service时,需要注意TAF策略选项必须通过dbms_service包来配置。下面例子演示了如何创建一个服务felix_ora:

1.创建之前查看系统现有的service:

SQL> show parameter service

NAME TYPE VALUE

------------------------------------ -----------------------------------------

service_names string felix

SQL>

2.使用srvctl创建felix_ora服务;

[oracle@felix1 ~]$ srvctl add service -d felix -s felix_ora -r felix1 -a felix2 -P BASIC

[oracle@felix1 ~]$

[oracle@felix1 ~]$ srvctl config service -d felix-a

felix_ora PREF: felix1 AVAIL: felix2 TAF: BASIC

[oracle@felix1 ~]$ srvctl status service -d felix

Service felix_ora is not running.

[oracle@felix1 ~]$

3.确认服务创建成功,以下标红部分说明服务已经作为一项CRS Resource注册到CRS中,但是目前没有启动。

[oracle@felix1 ~]$ crs_stat -t -v

Name Type R/RA F/FT Target State Host

----------------------------------------------------------------------

ora.felix.db application 0/0 0/1 ONLINE ONLINE felix1

ora....x1.inst application 0/5 0/0 ONLINE ONLINE felix1

ora....x2.inst application 0/5 0/0 ONLINE ONLINE felix2

ora...._ora.cs application 0/0 0/1 OFFLINE OFFLINE

ora....ix1.srv application 0/0 0/0 OFFLINE OFFLINE

ora....SM1.asm application 0/5 0/0 ONLINE ONLINE felix1

ora....X1.lsnr application 0/5 0/0 ONLINE ONLINE felix1

ora.felix1.gsd application 0/5 0/0 ONLINE ONLINE felix1

ora.felix1.ons application 0/3 0/0 ONLINE ONLINE felix1

ora.felix1.vip application 0/0 0/0 ONLINE ONLINE felix1

ora....SM2.asm application 0/5 0/0 ONLINE ONLINE felix2

ora....X2.lsnr application 0/5 0/0 ONLINE ONLINE felix2

ora.felix2.gsd application 0/5 0/0 ONLINE ONLINE felix2

ora.felix2.ons application 0/3 0/0 ONLINE ONLINE felix2

ora.felix2.vip application 0/0 0/0 ONLINE ONLINE felix2

[oracle@felix1 ~]$

4.配置服务自动启动

[oracle@felix1 ~]$ srvctl enable service -d felix-s felix_ora

PRKP-1018 : Service felix_ora already enabled.

[oracle@felix1 ~]$

5.启动这个服务

[oracle@felix1 ~]$ srvctl start service -d felix -s felix_ora

[oracle@felix1 ~]$

[oracle@felix1 ~]$ srvctl status service -d felix -s felix_ora

Service felix_ora is running on instance(s) felix1

[oracle@felix1 ~]$

6.确认服务状态;

[oracle@felix2 ~]$ crs_stat -t -v

Name Type R/RA F/FT Target State Host

----------------------------------------------------------------------

ora.felix.db application 0/0 0/1 ONLINE ONLINE felix1

ora....x1.inst application 0/5 0/0 ONLINE ONLINE felix1

ora....x2.inst application 0/5 0/0 ONLINE ONLINE felix2

ora...._ora.cs application 0/0 0/1 ONLINE ONLINE felix1

ora....ix1.srv application 0/0 0/0 ONLINE ONLINE felix1

ora....SM1.asm application 0/5 0/0 ONLINE ONLINE felix1

ora....X1.lsnr application 0/5 0/0 ONLINE ONLINE felix1

ora.felix1.gsd application 0/5 0/0 ONLINE ONLINE felix1

ora.felix1.ons application 0/3 0/0 ONLINE ONLINE felix1

ora.felix1.vip application 0/0 0/0 ONLINE ONLINE felix1

ora....SM2.asm application 0/5 0/0 ONLINE ONLINE felix2

ora....X2.lsnr application 0/5 0/0 ONLINE ONLINE felix2

ora.felix2.gsd application 0/5 0/0 ONLINE ONLINE felix2

ora.felix2.ons application 0/3 0/0 ONLINE ONLINE felix2

ora.felix2.vip application 0/0 0/0 ONLINE ONLINE felix2

[oracle@felix2 ~]$

说明已经全部启动了;

新建的服务会自动添加到初始化参数文件中:

SQL> show parameter service

NAME TYPE VALUE

------------------------------------ -----------------------------------------

service_names string felix, felix_ora

SQL>

7.修改service的TAF配置,需要使用dbms_service.modify_service

begin

dbms_service.modify_service(service_name => 'felix_ora',

failover_method =>dbms_service.failover_method_basic,

failover_type =>dbms_service.failover_type_select,

failover_retries => 180,

failover_delay => 5);

end;

/

PL/SQL procedure successfully completed.

8.确认以生效

Set lines 1000 pages 1000

col name for a50

col clb_goal for a15

col FAILOVER_METHOD for a15

col failover_type for a20;

SQL> selectname,failover_method,failover_type,clb_goal from dba_services;

NAME FAILOVER_METHOD FAILOVER_TYPE CLB_GOAL

----------------------------------------------------------------- -------------------- ---------------

SYS$BACKGROUND SHORT

SYS$USERS SHORT

seeddataXDB LONG

seeddata.regress.rdbms.dev.us.oracle.com LONG

felixXDB LONG

felix LONG

taf_server LONG

taf_srvctl LONG

felix_ora BASIC SELECT LONG

9 rows selected.

[oracle@felix1 ~]$ srvctl config service -d felix -a

felix_ora PREF: felix1 AVAIL: felix2 TAF: BASIC

[oracle@felix1 ~]$

【参考大话RAC--张晓明】