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;

相关推荐
小草儿7992 小时前
PG18之插件使用大全(简单用例)
数据库
Elastic 中国社区官方博客2 小时前
从 Elasticsearch runtime fields 到 ES|QL:将传统工具适配到当前技术
大数据·数据库·sql·elasticsearch·搜索引擎·全文检索
IAUTOMOBILE2 小时前
Ubuntu 22.04 下 NVIDIA H100 服务器完整部署攻略:驱动、Fabric Manager 与 Container Toolkit 配置
服务器·ubuntu·fabric
刘晨鑫12 小时前
MySQL主从复制与读写分离
数据库·mysql·adb
ClouGence2 小时前
数据迁移同步工具 CloudCanal-v5.5.0.0 发布,支持 RETL(定时扫描同步)
数据库·mysql·postgresql·oracle·sqlserver·kafka·etl
淼淼爱喝水2 小时前
openEuler 下 Ansible 基础命令详解与实操演示1
linux·服务器·ansible
DomDanrtsey2 小时前
oracle与tidb时间格式化函数不兼容简述
数据库·oracle·tidb
Yvonne爱编码2 小时前
数据库---Day4 数据表的操作
数据库
杨云龙UP2 小时前
Linux环境下Oracle RMAN全量、增量备份与定时任务实践_20260331
linux·运维·服务器·数据库·oracle