Oracle 12c R2中的ADG会话保留特性

数据库 Oracle
Oracle 12c R2中有一个不错的特性,那就是Active Data Guard会话保留,原本的叫法是Preserving Active Data Guard Application Connections

[[196974]]

Oracle 12c R2中有一个不错的特性,那就是Active Data Guard会话保留,原本的叫法是Preserving Active Data Guard Application Connections

怎么理解呢,比如在Active Data Guard上的连接会话,在switchover的过程中会话连接会始终保持不会中断。这一点听起来就很有特点,能够提高用户体验度,而且是一种相对透明的方式。

到底怎么样呢,我们来简单测试一下,先看看默认情况下的ADG会话情况,切换的过程就直接使用DG Broker来做了,快。

这是一个12cR2的环境,也使用了Far Sync。

  1. DGMGRL>show  configuration 
  2.  Configuration - dg_test12cs 
  3.   Protection Mode: MaxPerformance 
  4.   Members: 
  5.   test12cs  - Primary database 
  6.     test_sync - Far sync instance  
  7.     test12css - Physical standby database  
  8.  Fast-Start Failover: DISABLED 
  9.  Configuration Status: 

SUCCESS (status updated 10 seconds ago)我们连接到备库,备库现在是ADG模式。

  1. SQL> select open_mode from v$database
  2.  OPEN_MODE 
  3.  ---------------------------------------- 

READ ONLY WITH APPLY如果这个时候我们就使用一条语句在备库端查询,使用TNS连接,然后DG Broker来切换,切换的情况如下,也是一气呵成。

  1. DGMGRL> switchover to test12css 
  2.  Performing switchover NOW, please wait... 
  3.  Operation requires a connection to database "test12css" 
  4.  Connecting ... 
  5.  Connected to "test12css" 
  6.  Connected as SYSDBA. 
  7.  New primary database "test12css" is opening... 
  8.  Operation requires start up of instance "test12cs" on database "test12cs" 
  9.  Starting instance "test12cs"... 
  10.  for RDBMS instance 
  11.  ORACLE instance started. 
  12.  Database mounted. 
  13.  Database opened. 
  14.  Connected to "test12cs" 
  15.  Switchover succeeded, new primary is "test12css" 
  16.  DGMGRL>  

在客户端反复测试连接的情况如下:

  1. SQL> select count(*) from cat; 
  2.   COUNT(*) 
  3.  ---------- 
  4.         153 
  5.  SQL> / 
  6.   COUNT(*) 
  7.  ---------- 
  8.         153 
  9.  SQL> / 
  10.  select count(*) from cat 
  11.  * 
  12.  ERROR at line 1: 
  13.  ORA-03113: end-of-file on communication channel 
  14.  Process ID: 94489 
  15.  Session ID: 419 Serial number: 62932 

可以看到在切换的过程中,连接被中断了,而接下来就会彻底断开连接。

  1. SQL> / 
  2.  ERROR: 
  3.  ORA-03114: not connected to ORACLE 

这里就需要说一下这个特性的情况,其实还涉及到一个参数standby_db_preserve_states,默认是NONE

  1. SQL> show parameter standby_db_preserve_states 
  2.  NAME                                TYPE                  VALUE 
  3.  ------------------------------------ ---------------------- ------ 
  4.  standby_db_preserve_states          string                NONE 

我们设置为ALL,这个修改需要重启备库,我们设置好之后,再来做switchover

步骤和上面的类似,我们直接来看看效果,始终在这一个会话内查看数据查询的情况,整个过程相对平滑,在切换过程中会有一个大约两秒的停顿,但是连接始终是保持的。

  1. COUNT(*) 
  2. ---------- 
  3.        153 
  4. SQL> / 
  5.  COUNT(*) 
  6. ---------- 
  7.        153 
  8. SQL> / 
  9.  COUNT(*) 
  10. ---------- 
  11.        153       
  12. SQL> / 
  13.  
  14.  COUNT(*) 
  15. ---------- 
  16.        153 
  17. SQL> / 
  18.  COUNT(*) 
  19. ---------- 
  20.        153 

整体来看这个特性确实达到了预期的效果,还是蛮不错的。

责任编辑:武晓燕 来源: Linux社区
相关推荐

2016-09-21 20:08:12

oracle数据库甲骨文

2023-10-11 08:59:05

2010-01-13 16:08:09

Oracle 11g 数据卫士

2013-06-28 14:38:02

2016-09-05 13:32:29

甲骨文数据库Oracle

2009-09-02 15:35:57

Oracle 11g

2016-10-19 09:36:04

Oracle12c R分片分布式

2010-04-30 13:35:28

Oracle 11g

2014-05-08 10:00:04

Windows SerWSUS

2010-03-31 10:52:09

Oracle11g r

2014-08-26 10:03:45

Oracle 12c新

2015-10-21 13:54:00

Oracle 12c标 Oracle许可政策

2015-10-21 14:01:44

Oracle许可 Oracle 12c

2016-07-21 09:33:23

甲骨文

2009-03-05 11:02:12

NTP列式压缩云计算

2010-01-25 10:11:32

Oracle 11g

2016-10-08 14:43:30

Oracle 12c 云计算Oracle云

2013-06-07 10:49:57

微软Windows Ser特性

2010-01-19 10:17:41

Oracle 11g

2013-06-28 14:30:09

Oracle 12c
点赞
收藏

51CTO技术栈公众号