RMAN restore from tag

oracleoracle-11g-r2recoveryrman

oracle 11.2.0.4 on redhat 6

SERV1 is prod server running database MAZ, SERV2 is developemt server with no databases on it.

i have noted the dbid and last SCN, and then taken a backup on SERV1 using the following command

run
{
backup database plus archivelog tag "first";
}

now copied all the backup files and a copy of the pfile to SERV2.

on SERV2

rman target /
set dbid 2711958994
startup mount pfile=/u01/app/oracle/product/11.2.0/dbhome_2/dbs/initmaz.ora
run {
set controlfile autobackup format for device type disk to '/u03/app/oracle/fast_recovery_area/TEST/autobackup/2015_05_15/%F';
restore spfile to pfile '/u01/app/oracle/product/11.2.0/dbhome_2/dbs/initmaz.ora' from autobackup;
}

shutdown immediate
startup nomount pfile=/u01/app/oracle/product/11.2.0/dbhome_2/dbs/initmaz.ora

run {
set controlfile autobackup format for device type disk to '/u03/app/oracle/fast_recovery_area/TEST/autobackup/2015_05_15/%F';
restore controlfile from autobackup;
}

alter database mount;

catalog start with '/u03/app/oracle/fast_recovery_area/MAZ/backupset/2015_05_15';

now i checked that the backup set it available on SERV2

rman target /
RMAN> list backup
2> ;

using target database control file instead of recovery catalog

List of Backup Sets
===================


BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
190     6.59M      DISK        00:00:00     15-MAY-15
        BP Key: 190   Status: AVAILABLE  Compressed: YES  Tag: FIRST
        Piece Name: /u03/app/oracle/fast_recovery_area/MAZ/backupset/2015_05_15/o1_mf_annnn_FIRST_bocjlvfk_.bkp

  List of Archived Logs in backup set 190
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    501     1950316    14-MAY-15 1973213    15-MAY-15
  1    502     1973213    15-MAY-15 1973254    15-MAY-15
  1    503     1973254    15-MAY-15 1974268    15-MAY-15
  1    504     1974268    15-MAY-15 1974295    15-MAY-15
  1    505     1974295    15-MAY-15 1974321    15-MAY-15
  1    506     1974321    15-MAY-15 1976213    15-MAY-15
  1    507     1976213    15-MAY-15 1976251    15-MAY-15
  1    508     1976251    15-MAY-15 1977715    15-MAY-15

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
191     Full    76.84M     DISK        00:00:30     15-MAY-15
        BP Key: 191   Status: AVAILABLE  Compressed: YES  Tag: TAG20150515T105436
        Piece Name: /u03/app/oracle/fast_recovery_area/MAZ/backupset/2015_05_15/o1_mf_nnndf_TAG20150515T105436_bocjlwr0_.bkp
  List of Datafiles in backup set 191
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1977721    15-MAY-15 /u02/app/oracle/oradata/maz/system01.dbf
  2       Full 1977721    15-MAY-15 /u02/app/oracle/oradata/maz/sysaux01.dbf
  3       Full 1977721    15-MAY-15 /u02/app/oracle/oradata/maz/undotbs01.dbf
  4       Full 1977721    15-MAY-15 /u02/app/oracle/oradata/maz/users01.dbf

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
192     3.00K      DISK        00:00:00     15-MAY-15
        BP Key: 192   Status: AVAILABLE  Compressed: YES  Tag: FIRST
        Piece Name: /u03/app/oracle/fast_recovery_area/MAZ/backupset/2015_05_15/o1_mf_annnn_FIRST_bocjmzy1_.bkp

  List of Archived Logs in backup set 192
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    509     1977715    15-MAY-15 1977737    15-MAY-15

at this point if i run the following then everything works

run {
set until scn 1977737;
restore database;
recover database;
}

alter database open resetlogs;

but i want to restore using the tag name (FIRST), so i try this

run {
set until scn 1977737;
restore database from TAG=FIRST;
}

and i get message

Starting restore at 15-MAY-15
using channel ORA_DISK_1

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 05/15/2015 13:15:05
RMAN-06026: some targets not found - aborting restore
RMAN-06023: no backup or copy of datafile 4 found to restore
RMAN-06023: no backup or copy of datafile 3 found to restore
RMAN-06023: no backup or copy of datafile 2 found to restore
RMAN-06023: no backup or copy of datafile 1 found to restore

any ideas as to what i am doing wrong?

thanks

Best Answer

Proper backup syntax should have been:

backup database tag "first" plus archivelog tag "first";

Now if you look into your list backup output you can notice that only backupsets with archivelogs has tag FIRST. Backupset containing backup of datafiles has autogenerated tag TAG20150515T105436.