1. 检查当前主备库同步状态

  • on primary
select ads.dest_id,max(sequence#) "Current Sequence",
max(log_sequence) "Last Archived"
from v$archived_log al, v$archive_dest ad, v$archive_dest_status ads
where ad.dest_id=al.dest_id
and al.dest_id=ads.dest_id
and al.resetlogs_change#=(select max(resetlogs_change#) from v$archived_log )
group by ads.dest_id; DEST_ID Current Sequence Last Archived
------- ---------------- -------------
1 73 73
2 73 74
  • on standby
select al.thrd "Thread", almax "Last Seq Received", lhmax "Last Seq Applied"
from (select thread# thrd, max(sequence#) almax
from v$archived_log
where resetlogs_change#=(select resetlogs_change# from v$database)
group by thread#) al,
(select thread# thrd, max(sequence#) lhmax
from v$log_history
where resetlogs_change#=(select resetlogs_change# from v$database)
group by thread#) lh
where al.thrd = lh.thrd; Thread Last Seq Received Last Seq Applied
---------- ----------------- ----------------
1 73 73

2. standby配置闪回日志

show parameter db_recovery_file_dest;

NAME                             TYPE                              VALUE
------------------------------------ --------------------------------- ----------------------------------
db_recovery_file_dest string /u01/app/oracle/fast_recovery_area
db_recovery_file_dest_size big integer 4G

3. standby停止应用日志(此时备库的闪回处于关闭状态)

select flashback_on from v$database;

FLASHBACK_ON
------------------------------------------------------
NO alter database recover managed standby database cancel;

4. standby转换为snapshot standby

alter database convert to snapshot standby;
select flashback_on from v$database; #convert to snapshot standby命令相当于创建了一个担保还原点,这和使用担保还原点(Guaranteed Restore Points)状态类似
FLASHBACK_ON
------------------------------------------------------
RESTORE POINT ONLY select NAME from V$RESTORE_POINT; NAME
--------------------------------------------------
SNAPSHOT_STANDBY_REQUIRED_07/06/2017 06:02:50

5. 将standby启动到open状态

alter database open;
select DATABASE_ROLE,name,OPEN_MODE from v$database; DATABASE_ROLE NAME OPEN_MODE
-------------------- --------------------------- ---------------
SNAPSHOT STANDBY USERDATA READ WRITE

6. 对snapshot standby数据库进行压力测试或者Real Application Testing(RAT)或者其他读写操作

create tablespace usertbs datafile '/u01/app/oracle/oradata/userdata/usertbs01.dbf' size 50m;
select file_name from dba_data_files; FILE_NAME
------------------------------------------------------------
/u01/app/oracle/oradata/userdata/users01.dbf
/u01/app/oracle/oradata/userdata/undotbs01.dbf
/u01/app/oracle/oradata/userdata/sysaux01.dbf
/u01/app/oracle/oradata/userdata/system01.dbf
/u01/app/oracle/oradata/userdata/usertbs01.dbf

7. 测试结束后,将snapshot standby转换为physical standby,并且重新开始应用日志

shutdown immediate;
startup mount;
alter database convert to physical standby;
shutdown immediate;
startup mount;
alter database recover managed standby database using current logfile disconnect from session;
select DATABASE_ROLE,name,OPEN_MODE from v$database; DATABASE_ROLE NAME OPEN_MODE
-------------------- ---------------------------------- ---------------
PHYSICAL STANDBY USERDATA MOUNTED

8. 检查primary库和standby库的日志是同步的

  • on primary
alter system archive log current;

select ads.dest_id,max(sequence#) "Current Sequence",
max(log_sequence) "Last Archived"
from v$archived_log al, v$archive_dest ad, v$archive_dest_status ads
where ad.dest_id=al.dest_id
and al.dest_id=ads.dest_id
and al.resetlogs_change#=(select max(resetlogs_change#) from v$archived_log )
group by ads.dest_id; DEST_ID Current Sequence Last Archived
------- ---------------- -------------
1 78 78
2 78 79
  •  on standby
select al.thrd "Thread", almax "Last Seq Received", lhmax "Last Seq Applied"
from (select thread# thrd, max(sequence#) almax
from v$archived_log
where resetlogs_change#=(select resetlogs_change# from v$database)
group by thread#) al,
(select thread# thrd, max(sequence#) lhmax
from v$log_history
where resetlogs_change#=(select resetlogs_change# from v$database)
group by thread#) lh
where al.thrd = lh.thrd; Thread Last Seq Received Last Seq Applied
---------- ----------------- ----------------
1 78 78

Oracle 11.2.0.4.0 Dataguard部署和日常维护(6)-Dataguard Snapshot篇的更多相关文章

  1. Oracle 11.2.0.4.0 Dataguard部署和日常维护(3)-Datauard监控篇

    1.  v$database    查看当前数据库的角色和保护模式 primary库查看 column NAME format a10 column PROTECTION_MODE format a2 ...

  2. Oracle 11.2.0.4.0 Dataguard部署和日常维护(1)-数据库安装篇

    本次测试环境 系统版本 CentOS release 6.8 主机名 ec2t-userdata-01 ec2t-userdata-01 IP地址 10.189.102.118 10.189.100. ...

  3. Oracle 11.2.0.4.0 Dataguard部署和日常维护(7) - Dataguard Flashback篇

    1. 设置备库的闪回目录 show parameter db_recovery_file; NAME TYPE VALUE ------------------------------------ - ...

  4. Oracle 11.2.0.4.0 Dataguard部署和日常维护(2)-Datauard部署篇

    1. primary库设置dataguard相关参数   1.1. 强制primay库在任何状态下必须记录日志 SYS@userdata>select FORCE_LOGGING from v$ ...

  5. Oracle 11.2.0.4.0 Dataguard部署和日常维护(4)-Datauard Gap事件解决篇

    Oracle dataguard主库删除备库需要的归档时,会导致gap事情的产生,或者备库由于网络或物理故障原因,倒是备库远远落后于主库,都会产生gap事件,本例模拟gap事件的产生以及处理. 1. ...

  6. Oracle 11.2.0.4.0 Dataguard部署和日常维护(6)-Active Dataguard篇

    1. 检查主备库的状态 on primary column DATABASE_ROLE format a20 column OPEN_MODE format a15 column PROTECTION ...

  7. Oracle 11.2.0.4.0 Dataguard部署和日常维护(5)-Datauard 主备切换和故障转移篇

    1. dataguard主备切换   1.1. 查看当前主备库是否具备切换条件 on slave select sequence#,first_time,next_time,archived,appl ...

  8. Gitlab 快速部署及日常维护 (二)

    一.概述 上一篇我们将Gitlab的安装部署和初始化设置部分全部讲解完成了,接下来我们介绍Gitlab在日常工作中常遇见的问题进行梳理说明. 二.Gitlab的安装和维护过程中常见问题 1.Gitla ...

  9. Gitlab 快速部署及日常维护 (一)

    一.GitLab简介GitLab 是一个用于仓库管理系统的开源项目,使用Git作为代码管理工具,并在此基础上搭建起来的web服务 二.GitLab系统架构git用户的主目录通常是/home/git(~ ...

随机推荐

  1. C++中set的用法

    set的特性是,所有元素都会根据元素的键值自动排序,set的元素不像map那样可以同时拥有实值(value)和键值(key),set元素的键值就是实值,实值就是键值.set不允许两个元素有相同的键值. ...

  2. There is no Action mapped for namespace / and action name .解答

    做struts2登陆检验的时候遇到了一个问题: 输入http://localhost/login_validation/的目的是想显示 文件夹下的文件列表,无奈,使用struts框架,web.xml设 ...

  3. 理解 Redis(3) - 字符串值

    正如前面所讲的, redis 的数据结构就是一系列的键值对键 -> printable ASCII (可打印的 ASCII 码, 最大值是 512MB)值 -> Primitives (基 ...

  4. 【UOJ】#273. 【清华集训2016】你的生命已如风中残烛

    题目链接:http://uoj.ac/problem/273 $${Ans=\frac{\prod _{i=1}^{m}i}{w-n+1}}$$ #include<iostream> #i ...

  5. Codeforces Round #424 (Div. 2, rated, based on VK Cup Finals) D. Office Keys time limit per test2 seconds 二分

    D. Office Keys time limit per test 2 seconds memory limit per test 256 megabytes input standard inpu ...

  6. JaveWeb 公司项目(1)----- 使Div覆盖另一个Div完成切换效果

    最近在做网页,用的是CSS+DIV的布局方法,搭建了一个简易的界面,大体上分为三个部分,如图所示: 左侧的为主功能导航栏,右侧是具体的功能实现,下方是固定的版权声明,单击左边不同的导航按钮,在div中 ...

  7. ege demo

    #include <ege.h> const float base_speed = 0.5f; const float randspeed = 1.5f; //自定义函数,用来返回一个0 ...

  8. STL_map.修改删除

    1.修改示例 int TdrSvgAttr::AttrSet_mem(bool _bAttrInStyle, string &_strAttrName, string& _strAtt ...

  9. C# ---- GC中代的递增规律

    只有当对象所在代被 Collect 了,改对象所在代才会加 1 ,代值最大为 2 示例1: using System; namespace myMethod { class People{} clas ...

  10. lua --- unpack

    unpack 返回数组中的所有元素,包括 nil,注意是数组,对于 k-v 是不返回的!!! do , ,o = } print(unpack(tab)) --默认从索引 1 开始 )) --从索引 ...