Service资源
每个数据库都有一个或多个service名称,service名称是提供给客户端连接到数据库实例的名称。
创建数据库会默认创建与数据库同名的service,默认的service实现所有实例的负载均衡,可以认为数据库的所有实例是默认创建的service的首选节点。
手工创建的service资源区分首选节点与备用节点,客户端无论通过哪个节点请求连接都会固定连接到service资源的首选节点,只有当首选节点故障才会连接到备用节点。
TAF(Transparent Application Failover):对于已经连接到数据库的客户端连接(会话),当前连接的数据库实例出现问题时,将已经存在的数据库连接透明地迁移到其他数据库实例中。对应的连接可能在实例出现问题之前已经执行了一些操作,或者在实例出现问题时正在执行某个操作,所以在failover到新实例的时候需要对执行过的操作和正在执行的操作进行相应的处理。
TAF仅支持使用OCI方式连接到数据库的会话,不支持使用JDBC方式连接到数据库的会话。
创建service
[oracle@wallet01 ~]$ srvctl add service -d wallet -s gspublic -r wallet1 -a wallet2,wallet3 -P basic -e session -y automatic
-d <db_unique_name> Unique name for the database
-s <service> Service name
-r "<preferred_list>" Comma separated list of preferred instances
-a "<available_list>" Comma separated list of available instances
-P {NONE | BASIC | PRECONNECT} TAF policy specification
-e <Failover type> Failover type (NONE, SESSION, or SELECT)
-y <policy> Management policy for the service (AUTOMATIC or MANUAL)
查询service属性
[oracle@wallet01 ~]$ srvctl config service -d wallet -s gspublic
Service name: gspublic
Service is enabled
Server pool: wallet_gspublic
Cardinality: 1
Disconnect: false
Service role: PRIMARY
Management policy: AUTOMATIC
DTP transaction: false
AQ HA notifications: false
Failover type: SESSION
Failover method: NONE
TAF failover retries: 0
TAF failover delay: 0
Connection Load Balancing Goal: LONG
Runtime Load Balancing Goal: NONE
TAF policy specification: BASIC
Edition:
Preferred instances: wallet1
Available instances: wallet2,wallet3
查询service状态
[oracle@wallet01 ~]$ srvctl status service -d wallet
Service gspublic is not running.
启动service资源
[oracle@wallet01 ~]$ srvctl start service -d wallet -s gspublic
[oracle@wallet01 ~]$ srvctl status service -d wallet
Service gspublic is running on instance(s) wallet1
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。