博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Oracle 11.2.0.4.0 Dataguard部署和日常维护(6)-Dataguard Snapshot篇
阅读量:4548 次
发布时间:2019-06-08

本文共 4699 字,大约阅读时间需要 15 分钟。

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------------------------------------------------------NOalter 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 ONLYselect 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

转载于:https://www.cnblogs.com/ilifeilong/p/7124036.html

你可能感兴趣的文章
Tomcat8 结构原理解析
查看>>
CodeVS 1697-⑨要写信
查看>>
关于#pragma once和#ifndefine组合的区别
查看>>
System.Json 使用注意
查看>>
python对日志处理的封装
查看>>
插件的使用(4)-fileupload
查看>>
libuv源码分析(2)
查看>>
【bzoj4554】[Tjoi2016&Heoi2016]游戏 二分图最大匹配
查看>>
oracle Rman 备份脚本
查看>>
网页二维码制作
查看>>
Python-元编程
查看>>
普通table表格样式及代码大全(全)
查看>>
php安装composer
查看>>
C# 使用默认浏览器打开链接
查看>>
【M13】以by reference 方式捕捉exceptions
查看>>
[HTML5] Blob对象
查看>>
搭建TC开发环境详细教程
查看>>
css3背景渐变+2D
查看>>
拓扑图软件技术对比(转载)
查看>>
学习笔记——CDQ分治
查看>>