时间:2021-07-01 10:21:17 帮助过:45人阅读
service作为oracle数据库中的关键概念之一,利用得当,可以方便数据库的管理,提高数据库的执行效率。 通过service,oracle可以实现server side taf,简化对客户端的维护量,下面我们看一下在10g rac 怎样实验service实现 serve side taf 使用dbca来配置taf
service作为oracle数据库中的关键概念之一,利用得当,可以方便数据库的管理,提高数据库的执行效率。
通过service,oracle可以实现server side taf,简化对客户端的维护量,下面我们看一下在10g rac 怎样实验service实现 serve side taf
使用dbca来配置taf
通过dbca可以非常方便的配置server side taf
至此,service配置完成,下面我们验证一下
[root@node1 ~]# su - oracle [oracle@node1 ~]$ lsnrctl status LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 05-AUG-2014 21:46:10 Copyright (c) 1991, 2010, Oracle. All rights reserved. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) STATUS of the LISTENER ------------------------ Alias LISTENER_NODE1 Version TNSLSNR for Linux: Version 10.2.0.5.0 - Production Start Date 05-AUG-2014 21:26:40 Uptime 0 days 0 hr. 19 min. 30 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Listener Parameter File /u01/app/oracle/product/11.2.0/db/network/admin/listener.ora Listener Log File /u01/app/oracle/product/11.2.0/db/network/log/listener_node1.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.131)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.100.31)(PORT=1521))) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM1", status BLOCKED, has 1 handler(s) for this service... Service "+ASM_XPT" has 1 instance(s). Instance "+ASM1", status BLOCKED, has 1 handler(s) for this service... Service "PLSExtProc" has 1 instance(s). Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service... Service "racdb" has 3 instance(s). Instance "racdb", status UNKNOWN, has 1 handler(s) for this service... Instance "racdb1", status READY, has 2 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_XPT" has 2 instance(s). Instance "racdb1", status READY, has 2 handler(s) for this service... Instance "racdb2", status READY, has 1 handler(s) for this service... Service "service1" has 1 instance(s). Instance "racdb1", status READY, has 2 handler(s) for this service... The command completed successfully [oracle@node1 ~]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.5.0 - Production on Tue Aug 5 21:46:23 2014 Copyright (c) 1982, 2010, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production With the Partitioning, Real Application Clusters, OLAP, Data Mining and Real Application Testing options SQL> show parameter service NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ service_names string service1 SQL> col name for a20 SQL> col failover_method for a20 SQL> col failover_type for a20 SQL> select name,failover_method,failover_type from dba_services; NAME FAILOVER_METHOD FAILOVER_TYPE -------------------- -------------------- -------------------- SYS$BACKGROUND SYS$USERS seeddataXDB seeddata.regress.rdb ms.dev.us.oracle.com racdbXDB racdb service1 7 rows selected. SQL> exit Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production With the Partitioning, Real Application Clusters, OLAP, Data Mining and Real Application Testing options [oracle@node1 ~]$ srvctl config service -d racdb -s service1 -a service1 PREF: racdb1 AVAIL: racdb2 TAF: basic [oracle@node1 ~]$ srvctl config service -d racdb service1 PREF: racdb1 AVAIL: racdb2从上面的结果可以看出,通过dbca配置service 的taf,会在ocr中存储taf配置信息(仅仅是taf method),在数据库参数文件中会添加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 => 180, 7 failover_delay => 5 8 ); 9 end; 10 / PL/SQL procedure successfully completed. SQL> col name for a20 SQL> col failover_method for a20 SQL> col failover_type for a20 SQL> select name,failover_method,failover_type from dba_services; NAME FAILOVER_METHOD FAILOVER_TYPE -------------------- -------------------- -------------------- SYS$BACKGROUND SYS$USERS seeddataXDB seeddata.regress.rdb ms.dev.us.oracle.com racdbXDB racdb service1 BASIC SELECT 7 rows selected.另外,也可以使用srvctl来添加service
[root@node1 ~]# srvctl add service -h Usage: srvctl add service -d从这里,可以看出通过srvct添加的service不会在数据库参数和数据字典中添加相应的信息-s -r " " [-a ""] [-P ] -d Unique name for the database -s Service name -r " " List of preferred instances -a "" List of available instances -P TAF policy (NONE, BASIC, or PRECONNECT) Usage: srvctl add service -d -s -u {-r " " | -a " "} -d Unique name for the database -s Service name -u Add a new instance to service configuration -r Name of new preferred instance -a Name of new available instance -h Print usage [root@node1 ~]# srvctl add service -d racdb -s service2 -r racdb1 -a racdb2 -P BASIC PRKH-1014 : Current user root is not the same as oracle owner oracle of oracle home /u01/app/oracle/product/11.2.0/db. [root@node1 ~]# su - oracle [oracle@node1 ~]$ srvctl add service -d racdb -s service2 -r racdb1 -a racdb2 -P BASIC [oracle@node1 ~]$ srvctl config service -d racdb -a service1 PREF: racdb1 AVAIL: racdb2 TAF: basic service2 PREF: racdb1 AVAIL: racdb2 TAF: BASIC [oracle@node1 ~]$ sqlplus / as sysdba SQL*Plus: Release 10.2.0.5.0 - Production on Tue Aug 5 22:16:43 2014 Copyright (c) 1982, 2010, Oracle. All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production With the Partitioning, Real Application Clusters, OLAP, Data Mining and Real Application Testing options SQL> show parameter service NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ service_names string service1, racdb SQL> select name from dba_services; NAME ---------------------------------------------------------------- SYS$BACKGROUND SYS$USERS seeddataXDB seeddata.regress.rdbms.dev.us.oracle.com racdbXDB racdb service1 7 rows selected.