当前位置:  数据库>oracle

快照DataGuard

    来源: 互联网  发布时间:2017-06-19

    本文导语: 快照DataGuard是11R2的一个功能,可以用于临时的测试后回到主从模式,测试坏境为LGWR ASYNC的最大性能模式。 一、设置snapshot standby 关闭日志应用进程MRPALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL; 关闭备数据库,启动到MOUNT阶段SHUTDOWN...

快照DataGuard是11R2的一个功能,可以用于临时的测试后回到主从模式,测试坏境为LGWR ASYNC的最大性能模式。

一、设置snapshot standby

关闭日志应用进程MRP
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
关闭备数据库,启动到MOUNT阶段
SHUTDOWN IMMEDIATE;
STARTUP NOMOUNT;
设置快速回复区域,但是注意这里并不需要FLASHBACK DATABASE支持,但是实际上应该还是FLASHBACK DATABASE
(Ensure that a fast recovery area has been configured. It is not necessary for
flashback database to be enabled.)

SQL> alter system set db_recovery_file_dest_size=30g;

System altered.

SQL> alter system set db_recovery_file_dest='/home/oradba/flash_area';

System altered.
如果不设置会报错
ERROR at line 1:
ORA-38784: Cannot create restore point 'SNAPSHOT_STANDBY_REQUIRED_04/24/2015
10:30:47'.
ORA-38786: Recovery area is not enabled.

执行转换
ALTER DATABASE CONVERT TO SNAPSHOT STANDBY;

转换操作可能比较慢,Oracle 可能会为备库建立日志文件如果没有的话,这比较耗时

SQL> ALTER DATABASE CONVERT TO SNAPSHOT STANDBY;

Database altered.

SQL> archive log list
Database log mode              Archive Mode
Automatic archival            Enabled
Archive destination            /oradba/archive
Oldest online log sequence    1
Next log sequence to archive  1
Current log sequence          1

完成后完全是一个新的数据库

List of Database Incarnations
DB Key  Inc Key DB Name  DB ID            STATUS  Reset SCN  Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1      1      TEST    2151380215      PARENT  1          17-SEP-11
2      2      TEST    2151380215      PARENT  995548    18-JUL-14
3      3      TEST    2151380215      PARENT  142690086  10-NOV-14
4      4      TEST    2151380215      CURRENT 168265840  24-APR-15

最后就是打开数据库可以使用了
SQL> alter database open;

Database altered.

SQL> select DATABASE_ROLE from v$database;

DATABASE_ROLE
----------------
SNAPSHOT STANDBY

注意:
1、snapshot standby 产生自身的归档日志,但是ALTER SYSTEM SWITCH LOGFILE 并不会马上归档,会等待5分钟归档1个日志
2、snapshot standby 确实会接受来自主库的日志,同时STANDBY LOGFILE也会接受来自主库的日志

SNAPSHOT STANDBY 日志归档和STANDBY归档速度从日志来看为5分钟归档一个,也就是说如果测试量巨大会造成日志组使用完,而造成HANG,
但是STANDBY LOG即使不能分配了也会接受归档到FLASH BACK AREA中。
从日志来看:
Fri Apr 24 11:05:43 2015
Archived Log entry 9 added for thread 1 sequence 807 ID 0x80d48cbc dest 1:
Fri Apr 24 11:07:36 2015
Thread 1 advanced to log sequence 4 (LGWR switch)
  Current log# 8 seq# 4 mem# 0: /oradba/data/test/redo04
Thread 1 advanced to log sequence 5 (LGWR switch)
  Current log# 9 seq# 5 mem# 0: /oradba/data/test/redo05
Thread 1 advanced to log sequence 6 (LGWR switch)
  Current log# 10 seq# 6 mem# 0: /oradba/data/test/redo06
Thread 1 advanced to log sequence 7 (LGWR switch)
  Current log# 11 seq# 7 mem# 0: /oradba/data/test/redo07
Thread 1 advanced to log sequence 8 (LGWR switch)
  Current log# 12 seq# 8 mem# 0: /oradba/data/test/redo08
Thread 1 advanced to log sequence 9 (LGWR switch)
  Current log# 13 seq# 9 mem# 0: /oradba/data/test/redo09
Thread 1 advanced to log sequence 10 (LGWR switch)
  Current log# 14 seq# 10 mem# 0: /oradba/data/test/redo10
Thread 1 advanced to log sequence 11 (LGWR switch)
  Current log# 15 seq# 11 mem# 0: /oradba/data/test/redo11
Thread 1 advanced to log sequence 12 (LGWR switch)
  Current log# 1 seq# 12 mem# 0: /oradba/data/test/redo01.log
Thread 1 advanced to log sequence 13 (LGWR switch)
  Current log# 2 seq# 13 mem# 0: /oradba/data/test/redo02.log
Fri Apr 24 11:07:46 2015
Thread 1 cannot allocate new log, sequence 14
Checkpoint not complete
  Current log# 2 seq# 13 mem# 0: /oradba/data/test/redo02.log
ORACLE Instance test - Can not allocate log, archival required
Thread 1 cannot allocate new log, sequence 14
All online logs needed archiving
  Current log# 2 seq# 13 mem# 0: /oradba/data/test/redo02.log
Fri Apr 24 11:10:44 2015
Archived Log entry 10 added for thread 1 sequence 3 ID 0x81b3f444 dest 1:
Fri Apr 24 11:10:44 2015
Thread 1 advanced to log sequence 14 (LGWR switch)
  Current log# 3 seq# 14 mem# 0: /oradba/data/test/redo03.log
Fri Apr 24 11:15:44 2015
Archived Log entry 11 added for thread 1 sequence 4 ID 0x81b3f444 dest 1:
 
注意这里11:05:43 2015进行了一次归档,然后我大量的进行切换,观察到ALTER SYSTEM switchlog HANG住,
观察到日志:
Checkpoint not complete
  Current log# 2 seq# 13 mem# 0: /oradba/data/test/redo02.log
ORACLE Instance test - Can not allocate log, archival required
而等待到Fri Apr 24 11:10:44 2015 日志进行了归档
Archived Log entry 10 added for thread 1 sequence 3 ID 0x81b3f444 dest 1
而Fri Apr 24 11:15:44 2015 有进行了一个日志的归档
Archived Log entry 11 added for thread 1 sequence 4 ID 0x81b3f444 dest 1:

而对于RFS 进程来说即使STANDBY LOG 不够也会接受进行到FLASHBACK AREA中
如下也能够证明:
SQL> select COMPLETION_TIME,SEQUENCE#,NAME FROM v$archived_log;

COMPLETION_TIME      SEQUENCE# NAME
------------------- ---------- ---------------------------------------------------------------------
2015-04-23 17:58:08        802 /oradba/archive/1_802_863273736.dbf
2015-04-23 18:06:16        803 /oradba/archive/1_803_863273736.dbf
2015-04-24 09:57:08        804 /oradba/archive/1_804_863273736.dbf
2015-04-24 10:31:07        805 /oradba/archive/1_805_863273736.dbf
2015-04-24 10:40:40        806 /oradba/archive/1_806_863273736.dbf
2015-04-24 10:55:42          1 /oradba/archive/1_1_877862036.dbf
2015-04-24 10:59:41        811 /home/oradba/flash_area/TESTDG1/archivelog/2015_04_24/o1_mf_1_811_bmm
2015-04-24 11:00:42          2 /oradba/archive/1_2_877862036.dbf
2015-04-24 11:05:43        807 /oradba/archive/1_807_863273736.dbf
2015-04-24 11:10:44          3 /oradba/archive/1_3_877862036.dbf
2015-04-24 11:15:44          4 /oradba/archive/1_4_877862036.dbf
o1_mf_1_811_bmm就是接受过来的LOGFILE。
不管怎么说snapshot standby 产生自身的归档日志和snapshot standby 确实会接受来自主库的日志是成立的

二、回到主备模式

1、shutdown immediate;
2、startup mount;
3、ALTER DATABASE CONVERT TO PHYSICAL STANDBY;
4、shutdown immediate;
5、startup
6、ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;

在CentOS 6.4下安装Oracle 11gR2(x64)

Oracle 11gR2 在VMWare虚拟机中安装步骤

Debian 下 安装 Oracle 11g XE R2

Oracle Data Guard 重要配置参数

基于同一主机配置 Oracle 11g Data Guard

探索Oracle之11g DataGuard

Oracle Data Guard (RAC+DG) 归档删除策略及脚本

Oracle Data Guard 的角色转换

Oracle Data Guard的日志FAL gap问题

Oracle 11g Data Guard Error 16143 Heartbeat failed to connect to standby 处理方法


    
 
 

您可能感兴趣的文章:

 
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐
  • 服务器存储快照和数据库快照详解
  • 技术文章 iis7站长之家
  • Linux文件系统快照技术 Next3
  • linux 快照问题
  • 如何在win2000下查看Solaris 8 的快照
  • 创建硬盘快照,高手帮忙!
  • android获取照片的快照 思路及实现方法
  • oracle 10g 快照操作方法
  • php获取网站页面快照并保存到文件
  • Oracle数据库快照的使用
  • PHP抓屏函数实现屏幕快照代码分享
  • 关于Oracle数据库中快照的使用方法介绍


  • 站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,,E-mail:www_#163.com(请将#改为@)

    浙ICP备11055608号-3