oracle10g rac_dbms_service_dba_service系列檢視學習筆記

wisdomone1發表於2010-04-13
---dbms_service與dba_services_v$service的學習
1,透過dbms_service可以靈活定製service一些指標,更適應業務的需要
2,dba_services的資訊要比v$service更為豐富,多了taf方面


dtp
    

Declares the service to be for DTP or distributed transactions including XA transactions  ---對於這個dtp也僅止於概念而已,變更它們的值true/false有本質區別




由於對plsql語法掌握不牢固,處理方法如下:
SQL> exec dbms_service.modify_service(service_name => 'service2',failover_method=>'0');
 
begin dbms_service.modify_service(service_name => 'service2',failover_method=>'0'); end;
 
ORA-44316: invalid argument
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: at "SYS.DBMS_SERVICE", line 394
ORA-06512: at "SYS.DBMS_SERVICE", line 280
ORA-06512: at line 2
 
SQL> exec dbms_service.modify_service(service_name => 'service2',failover_method=>dbms_service.failover_method_none);---
 
PL/SQL procedure successfully completed



附上dbms_service.mofify_service的測試筆記,供後期參考與深入掌握
SQL> exec dbms_service.modify_service(service_name => 'service2',failover_method=>dbms_service.failover_method_none);
 
PL/SQL procedure successfully completed
 
SQL> select * from dba_services where name='service2';
 
SERVICE_ID NAME                                                              NAME_HASH NETWORK_NAME                                                                     CREATION_DATE CREATION_DATE_HASH FAILOVER_METHOD                                                  FAILOVER_TYPE                                                    FAILOVER_RETRIES FAILOVER_DELAY MIN_CARDINALITY MAX_CARDINALITY GOAL         DTP ENABLED AQ_HA_NOTIFICATIONS CLB_GOAL
---------- ---------------------------------------------------------------- ---------- -------------------------------------------------------------------------------- ------------- ------------------ ---------------------------------------------------------------- ---------------------------------------------------------------- ---------------- -------------- --------------- --------------- ------------ --- ------- ------------------- --------
         8 service2                                                         1180431924 service2                                                                         2010-4-11 上午           589942238 NONE                                                                                                                                                                                              SERVICE_TIME Y   NO      NO                  LONG
 
SQL> exec dbms_service.modify_service(service_name => 'service2',failover_method=>dbms_service.failover_method_basic);
 
PL/SQL procedure successfully completed
 
SQL> select * from dba_services where name='service2';
 
SERVICE_ID NAME                                                              NAME_HASH NETWORK_NAME                                                                     CREATION_DATE CREATION_DATE_HASH FAILOVER_METHOD                                                  FAILOVER_TYPE                                                    FAILOVER_RETRIES FAILOVER_DELAY MIN_CARDINALITY MAX_CARDINALITY GOAL         DTP ENABLED AQ_HA_NOTIFICATIONS CLB_GOAL
---------- ---------------------------------------------------------------- ---------- -------------------------------------------------------------------------------- ------------- ------------------ ---------------------------------------------------------------- ---------------------------------------------------------------- ---------------- -------------- --------------- --------------- ------------ --- ------- ------------------- --------
         8 service2                                                         1180431924 service2                                                                         2010-4-11 上午           589942238 BASIC                                                                                                                                                                                             SERVICE_TIME Y   NO      NO                  LONG
 
SQL> exec dbms_service.modify_service(service_name => 'service2',failover_method=>dbms_service.failover_method_none);
 
PL/SQL procedure successfully completed
 
SQL> exec dbms_service.modify_service(service_name => 'service2',failover_type=>dbms_service.failover_type_none);
 
PL/SQL procedure successfully completed
 
SQL> exec dbms_service.modify_service(service_name => 'service2',failover_type=>dbms_service.failover_type_select);
 
PL/SQL procedure successfully completed
 
SQL> exec dbms_service.modify_service(service_name => 'service2',failover_type=>dbms_service.failover_type_session);
 
PL/SQL procedure successfully completed
 
SQL> select * from dba_services where name='service2';
 
SERVICE_ID NAME                                                              NAME_HASH NETWORK_NAME                                                                     CREATION_DATE CREATION_DATE_HASH FAILOVER_METHOD                                                  FAILOVER_TYPE                                                    FAILOVER_RETRIES FAILOVER_DELAY MIN_CARDINALITY MAX_CARDINALITY GOAL         DTP ENABLED AQ_HA_NOTIFICATIONS CLB_GOAL
---------- ---------------------------------------------------------------- ---------- -------------------------------------------------------------------------------- ------------- ------------------ ---------------------------------------------------------------- ---------------------------------------------------------------- ---------------- -------------- --------------- --------------- ------------ --- ------- ------------------- --------
         8 service2                                                         1180431924 service2                                                                         2010-4-11 上午           589942238                                                                  SESSION                                                                                                                          SERVICE_TIME Y   NO      NO                  LONG
 
SQL> exec dbms_service.modify_service(service_name => 'service2',failover_retries=>10);
 
PL/SQL procedure successfully completed
 
SQL> exec dbms_service.modify_service(service_name => 'service2',failover_delay=>3);
 
PL/SQL procedure successfully completed
 
SQL> select * from dba_services where name='service2';
 
SERVICE_ID NAME                                                              NAME_HASH NETWORK_NAME                                                                     CREATION_DATE CREATION_DATE_HASH FAILOVER_METHOD                                                  FAILOVER_TYPE                                                    FAILOVER_RETRIES FAILOVER_DELAY MIN_CARDINALITY MAX_CARDINALITY GOAL         DTP ENABLED AQ_HA_NOTIFICATIONS CLB_GOAL
---------- ---------------------------------------------------------------- ---------- -------------------------------------------------------------------------------- ------------- ------------------ ---------------------------------------------------------------- ---------------------------------------------------------------- ---------------- -------------- --------------- --------------- ------------ --- ------- ------------------- --------
         8 service2                                                         1180431924 service2                                                                         2010-4-11 上午           589942238                                                                                                                                                                 3                                 SERVICE_TIME Y   NO      NO                  LONG
 
SQL> exec dbms_service.modify_service(service_name => 'service2',failover_delay=>20);
 
PL/SQL procedure successfully completed
 
SQL> select * from dba_services where name='service2';
 
SERVICE_ID NAME                                                              NAME_HASH NETWORK_NAME                                                                     CREATION_DATE CREATION_DATE_HASH FAILOVER_METHOD                                                  FAILOVER_TYPE                                                    FAILOVER_RETRIES FAILOVER_DELAY MIN_CARDINALITY MAX_CARDINALITY GOAL         DTP ENABLED AQ_HA_NOTIFICATIONS CLB_GOAL
---------- ---------------------------------------------------------------- ---------- -------------------------------------------------------------------------------- ------------- ------------------ ---------------------------------------------------------------- ---------------------------------------------------------------- ---------------- -------------- --------------- --------------- ------------ --- ------- ------------------- --------
         8 service2                                                         1180431924 service2                                                                         2010-4-11 上午           589942238                                                                                                                                                                20                                 SERVICE_TIME Y   NO      NO                  LONG
 
SQL> exec dbms_service.modify_service(service_name => 'service2',failover_retries=>29);
 
PL/SQL procedure successfully completed
 
SQL> select * from dba_services where name='service2';
 
SERVICE_ID NAME                                                              NAME_HASH NETWORK_NAME                                                                     CREATION_DATE CREATION_DATE_HASH FAILOVER_METHOD                                                  FAILOVER_TYPE                                                    FAILOVER_RETRIES FAILOVER_DELAY MIN_CARDINALITY MAX_CARDINALITY GOAL         DTP ENABLED AQ_HA_NOTIFICATIONS CLB_GOAL
---------- ---------------------------------------------------------------- ---------- -------------------------------------------------------------------------------- ------------- ------------------ ---------------------------------------------------------------- ---------------------------------------------------------------- ---------------- -------------- --------------- --------------- ------------ --- ------- ------------------- --------
         8 service2                                                         1180431924 service2                                                                         2010-4-11 上午           589942238                                                                                                                                                 29                                                SERVICE_TIME Y   NO      NO                  LONG
 
SQL>
---以上測試發現,retries與delay不能同時配置,也就是這兩個引數可能是互斥的;理解oracle底層有個限制,如果配置不合理,可能就不會生效


dbms_service其它 子過程同理,不再測試


分析與調整service一些檢視


V$SERVICEMETRIC 

--根據每5秒和1分鐘時間對service不同的度量值進行取樣
V$SERVICEMETRIC displays metric values measured on the most recent time interval period for services executing inside the database.
 Service metrics are measured in 5-second and 1-minute intervals.

Column     Datatype     Description
BEGIN_TIME     DATE     Begin timestamp for the interval period  --取樣間隔開始時間
END_TIME     DATE     End timestamp for the interval period    --取樣間隔結束時間
INTSIZE_CSEC     NUMBER     Interval size (in hundredths of a second) ---取樣間隔時間大小
GROUP_ID     NUMBER     Group ID for the service metric group    ---服務度量組的group id,同型別的service進行分組管理
SERVICE_NAME_HASH     NUMBER     Service name hash --服務名hash,oracle好多檢視採用瞭如何機制,比如v$session,v$sqlarea and etc
SERVICE_NAME     VARCHAR2(64)     Service name  --服務名
CTMHASH     NUMBER     Service create timestamp hash value---服務建立時間的hash值
ELAPSEDPERCALL     NUMBER     Elapsed time per call (in microseconds). This column is deprecated in favor of the DBTIMEPERCALL column.---此列已不用,被dbtimepercall列替換;
                                                                                         ----每個使用者呼叫花費的時間
CPUPERCALL     NUMBER     CPU time per call (in microseconds)---每個呼叫花費的cpu time
DBTIMEPERCALL     NUMBER     Elapsed time per call (in microseconds)---每個呼叫花費的時間(花費時間>cpu time)
CALLSPERSEC     NUMBER     Number of user calls per second ---每秒內發生多少次使用者呼叫
DBTIMEPERSEC     NUMBER     DB time per second ---每秒產生的db time 是多少


---友好度,從字面可以這樣譯;這個值越低越好;oracle根據goal(long及short,請參考dbms_service章節)的不同值,對不同的service,從內部計算它的值。通俗來講,就是不同的服務在處理工作負荷時,對於各個rac例項的吸引力;我也沒有測試,理解不深
GOODNESS     NUMBER     Indicates how attractive a given instance is with respect to processing the workload that is presented to the service. A lower number is better.
                This number is internally computed based on the GOAL (LONG or SHORT) that is specified for the particular service.

---這個值表明,每個新增的會話接入到某個rac實含例的可以預側到的增長數
DELTA     NUMBER     Indicates the predicted increase in the goodness for every additional session that is routed to this instance

---是個列表型別的列
FLAGS     NUMBER     Can be any of the following values:

    *

      0x01 - service is BLOCKED from accepting new connections  ---服務接受新的連線時,可能正處於阻塞
    *

      0x02 - service is VIOLATING the set threshold on some metric ---服務違反某些度量上面的閥值
    *

      0x04 - goodness is UNKNOWN  ---服務目前的狀態為未知


---以下含義與以上差不多,區別在於取樣是最近一段時間的,記錄數更多,便於分析service的執行趨勢
V$SERVICEMETRIC_HISTORY

V$SERVICEMETRIC_HISTORY displays a recent history of the metric values measured in predefined time interval periods for services executing inside the database. Service metrics are measured in 5-second and 1-minute intervals.
Column     Datatype     Description
BEGIN_TIME     DATE     Begin timestamp for the interval period
END_TIME     DATE     End timestamp for the interval period
INTSIZE_CSEC     NUMBER     Interval size (in hundredths of a second)
GROUP_ID     NUMBER     Group ID for the service metric group
SERVICE_NAME_HASH     NUMBER     Service name hash
SERVICE_NAME     VARCHAR2(64)     Service name
CTMHASH     NUMBER     Service create timestamp hash value
ELAPSEDPERCALL     NUMBER     Elapsed time per call (in microseconds). This column is deprecated in favor of the DBTIMEPERCALL column.
CPUPERCALL     NUMBER     CPU time per call (in microseconds)
DBTIMEPERCALL     NUMBER     Elapsed time per call (in microseconds)
CALLSPERSEC     NUMBER     Number of user calls per second
DBTIMEPERSEC     NUMBER     DB time per second

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

相關文章