restore archivelog RAC thread from sequence logseq

复制代码
crosscheck archivelog from logseq 7057 until logseq 7060 

restore archivelog from sequence x1 until sequence x2 thread 1;

ADG:restore clone archivelog from sequence 55 until sequence 56;

Applies To

All Users

Summary

When there is a gap between the primary and the physical standby databases, and the archive log files are on ASM on both the primary and the standby sites,

how to move the missing archive log files from the primary site ASM diskgroup to the standby site ASM diskgroup?

Solution

NOTE: In 11g, you can use RMAN to copy the files across the network. See <Note 1909235.1> Copy database file directly across network using RMAN in 11g including Primary and Standby

Please use the rman scripts below to backup missing archive log files from the primary site and restore to the standby site.

RMAN> run {

allocate channel c1 type disk;

backup archivelog from sequence x1 until sequence x2 thread 1 format '/<path on Primary>/arch_%U';

}

Then use the same script to backup for thread 2. For example,

RMAN> run {

allocate channel c1 type disk;

backup archivelog from sequence x1 until sequence x2 thread 2 format '/<path on Primary>/arch_%U';

}

Note: Please make sure the directory path /<path on Primary>/ exists on the primary site or use any other existing path.

Copy the backup pieces from the primary site to the standby site. Then restore them by

RMAN> run

{

catalog start with '/<Directory path on standby where backuppiece was copied>/';

allocate channel c1 type disk ;

restore archivelog from sequence x1 until sequence x2 thread 1;

}

Use the same script to restore for thread 2 archive log files.

RMAN> run

{

catalog start with '/<Directory path on standby where backuppiece was copied>/';

allocate channel c1 type disk ;

restore archivelog from sequence x1 until sequence x2 thread 2;

}

Note: Please make sure the path /oraback/arch/ exists on the standby site.

Summary

The note describes how to find a GAP and resolve it in case of ASM on both primary and standby or ASM on either primary or standby.

NOTE: In the images and/or the document content below, the user information and environment data used represents fictitious data from the Oracle sample schema(s), Public Documentation delivered with an Oracle database product or other training material. Any similarity to actual environments, actual persons, living or dead, is purely coincidental and not intended in any manner.

For the purposes of this document, the following fictitious environment is used as an example to describe the procedure:

Primary Database:
DB_NAME: PRIM

Standby Database:
DB_UNIQUE_NAME: STDBY

Diskgroup name is +DGROUP2

Solution

OPTION -I : Copy archivelog

OPTION II : Take backup of archivelog

OPTION -I:

  1. Check for the GAP,

On standby,

SQL>SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP;

  1. On primary Check the location where the missing logfiles exist.

SELECT NAME FROM V$ARCHIVED_LOG WHERE THREAD#=<n> AND DEST_ID=<n> AND SEQUENCE# BETWEEN <LOW_SEQUENCE#> AND <HIGH_SEQUENCE#>;

For example,

SQL> SELECT * FROM V$ARCHIVE_GAP;

THREAD# LOW_SEQUENCE# HIGH_SEQUENCE#


1 1113 1115

SQL> SELECT NAME FROM V$ARCHIVED_LOG WHERE THREAD#=1 AND DEST_ID=1 AND SEQUENCE# BETWEEN 1113 AND 1115;

NAME


+DGROUP2/PRIM/datafile/ARC00001113_0732997804.001

+DGROUP2/PRIM/datafile/ARC00001114_0732997804.001

+DGROUP2/PRIM/datafile/ARC00001115_0732997804.001

  1. Use RMAN to copy to someother local filesystem.

RMAN>copy archivelog '+DGROUP2/PROD/datafile/ARC00001113_0732997804.001' to '/u01/app/oracle/ARC00001113_0732997804.001';

Do the same for all the logs.

  1. SCP to standby.

scp /u01/app/oracle/ARC00001113_0732997804.001 remoteusername@destination_host_ofstandby:/u01/app/oracle/

  1. Register manually by mentioning the copied file location.

On standby,

SQL>alter database register logfile '/u01/app/oracle/ARC00001113_0732997804.001';

NOTE : Alternatively we can copy this archive log to standby ASM location and then do a register.

On standby,

$rman target /

RMAN>copy archivelog '/u01/app/oracle/ARC00001113_0732997804.001' to '+DGROUP2/STDBY/datafile/ARC00001113_0732997804.001';

Now register,

SQL>alter database register logfile '+DGROUP2/STDBY/datafile/ARC00001113_0732997804.001';

OPTION - II-----十几个node 不得累死

Please use the rman scripts below to backup missing archive log files from the primary site and restore to the standby site.

RMAN> run {

allocate channel c1 type disk;

backup archivelog from sequence x1 until sequence x2 thread 1 format '/oraback/arch/arch_%U';

}

Then use the same script to backup for thread 2. For example,

RMAN> run {

allocate channel c1 type disk;

backup archivelog from sequence x1 until sequence x2 thread 2 format '/oraback/arch/arch_%U';

}

Note: Please make sure the path /oraback/arch/ exists on the primary site or use any other existing path.

Copy the backup pieces from the primary site to the standby site. Then restore them by

RMAN> run

{

catalog start with '/oraback/arch/';

allocate channel c1 type disk ;

restore archivelog from sequence x1 until sequence x2 thread 1;

}

Use the same script to restore for thread 2 archive log files.

RMAN> run

{

catalog start with '/oraback/arch/';

allocate channel c1 type disk ;

restore archivelog from sequence x1 until sequence x2 thread 2;

}

Note: Please make sure the path /oraback/arch/ exists on the standby site.

---------------from from sequence thread 很复杂,简化

RMAN> show RETENTION POLICY;

RMAN configuration parameters are:

CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;

RMAN> restore archivelog from time='SYSDATE-7' validate;

相关推荐
2301_816660211 小时前
mysql在生产环境执行DDL的风险_如何使用GH-OST在线修改
jvm·数据库·python
DARLING Zero two♡1 小时前
【MySQL数据库】数据库基础
数据库·mysql
m0_743623921 小时前
mysql如何限制用户连接数_使用MAX_USER_CONNECTIONS优化并发
jvm·数据库·python
解救女汉子1 小时前
如何防止SQL注入式非法删除_使用预处理语句绑定参数
jvm·数据库·python
2301_782659181 小时前
C#怎么将集合分块处理_C#如何使用Chunk方法【实战】
jvm·数据库·python
codeejun1 小时前
每日一Go-55、分布式 ID 生成(雪花算法 / Segment / Redis / DB)
数据库·分布式·golang
qq_424098561 小时前
如何分析enq- TM - contention_外键未建索引导致的表级锁阻塞
jvm·数据库·python
瀚高PG实验室1 小时前
管理工具无法连接数据库,但是navicat可以正常连接
运维·数据库·瀚高数据库
qq_334563551 小时前
如何让水平滚动条始终固定在页面底部可见
jvm·数据库·python
HHHHH1010HHHHH1 小时前
Golang怎么用Go实现待办事项API_Golang如何用RESTful风格实现Todo应用后端接口【教程】
jvm·数据库·python