Service-side TAF

lovehewenyu發表於2013-07-29

Service-side TAF

一、 檢查是否配置Service-side TAF

1、檢查是否配置了Service-side TAF

[grid@dou_rac2 ~]$ srvctl config service -d racdb

[grid@dou_rac2 ~]$                       

--無返回結果,說明沒有配置service

2、檢查監聽中是否註冊監聽了Service-side TAF 服務

[grid@dou_rac2 ~]$ lsnrctl status LISTENER_SCAN1

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 26-JUL-2013 17:34:42

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))

STATUS of the LISTENER

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

Alias                     LISTENER_SCAN1

Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production

Start Date                26-JUL-2013 09:55:30

Uptime                    0 days 7 hr. 39 min. 11 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/11.2.0/grid/log/diag/tnslsnr/dou_rac2/listener_scan1/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.223)(PORT=1521)))

Services Summary...

Service "racdb" has 2 instance(s).

  Instance "racdb1", status READY, has 1 handler(s) for this service...

  Instance "racdb2", status READY, has 1 handler(s) for this service...

Service "racdbXDB" has 1 instance(s).

  Instance "racdb1", status READY, has 1 handler(s) for this service...

The command completed successfully

--service未註冊到監聽中

二、新增Service-side TAF --oracle使用者執行

[oracle@dou_rac2 ~]$ srvctl add service -d racdb -s racdb_taf -r racdb1,racdb2 -P BASIC -e SELECT -m BASIC -w 10 -z 1000

 

三、檢查是否配置成功,未啟動則開啟服務

[oracle@dou_rac2 ~]$ srvctl config service -d racdb

服務名: racdb_taf

服務已啟用

伺服器池: racdb_racdb_taf

基數: 2

斷開連線:

服務角色: PRIMARY

管理策略: AUTOMATIC

DTP 事務處理:

AQ HA 通知:

故障轉移型別: SELECT

故障轉移方法: BASIC

TAF 故障轉移重試次數: 1000

TAF 故障轉移延遲: 10

連線負載平衡目標: LONG

執行時負載平衡目標: NONE

TAF 策略規範: BASIC

首選例項: racdb1,racdb2

可用例項:

 

檢視是否開啟Service-side TAF服務

[grid@dou_rac2 ~]$ srvctl status service -d racdb

服務 racdb_taf 未執行。

 

檢查LISTENER_SCAN1中也是否註冊了Service-side TAF服務

[grid@dou_rac2 ~]$ lsnrctl status LISTENER_SCAN1

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 26-JUL-2013 17:43:01

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))

STATUS of the LISTENER

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

Alias                     LISTENER_SCAN1

Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production

Start Date                26-JUL-2013 09:55:30

Uptime                    0 days 7 hr. 47 min. 30 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/11.2.0/grid/log/diag/tnslsnr/dou_rac2/listener_scan1/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.223)(PORT=1521)))

Services Summary...

Service "racdb" has 2 instance(s).

  Instance "racdb1", status READY, has 1 handler(s) for this service...

  Instance "racdb2", status READY, has 1 handler(s) for this service...

Service "racdbXDB" has 1 instance(s).

  Instance "racdb1", status READY, has 1 handler(s) for this service...

The command completed successfully

--監聽中未註冊Service-side TAF服務

 

開啟Service

[grid@dou_rac2 ~]$ srvctl start service -d racdb

檢視Service執行狀態

[grid@dou_rac2 ~]$ srvctl status service -d racdb

服務 racdb_taf 正在例項 racdb1 上執行

 

檢視LISTENER_SCAN1狀態

[grid@dou_rac2 ~]$ lsnrctl status LISTENER_SCAN1

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 26-JUL-2013 17:49:10

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))

STATUS of the LISTENER

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

Alias                     LISTENER_SCAN1

Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production

Start Date                26-JUL-2013 09:55:30

Uptime                    0 days 7 hr. 53 min. 39 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/11.2.0/grid/log/diag/tnslsnr/dou_rac2/listener_scan1/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.223)(PORT=1521)))

Services Summary...

Service "racdb" has 2 instance(s).

  Instance "racdb1", status READY, has 1 handler(s) for this service...

  Instance "racdb2", status READY, has 1 handler(s) for this service...

Service "racdbXDB" has 1 instance(s).

  Instance "racdb1", status READY, has 1 handler(s) for this service...

Service "racdb_taf" has 1 instance(s).

  Instance "racdb1", status READY, has 1 handler(s) for this service...

The command completed successfully

-- Service racdb_taf已經註冊到LISTENER_SCAN1

 

自動開啟service,資料庫啟動時自動開啟所有的service

[oracle@dou_rac2 admin]$ srvctl enable service -d racdb -s racdb_taf -i racdb1

[oracle@dou_rac2 admin]$ srvctl enable service -d racdb -s racdb_taf -i racdb2

--配置一個節點自動啟動service即可,當然2個也可以

重啟之後的service狀態

[grid@dou_rac2 ~]$ srvctl status service -d racdb

服務 racdb_taf 正在例項 racdb1,racdb2 上執行

[grid@dou_rac2 ~]$ lsnrctl status LISTENER_SCAN1

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 26-JUL-2013 18:44:17

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))

STATUS of the LISTENER

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

Alias                     LISTENER_SCAN1

Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production

Start Date                26-JUL-2013 18:40:03

Uptime                    0 days 0 hr. 4 min. 14 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/11.2.0/grid/log/diag/tnslsnr/dou_rac2/listener_scan1/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.223)(PORT=1521)))

Services Summary...

Service "racdb" has 2 instance(s).

  Instance "racdb1", status READY, has 1 handler(s) for this service...

  Instance "racdb2", status READY, has 1 handler(s) for this service...

Service "racdbXDB" has 2 instance(s).

  Instance "racdb1", status READY, has 1 handler(s) for this service...

  Instance "racdb2", status READY, has 1 handler(s) for this service...

Service "racdb_taf" has 2 instance(s).

  Instance "racdb1", status READY, has 1 handler(s) for this service...

  Instance "racdb2", status READY, has 1 handler(s) for this service...

The command completed successfully

 

四、修改客戶端tnsnames.ora 

客戶端使用service-side TAF,需要修改一下tnsnames.ora

RACDB =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = dou_rac-scan)(PORT = 1521))

    (CONNECT_DATA =

      (SERVICE = DEDICATED)

      (SERVICE_NAME = racdb_taf)  

    )

  )

  --racdb修改成racdb_taf服務名

Service-side TAF測試

[oracle@dou_rac2 admin]$ sqlplus xiaoyu/oracle@racdb

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jul 26 17:56:45 2013

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

 

SQL> show parameter service

NAME                                 TYPE        VALUE

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

service_names                        string      racdb_taf

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26442936/viewspace-767327/,如需轉載,請註明出處,否則將追究法律責任。

相關文章