數(shù)據(jù)庫service概要
傳統(tǒng)的TFA實現(xiàn)方式存在如下問題:
簡單理解就是原始的TFA(Transparent Application Failover)是在客戶端的tnsnames.ora文件中配置,而數(shù)據(jù)庫的service是在服務(wù)端已經(jīng)配置好了,客戶端無需維護tnsnames.ora文件。
service參數(shù)說明
11G 版本 srvctl add service Options 常見參數(shù):
srvctl add service -d db_unique_name -s service_name {-r "preferred_list"
[-a "available_list"] [-P {BASIC | NONE | PRECONNECT}] | -g server_pool
[-c {UNIFORM | SINGLETON]} [-k network_number]
[-l [PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY | SNAPSHOT_STANDBY]
[-y {AUTOMATIC | MANUAL}] [-q {TRUE | FALSE}] [-x {TRUE | FALSE}]
[-j {SHORT | LONG}][-B {NONE | SERVICE_TIME | THROUGHPUT}]
[-e {NONE | SESSION | SELECT}] [-m {NONE | BASIC}] [-z failover_retries]
[-w failover_delay]
19C 版本部分參數(shù)稍有改動:
srvctl add service -database db_unique_name -service service_name_list
[-pdb pluggable_database] [-eval]
[-preferred preferred_list] [-available available_list] [-failback {YES | NO}]
[-netnum network_number] [-tafpolicy {BASIC | NONE}]
[-edition edition_name]
[-role "[PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]"
[-policy {AUTOMATIC | MANUAL}] [-notification {TRUE | FALSE}]
[-clbgoal {SHORT | LONG}] [-failovertype {NONE|SESSION|SELECT|TRANSACTION|AUTO}]
[-rlbgoal {NONE | SERVICE_TIME | THROUGHPUT}] [-dtp {TRUE | FALSE}]
[-failovermethod {NONE | BASIC}] [-failoverretry failover_retries]
[-drain_timeout timeout] [-stopoption {NONE|IMMEDIATE|TRANSACTIONAL}]
[-failover_restore {NONE|LEVEL1|AUTO}] [-failoverdelay failover_delay]
[-sql_translation_profile sql_translation_profile]
[-global {TRUE | FALSE}] [-maxlag max_lag_time] [-commit_outcome {TRUE|FALSE}]
[-retention retention_time] [-replay_init_time replay_initiation_time]
[-session_state {STATIC|DYNAMIC|AUTO}] [-force] [-verbose]
service 創(chuàng)建模版 DB11G MAA
Create the service resource in primary cluster, for example, add service1 and service2
$ $ORACLE_HOME/bin/srvctl add service -d -s
-l physical_standby -r ","
$ $ORACLE_HOME/bin/srvctl add service -d -s
-l physical_standby -r ","
srvctl add service -d EMREP -s EMREP_RD_S1 -l physical_standby -r EMREP1 -a EMREP2
srvctl add service -d EMREP -s EMREP_RD_S2 -l physical_standby -r EMREP2 -a EMREP1
檢查服務(wù)狀態(tài):
[oracle@emrep01 dbs]$ srvctl status service -d EMREP
Service EMREP_RD_S1 is not running.
Service EMREP_RD_S2 is not running.
主庫啟動service并注冊到數(shù)據(jù)庫通過日志傳輸給備庫:
$ $ORACLE_HOME/bin/srvctl start service -d
主庫節(jié)點1 alert日志:
ALTER SYSTEM SET service_names=EMREP_RD_S1 SCOPE=MEMORY SID=EMREP1;
主庫節(jié)點2 alert日志:
ALTER SYSTEM SET service_names=EMREP_RD_S2 SCOPE=MEMORY SID=EMREP2;
$ $ORACLE_HOME/bin/srvctl stop service -d
$ $ORACLE_HOME/bin/srvctl status service -d
Service service1 is not running.
Service service2 is not running.
srvctl stop service -d EMREP
這時候觀察主庫兩個節(jié)點的alert日志發(fā)現(xiàn)如下語句:
ALTER SYSTEM SET service_names=EMREP SCOPE=MEMORY SID=EMREP1;
ALTER SYSTEM SET service_names=EMREP SCOPE=MEMORY SID=EMREP2;
set lines 400 pages 1000
select thread#, max(sequence#) as "last_applied_log"
from v$log_history
group by thread#;
建議在MRP所在的啟動service。
$ $ORACLE_HOME/bin/srvctl add service -d -s -l physical_standby -r ","
$ $ORACLE_HOME/bin/srvctl add service -d -s -l physical_standby -r ","
# 備庫創(chuàng)建,注意db_unique_name是備庫的
srvctl add service -d DGEMREP -s EMREP_RD_S1 -l physical_standby -r EMREP1 -a EMREP2
srvctl add service -d DGEMREP -s EMREP_RD_S2 -l physical_standby -r EMREP2 -a EMREP1
ora.dgEMREP.EMREP_rd_s1.svc
1 OFFLINE OFFLINE
ora.dgEMREP.EMREP_rd_s2.svc
1 OFFLINE OFFLINE
$ $ORACLE_HOME/bin/srvctl start service -d
$ $ORACLE_HOME/bin/srvctl status service -d
Service is running on instance(s) ,
Service is running on instance(s) ,
啟動備庫的service:
srvctl start service -d dgEMREP
這時候觀察主庫兩個節(jié)點的alert日志發(fā)現(xiàn)如下語句:
ALTER SYSTEM SET service_names=EMREP_RD_S1 SCOPE=MEMORY SID=EMREP1;
ALTER SYSTEM SET service_names=EMREP_RD_S2 SCOPE=MEMORY SID=EMREP2;
檢查服務(wù)狀態(tài):
ora.dgEMREP.EMREP_rd_s1.svc
1 ONLINE ONLINE emrep01
ora.dgEMREP.EMREP_rd_s2.svc
1 ONLINE ONLINE emrep02
檢查service狀態(tài):
[oracle@emrep02 ~]$ srvctl status service -d dgEMREP
Service EMREP_RD_S1 is running on instance(s) EMREP1
Service EMREP_RD_S2 is running on instance(s) EMREP2
節(jié)點1
[grid@emrep01 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-APR-2022 22:02:28
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 07-APR-2022 20:33:54
Uptime 0 days 1 hr. 28 min. 34 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/11.2.0/grid/log/diag/tnslsnr/emrep01/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.25.140.184)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.25.140.186)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "EMREP_RD_S1" has 1 instance(s).
Instance "EMREP1", status READY, has 1 handler(s) for this service...
Service "dgEMREP" has 1 instance(s).
Instance "EMREP1", status READY, has 1 handler(s) for this service...
Service "EMREPXDB" has 1 instance(s).
Instance "EMREP1", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@emrep02 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 07-APR-2022 22:07:01
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 07-APR-2022 20:34:14
Uptime 0 days 1 hr. 32 min. 47 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/11.2.0/grid/network/admin/listener.ora
Listener Log File /u01/11.2.0/grid/log/diag/tnslsnr/emrep02/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.25.140.185)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.25.140.187)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "EMREP_RD_S2" has 1 instance(s).
Instance "EMREP2", status READY, has 1 handler(s) for this service...
Service "dgEMREP" has 1 instance(s).
Instance "EMREP2", status READY, has 1 handler(s) for this service...
Service "EMREPXDB" has 1 instance(s).
Instance "EMREP2", status READY, has 1 handler(s) for this service...
The command completed successfully
$ $ORACLE_HOME/bin/srvctl stop database -d
$ $ORACLE_HOME/bin/srvctl start database -d
$ $ORACLE_HOME/bin/srvctl status service -d
Service is running on instance(s) ,
Service is running on instance(s) ,
srvctl start database -d dgEMREP
ora.dgEMREP.EMREP_rd_s1.svc
1 ONLINE ONLINE emrep01
ora.dgEMREP.EMREP_rd_s2.svc
1 ONLINE ONLINE emrep01
srvctl add service -d EMREP -s EMREP_R_S1 -l PRIMARY -r EMREP1 -a EMREP2
srvctl add service -d EMREP -s EMREP_R_S2 -l PRIMARY -r EMREP2 -a EMREP1
ora.EMREP.EMREP_r_s1.svc
1 OFFLINE OFFLINE
ora.EMREP.EMREP_r_s2.svc
1 OFFLINE OFFLINE
ora.EMREP.EMREP_rd_s1.svc
1 OFFLINE OFFLINE
ora.EMREP.EMREP_rd_s2.svc
1 OFFLINE OFFLINE
srvctl start service -d EMREP -s EMREP_r_s1
srvctl start service -d EMREP -s EMREP_r_s2
ora.EMREP.EMREP_r_s1.svc
1 ONLINE ONLINE emrep01
ora.EMREP.EMREP_r_s2.svc
1 ONLINE ONLINE emrep02
ora.EMREP.EMREP_rd_s1.svc
1 OFFLINE OFFLINE
ora.EMREP.EMREP_rd_s2.svc
1 OFFLINE OFFLINE
srvctl config service -d EMREP -s EMREP_r_s1
Service name: EMREP_R_S1
Service is enabled
Server pool: EMREP_EMREP_R_S1
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Edition:
Preferred instances: EMREP1
Available instances: EMREP2
srvctl config service -d EMREP -s EMREP_r_s2
Service name: EMREP_R_S2
Service is enabled
Server pool: EMREP_EMREP_R_S2
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: NONE
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Edition:
Preferred instances: EMREP2
Available instances: EMREP1
節(jié)點1
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.25.140.180)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.25.140.166)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "EMREP_R_S1" has 1 instance(s).
Instance "EMREP1", status READY, has 1 handler(s) for this service...
Service "EMREP" has 1 instance(s).
Instance "EMREP1", status READY, has 1 handler(s) for this service...
Service "EMREPXDB" has 1 instance(s).
Instance "EMREP1", status READY, has 1 handler(s) for this service...
The command completed successfully
節(jié)點2
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.25.140.181)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.25.140.167)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "EMREP_R_S2" has 1 instance(s).
Instance "EMREP2", status READY, has 1 handler(s) for this service...
Service "EMREP" has 1 instance(s).
Instance "EMREP2", status READY, has 1 handler(s) for this service...
Service "EMREPXDB" has 1 instance(s).
Instance "EMREP2", status READY, has 1 handler(s) for this service...
The command completed successfully
srvctl add service -d DGEMREP -s EMREP_R_S1 -l PRIMARY -r EMREP1 -a EMREP2
srvctl add service -d DGEMREP -s EMREP_R_S2 -l PRIMARY -r EMREP2 -a EMREP1
建議:切換之前可以考慮把主備庫的service先關(guān)閉,切換完成后再打開,不然原先連接備庫的service可能連到了主庫上面。
service 創(chuàng)建模版 DB19C MAA
srvctl add service -db HBCMDB -pdb ORCL -service ORCL_RD_S1
-role physical_standby -preferred orcl1 -available orcl2
srvctl add service -db HBCMDB -pdb ORCL -service ORCL_RD_S2
-role physical_standby -preferred orcl2 -available orcl1
主庫啟動service并注冊到數(shù)據(jù)庫通過日志傳輸給備庫。
srvctl start service -d HBCMDB
srvctl stop service -d HBCMDB
set lines 400 pages 1000
select thread#, max(sequence#) as "last_applied_log"
from v$log_history
group by thread#;
srvctl add service -db DGORCL -pdb ORCL -service ORCL_RD_S1
-role physical_standby -preferred orcl1 -available orcl2
srvctl add service -db DGORCL -pdb ORCL -service ORCL_RD_S2
-role physical_standby -preferred orcl1 -available orcl2
srvctl start service -d DGORCL
或者
srvctl start service -d DGORCL -s ORCL_rd_s1
srvctl start service -d DGORCL -s ORCL_rd_s2
[oracle@server01 admin]$ srvctl config service -d DGORCL
Service name: ORCL_R_S1
Server pool:
Cardinality: 1
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Global: false
Commit Outcome: false
Failover type:
Failover method:
Failover retries:
Failover delay:
Failover restore: NONE
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Edition:
Pluggable database name: ORCL
Hub service:
Maximum lag time: ANY
SQL Translation Profile:
Retention: 86400 seconds
Replay Initiation Time: 300 seconds
Drain timeout:
Stop option:
Session State Consistency: DYNAMIC
GSM Flags: 0
Service is enabled
Preferred instances: orcl1
Available instances: orcl2
CSS critical: no
Service name: ORCL_R_S2
Server pool:
Cardinality: 1
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Global: false
Commit Outcome: false
Failover type:
Failover method:
Failover retries:
Failover delay:
Failover restore: NONE
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Edition:
Pluggable database name: ORCL
Hub service:
Maximum lag time: ANY
SQL Translation Profile:
Retention: 86400 seconds
Replay Initiation Time: 300 seconds
Drain timeout:
Stop option:
Session State Consistency: DYNAMIC
GSM Flags: 0
Service is enabled
Preferred instances: orcl2
Available instances: orcl1
CSS critical: no
Service name: ORCL_RD_S1
Server pool:
Cardinality: 1
Service role: PHYSICAL_STANDBY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Global: false
Commit Outcome: false
Failover type:
Failover method:
Failover retries:
Failover delay:
Failover restore: NONE
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Edition:
Pluggable database name: ORCL
Hub service:
Maximum lag time: ANY
SQL Translation Profile:
Retention: 86400 seconds
Replay Initiation Time: 300 seconds
Drain timeout:
Stop option:
Session State Consistency: DYNAMIC
GSM Flags: 0
Service is enabled
Preferred instances: orcl1
Available instances: orcl2
CSS critical: no
Service uses Java: false
Service name: ORCL_RD_S2
Server pool:
Cardinality: 1
Service role: PHYSICAL_STANDBY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Global: false
Commit Outcome: false
Failover type:
Failover method:
Failover retries:
Failover delay:
Failover restore: NONE
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: NONE
Edition:
Pluggable database name: ORCL
Hub service:
Maximum lag time: ANY
SQL Translation Profile:
Retention: 86400 seconds
Replay Initiation Time: 300 seconds
Drain timeout:
Stop option:
Session State Consistency: DYNAMIC
GSM Flags: 0
Service is enabled
Preferred instances: orcl1
Available instances: orcl2
CSS critical: no
Service uses Java: false
srvctl add service -db HBCMDB -pdb ORCL -service ORCL_R_S1 -
role primary -preferred orcl1 -available orcl2
srvctl add service -db HBCMDB -pdb ORCL -service ORCL_R_S2 -
role primary -preferred orcl2 -available orcl1
srvctl start service -d HBCMDB -s ORCL_R_S1
srvctl start service -d HBCMDB -s ORCL_R_S2
srvctl add service -db DGORCL -pdb ORCL -service ORCL_R_S1 -
role primary -preferred orcl1 -available orcl2
srvctl add service -db DGORCL -pdb ORCL -service ORCL_R_S2 -
role primary -preferred orcl2 -available orcl1
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請注明本文地址:http://systransis.cn/yun/129342.html
Oracle最佳連接方式之service最佳實踐及測試(下) img{ display:block; margin:0 auto !important; width:100%; } body{ width:75%...
摘要:年月日甲骨文今日發(fā)布了最新的集成產(chǎn)品,以幫助企業(yè)更便利地運用變革性技術(shù)。甲骨文提供下一代用戶體驗,包括基于個人角色使用所有功能,同時通過預(yù)先制作的集成模板加速產(chǎn)品上市時間,為企業(yè)創(chuàng)造更多的價值。2017年10月11日 –甲骨文今日發(fā)布了最新的集成PaaS產(chǎn)品,以幫助企業(yè)更便利地運用變革性技術(shù)。除了最新的自治數(shù)據(jù)管理云服務(wù)、大數(shù)據(jù)分析和人工智能功能之外,甲骨文宣布在其應(yīng)用程序開發(fā)平臺、數(shù)據(jù)集成...
摘要:詳細請見產(chǎn)品價格產(chǎn)品概念使用須知名詞解釋漏洞修復(fù)記錄集群節(jié)點配置推薦模式選擇產(chǎn)品價格操作指南集群創(chuàng)建需要注意的幾點分別是使用必讀講解使用需要賦予的權(quán)限模式切換的切換等。UK8S概覽UK8S是一項基于Kubernetes的容器管理服務(wù),你可以在UK8S上部署、管理、擴展你的容器化應(yīng)用,而無需關(guān)心Kubernetes集群自身的搭建及維護等運維類工作。了解使用UK8S為了讓您更快上手使用,享受UK...
摘要:描述連接多維數(shù)據(jù)庫,首先要通過數(shù)據(jù)連接將多維數(shù)據(jù)庫與連接起來,然后在數(shù)據(jù)連接的基礎(chǔ)上新建多維數(shù)據(jù)庫數(shù)據(jù)集,用于模板設(shè)計。詳細設(shè)置查看連接數(shù)據(jù)連接建立好之后,就可以添加多維數(shù)據(jù)庫數(shù)據(jù)集。 1. 描述FineReport連接多維數(shù)據(jù)庫,首先要通過數(shù)據(jù)連接將多維數(shù)據(jù)庫與FineReport連接起來,然后在數(shù)據(jù)連接的基礎(chǔ)上新建多維數(shù)據(jù)庫XMLA數(shù)據(jù)集,用于模板設(shè)計。2.XMLA數(shù)據(jù)連接2.1描...
閱讀 1357·2023-01-11 13:20
閱讀 1707·2023-01-11 13:20
閱讀 1215·2023-01-11 13:20
閱讀 1907·2023-01-11 13:20
閱讀 4165·2023-01-11 13:20
閱讀 2758·2023-01-11 13:20
閱讀 1402·2023-01-11 13:20
閱讀 3673·2023-01-11 13:20