Showing posts with label Archive Log backup. Show all posts
Showing posts with label Archive Log backup. Show all posts

Thursday 23 November 2017

Time Based Archivelog Backup in Oracle 11gR2 RMAN

Scenario:

Sometimes we need to take archive log backup for specific time, so we can use the following steps for this purpose

Solution:

bash-4.2$ rman target sys/sys123

Recovery Manager: Release 11.2.0.4.0 - Production on Thu Nov 23 16:22:49 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=214666078)

RMAN> run {
2>      allocate channel ch1 type disk;
3>       backup archivelog from time "TO_DATE('11/20/2017 10:00:00', 'MM/DD/YYYY hh24:mi:ss')"
4>       until time "TO_DATE('11/23/2017 12:00:00', 'MM/DD/YYYY hh24:mi:ss')" format '/bak_archive/ARC0_ORCL_%U_%T';
5>       BACKUP AS COMPRESSED BACKUPSET CURRENT CONTROLFILE format '/bak_archive/CONTROL0_ORCL_%U_%T';
6> }

using target database control file instead of recovery catalog
allocated channel: ch1
channel ch1: SID=5673 instance=ORCL device type=DISK

Starting backup at 23-NOV-17
channel ch1: starting archived log backup set
channel ch1: specifying archived log(s) in backup set
input archived log thread=1 sequence=56 RECID=54439 STAMP=960793631
input archived log thread=2 sequence=57 RECID=54438 STAMP=960793630
channel ch1: starting piece 1 at 23-NOV-17
channel ch1: finished piece 1 at 23-NOV-17
piece handle=/bak_archive/ARC0_ORCL_crska3j7_1_1_20171123 tag=TAG20171123T162303 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:01
Finished backup at 23-NOV-17

Starting backup at 23-NOV-17
channel ch1: starting compressed full datafile backup set
channel ch1: specifying datafile(s) in backup set
including current control file in backup set
channel ch1: starting piece 1 at 23-NOV-17
channel ch1: finished piece 1 at 23-NOV-17
piece handle=/bak_archive/CONTROL0_ORCL_csska3j8_1_1_20171123 tag=TAG20171123T162304 comment=NONE
channel ch1: backup set complete, elapsed time: 00:00:01
Finished backup at 23-NOV-17
released channel: ch1

RMAN> exit


Recovery Manager complete.
bash-4.2$

If we want to take archive log backup with sequence and kept in tape then use the following script

RUN
{
  ALLOCATE CHANNEL T1 TYPE 'sbt_tape' PARMS
    'ENV=(TDPO_OPTFILE=)' ;

  SET ARCHIVELOG DESTINATION TO '/bak_archive/archivelog';
  RESTORE ARCHIVELOG FROM SEQUENCE 3389 ;

  RELEASE CHANNEL T1;
}

If we want to report RMAN backup information for specific time the use the following script

LIST BACKUP OF ARCHIVELOG
  FROM TIME "TO_DATE('11/20/2017 10:00:00', 'MM/DD/YYYY hh24:mi:ss')"
  UNTIL TIME "TO_DATE('11/23/2017 12:00:00', 'MM/DD/YYYY hh24:mi:ss')";