###########1

1.查看备库的scn

⚠️如果控制文件,数据文件,数据文件头部的scn不一致,需要根据日志中的gap的起始sequence# 找到对应的scn

col  current_scn for a999999999;

select current_scn from v$database;

2.查看主库在断点后是否添加数据文件

select file#,name, from  v$datafile where current_change#>=备库查得的断电处scn;

3.备库停止日志应用服务

alter database recover managed standby  database cancel;

4.主库增量备份并传输到备库上

RMAN> backup as compressed backupset incremental from scn 断点处的scn database format ‘备份存放路径’

scp

5.备库上进行恢复

RMAN>catalog START with ‘拷贝过来的主库的增量备份集的路径’

⚠️ 如果此时库是read only,需要转换为mount状态。

RMAN>recover database noredo

6.主库上创建standby controlfile 文件并scp到备库

RMAN>backup current controlfile for standby format '备份路径‘;

7.恢复备库的控制文件

备库重启到nomount状态,恢复控制文件,启动到mount

RMAN>restore standby controlfile from '主库的控制文件的rman备份文件'

RMAN>alter database open mount

8.清空备库日志组(选做)

⚠️如果dg中使用了standby log 模式,不需要此步骤,否则有几组需要清空几组。

alter database clear logfile group 组号;

9.备库重设flashback(选做)

alter database flashback on/off;

10.备库重新接收并应用日志

alter database recover managed standby database using current logfile disconnect from session;

11.开启备库到redo only状态

alter database recover managed standby database cancel;

alter database open;

alter database recover managed standby database using current logfile disconnect from session;

12.验证修复是否成功

在主库端执行:alter system switch logfile;

在各个备库中执行:select max(sequence#) from v$arhcived_log;

######2

1.Rolling a Standby Forward using an RMAN Incremental Backup To Fix The Nologging Changes

STEPS

1. Follow this step-by-step procedure to roll forward a physical standby database for which nologging changes have been  applied to a small subset of the database:

1. List the files that have had nologging changes applied by querying the V$DATAFILE view on the standby database. For example:

SQL> SELECT FILE#, FIRST_NONLOGGED_SCN FROM V$DATAFILE WHERE FIRST_NONLOGGED_SCN > 0;

FILE#      FIRST_NONLOGGED_SCN
---------- -------------------
         4              225979
         5              230184

2. Stop Redo Apply on the standby database:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

3. On the standby database, offline the datafiles (recorded in step 0) that have had nologging changes. Taking these datafiles offline ensures redo data is not skipped for the corrupt blocks while the incremental backups are performed.

SQL> ALTER DATABASE DATAFILE 4 OFFLINE FOR DROP;
SQL> ALTER DATABASE DATAFILE 5 OFFLINE FOR DROP;

4. Start Redo Apply on the standby database:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;

5. While connected to the primary database as the RMAN target, create an incremental backup for each datafile listed in the FIRST_NONLOGGED_SCN column (recorded in step 0). For example:

RMAN> BACKUP INCREMENTAL FROM SCN 225979 DATAFILE 4 FORMAT '/tmp/ForStandby_%U' TAG 'FOR STANDBY';
RMAN> BACKUP INCREMENTAL FROM SCN 230184 DATAFILE 5 FORMAT '/tmp/ForStandby_%U' TAG 'FOR STANDBY';

6. Transfer all backup sets created on the primary system to the standby system. (Note that there may be more than one backup file created.)

% scp /tmp/ForStandby_* standby:/tmp

7. While connected to the physical standby database as the RMAN target, catalog all incremental backup pieces. For example:

RMAN> CATALOG START WITH '/tmp/ForStandby_';

8. Stop Redo Apply on the standby database:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

9. Online the datafiles on the standby database

SQL> ALTER DATABASE DATAFILE 4 ONLINE;
SQL> ALTER DATABASE DATAFILE 5 ONLINE;

10. While connected to the physical standby database as the RMAN target, apply the incremental backup sets:

RMAN> RECOVER DATAFILE 4, 5 NOREDO;

11. Query the V$DATAFILE view on the standby database to verify there are no datafiles with nologged changes. The following query should return zero rows

SQL> SELECT FILE#, FIRST_NONLOGGED_SCN FROM V$DATAFILE WHERE FIRST_NONLOGGED_SCN > 0;

12. Recreate the Standby Controlfile following:

Note 459411.1 Steps to recreate a Physical Standby Controlfile

13. Remove the incremental backups from the standby system:

RMAN> DELETE BACKUP TAG 'FOR STANDBY';

14. Manually remove the incremental backups from the primary system. For example, the following example uses the Linux rm command:

% rm /tmp/ForStandby_*

15. Start Redo Apply on the standby database:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;

Note: Starting from 12c we can use RECOVER DATABASE...FROM SERVICE clause in RMAN to generate, transfer and apply the incremental backup in a single step. Please refer below document for examples:

Note 1987763.1 ROLLING FORWARD A PHYSICAL STANDBY USING RECOVER FROM SERVICE COMMAND IN 12C 

2. Follow this step-by-step procedure to roll forward a physical standby database for which nologging changes have been applied to a large portion of the database:

1. Query the V$DATAFILE view on the standby database to record the lowest FIRST_NONLOGGED_SCN:

SQL> SELECT MIN(FIRST_NONLOGGED_SCN) FROM V$DATAFILE WHERE FIRST_NONLOGGED_SCN>0;

MIN(FIRST_NONLOGGED_SCN)
------------------------
                  223948

2.Stop Redo Apply on the standby database:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

3.While connected to the primary database as the RMAN target, create an incremental backup from the lowest FIRST_NONLOGGED_SCN (recorded in step 0)

RMAN> BACKUP INCREMENTAL FROM SCN 223948 DATABASE FORMAT '/tmp/ForStandby_%U' tag 'FOR STANDBY';

4.Transfer all backup sets created on the primary system to the standby system. (Note that more than one backup file may have been created.) The following example uses the scp command to copy the files:

% scp /tmp/ForStandby_* standby:/tmp

5.While connected to the standby database as the RMAN target, catalog all incremental backup piece(s)

RMAN> CATALOG START WITH '/tmp/ForStandby_';

6.While connected to the standby database as the RMAN target, apply the incremental backups:

RMAN> RECOVER DATABASE NOREDO;

7.Query the V$DATAFILE view to verify there are no datafiles with nologged changes. The following query on the standby database should return zero rows:

SQL> SELECT FILE#, FIRST_NONLOGGED_SCN FROM V$DATAFILE WHERE FIRST_NONLOGGED_SCN > 0;

8. Recreate the Standby Controlfile following:

Note 459411.1 Steps to recreate a Physical Standby Controlfile

9.Remove the incremental backups from the standby system:

RMAN> DELETE BACKUP TAG 'FOR STANDBY';

10.Manually remove the incremental backups from the primary system. For example, the following removes the backups using the Linux rm command:

% rm /tmp/ForStandby_*

11.Start Redo Apply on the standby database:

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;

Note:

If the affected files belong to a READ ONLY tablespace, those files will be ignored during backup. To bypass the issue, at Primary Database, switch the tablespace from read only to read write and back to read only again :

SQL> alter tablespace <tablespace_name> read write ;
SQL> alter tablespace <tablespace_name> read only ;

解决gap 采用increapment scn 方式 操作。的更多相关文章

  1. Win10 64位系统ADO方式操作数据库失败解决方法

    VC操作Access数据库一般通过ODBC.ADO.DAO等方式,但在我的Win10 64位操作系统中,通过ADO方式操作数据库会失败,无法读取数据.解决方法:1.首先确保Win10操作系统ado目录 ...

  2. java线程基础巩固---Thread中断Interrupt方法学习&采用优雅的方式结束线程生命周期

    Interrupt学习: 在jdk中关于interrupt相关方法有三个,如下: 关于上面的疑问会在稍后进行阐述滴,下面看代码: 编译运行: 应该说是t线程为啥在被打断之后没有退出,还是在运行状态,这 ...

  3. 采用OLEDB数据库方式向指定的Excel添加数据,怪像!

    我们都知道,对Excel进行操作,其实方法是多种多样的,例如采用Office.Interop;例如采用ASPCell:例如采用NPOI:再例如采用数据库连接的方式OLEDB,etc. 还是先说说背景吧 ...

  4. 分布式理论基础(一)一致性及解决一致性的两种方式:2PC和3PC (转载 不错)

    分布式理论基础(一)一致性及解决一致性的两种方式:2PC和3PC 1 一致性 1.1 简述 一致性,是指对每个节点一个数据的更新,整个集群都知道更新,并且是一致的 假设一个具有N个节点的分布式系统,当 ...

  5. 无法开机 如果您的手机黑屏无法开机,可以按照以下方式操作尝试: 如果是,使用原装充电器或使用弱电流方式充电(例如使用电脑USB接口充电)充电15-30分钟后尝试重新开机;注意:电量过低引起的无法开机,刚插入充电器时可能不亮屏但呼吸灯闪烁状态。

    https://www.mi.com/service/support/startup 无法开机 如果您的手机黑屏无法开机,可以按照以下方式操作尝试: 技术支持 如何刷机 无法开机 手机自动关机.重启 ...

  6. 用面向对象的方式操作 JSON 甚至还能做四则运算 JSON 库

    前言 在之前实现的 JSON 解析器中当时只实现了将一个 JSON 字符串转换为一个 JSONObject,并没有将其映射为一个具体的 struct:如果想要获取值就需要先做断言将其转换为 map 或 ...

  7. java 22 - 13 多线程之解决线程安全问题的实现方式2

    上一章说了,解决线程安全问题的实现方式1是使用同步代码块 同时也知道了,同步代码块的锁对象是任意对象:(Object obj ;  Demo d;)这些都行 那么,现在来说解决线程安全问题的实现方式2 ...

  8. document.compatMode(判断当前浏览器采用的渲染方式)

    转载自:http://www.cnblogs.com/fullhouse/archive/2012/01/17/2324706.html IE对盒模型的渲染在 Standards Mode和Quirk ...

  9. 数据在内存中的存储方式( Big Endian和Little Endian的区别 )(x86系列则采用little endian方式存储数据)

    https://www.cnblogs.com/renyuan/archive/2013/05/26/3099766.html 1.故事的起源 “endian”这个词出自<格列佛游记>.小 ...

随机推荐

  1. Operating System-Process(2)进程表&&中断处理

    上一篇文章阐述了进程的基本信息,本文主要介绍进程的实现,主要内容: 进程表(Process Table or Process Control Blocks) 中断处理(Interrupt) 一.进程表 ...

  2. bzoj 1927 星际竞速 —— 最小费用最大流

    题目:https://www.lydsy.com/JudgeOnline/problem.php?id=1927 首先注意到这是个DAG: 考虑每个点从哪里来,可以是瞬移来的,也可以是从某个点走过来的 ...

  3. Java中String和byte[]间的 转换

    数据库的字段中使用了blob类型时,在entity中此字段可以对应为byte[] 类型,保存到数据库中时需要把传入的参数转为byte[]类型,读取的时候再通过将byte[]类型转换为String类型. ...

  4. JavaScript-Tool:jquery.cookie.js

    ylbtech-JavaScript-Tool:jquery.cookie.js 1.返回顶部 1.jquery.cookie.js /*! * jQuery Cookie Plugin v1.4.0 ...

  5. shell入门-awk-2

    awk的条件操作符 ///显示第一段有root的行 [root@wangshaojun ~]# awk -F ':' '$1=="root"' 1.txtroot:x:0:0:ro ...

  6. Antiprime数-数论

    题目描述 Description 如果一个自然数n满足:所有小于它的自然数的约数个数都小于n的约数个数,则称n是一个Antiprime数.譬如:1.2.4.5.12.24都是Antiprime数.   ...

  7. wdcp安全设置,让你的后台,只有你自己能访问

    wdcp安全设置,让你的后台,只有你自己能访问 wdcp的后台,默认端口,是8080,可以修改为其它端口wdcp的后台,可以限制IP地址的访问,也可以限制域名的访问做了这些限制与设置后,已相对安全了, ...

  8. [51nod1101]换零钱

    题意:给定钱,计算其能换成零钱的分类种数. 解题关键:完全背包计数. $dp[i][j]$表示前i个物品构成j元的种类数,然后优化一维. #include<bits/stdc++.h> u ...

  9. 利用Admin-LTE项目搭建自己前端的开发框架模板

    1 完整版本 1.1 下载admin-lte项目源代码 github下载地址:点击前往 三少云盘地址:点击前往 1.2 查看admin-lte精简主页源代码 页面地址:点击前往 注意:由源代码可以知道 ...

  10. 6、R语言绘制带errorbar 的柱状图

    转载:http://www.cnblogs.com/xudongliang/p/7283733.html data <- data.frame(mean = c(10, 15), sd = c( ...