这篇文章主要讲解了“怎么实现物理DataGuard客户端无缝切换”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“怎么实现物理DataGuard客户端无缝切换”吧!项目客户一直想实现DataGuard的主备切换的自动化,即主库故障后自动切换到备库,并此过程要让应用感知。咨询了DG broker后,考虑到其可用性,易用性,和license问题,放弃了broker。但是物理备库切换到主库还是可以实现对应用透明的。之前我有篇歪门邪道的文章,通过linux系统的IP漂移设置,实现主备切换对应用的透明。对于oracle 11g的dataguard switchover,可以通过创建触发器方式实现自动切换。下面是主要操作步骤:
主库执行:1.创建servicebegin DBMS_SERVICE.CREATE_SERVICE(service_name => ‘dg_taf_pri’, network_name => ‘dg_taf_pri’, aq_ha_notifications => TRUE, failover_method => ‘BASIC’, failover_type => ‘SELECT’, failover_retries => 30, failover_delay => 5);end;/2.创建存储过程,主库启动service监听create or replace procedure dg_taf_proc is v_role VARCHAR(30); begin select DATABASE_ROLE into v_role from V$DATABASE; if v_role = ‘PRIMARY’ then DBMS_SERVICE.START_SERVICE(‘dg_taf_pri’); else DBMS_SERVICE.STOP_SERVICE(‘dg_taf_pri’); end if; end; /select owner,object_name ,procedure_name from dba_procedures where procedure_name=’dg_taf_proc’; –procedure_name列出package中的procedure、functionselect owner,object_name ,procedure_name from dba_procedures where object_name=’DG_TAF_PROC’;select distinct name,owner from dba_source where name like ‘DG_TAF_PROC%’;3.创建触发器,主备切换时触发create or replace TRIGGER dg_taf_trg_startup after startup or db_role_change on databasebegin dg_taf_proc;end;/select trigger_name, trigger_namefrom dba_triggers where trigger_name = ‘DG_TAF_TRG_STARTUP’;4.客户端配置:dg_taf = (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp)(HOST = 12.12.12.123)(PORT = 免费主机域名1521)) (ADDRESS = (PROTOCOL = tcp)(HOST = 12.12.12.125)(PORT = 1521)) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dg_taf_pri) (FAILOVER_MODE = (TYPE = session) (METHOD = basic) (RETRIES = 180) (DELAY = 5) ) ))感谢各位的阅读,以上就是“怎么实现物理DataGuard客户端无缝切换”的内容了,经过本文的学习后,相信大家对怎么实现物理DataGuard客户端无缝切换这一问题有了更深刻的体会,具体使用情况还需免费主机域名要大家实践验证。这里是云技术,小编将为大家推送更多相关知识点的文章,欢迎关注!
相关推荐: 如何解决修改/dev/shm大小造成Oracle 12c集群启动故障
这篇文章主要介绍了如何解决修改/dev/shm大小造成Oracle 12c集群启动故障,具有一定借鉴价值,感兴趣的朋友可以参考免费主机域名下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。由于维护人员修改Oracle Linux 7中的/…