Tuesday, 3 December 2013

How to choose the sequence file number to use for restore/duplicate RMAN command?

Connect to the RMAN respositor:

 rman target /

 List the available backups; choose the latest sequence log number and add one when you run the restore/duplicate DB command.
 In the example below, I've used 15628+1


 RMAN>list backup;

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ --------------------
282     302.50K    DISK        00:00:00     03-DEC-2013 13:53:14
        BP Key: 284   Status: AVAILABLE  Compressed: YES  Tag: ENV_52_DB_BKP
        Piece Name: /TESTDB11/ora_data02/RMAN_backup/TESTDB11/TESTDB11_UAT52_TBS_DB_BKUP_13:52:58-12-03-2013_1_287.rman

  List of Archived Logs in backup set 282
  Thrd Seq     Low SCN    Low Time             Next SCN   Next Time
  ---- ------- ---------- -------------------- ---------- ---------
  1    15625   10218583388335 03-DEC-2013 13:35:02 10218583388844 03-DEC-2013 13:45:02
  1    15626   10218583388844 03-DEC-2013 13:45:02 10218583389173 03-DEC-2013 13:53:13
  1    15627   10218583389173 03-DEC-2013 13:53:13 10218583389183 03-DEC-2013 13:53:13

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ --------------------
283     Full    4.47G      DISK        00:14:43     03-DEC-2013 14:08:01
        BP Key: 285   Status: AVAILABLE  Compressed: YES  Tag: ENV_52_DB_BKP
        Piece Name: /TESTDB11/ora_data02/RMAN_backup/TESTDB11/TESTDB11_UAT52_TBS_DB_BKUP_13:52:58-12-03-2013_1_288.rman
  List of Datafiles in backup set 283
  File LV Type Ckp SCN    Ckp Time             Name
  ---- -- ---- ---------- -------------------- ----
  1       Full 10218583389193 03-DEC-2013 13:53:18 /TESTDB11/ora_data00/system_TESTDB11_01.dbf
  2       Full 10218583389193 03-DEC-2013 13:53:18 /TESTDB11/ora_data00/sysaux_TESTDB11_01.dbf
  3       Full 10218583389193 03-DEC-2013 13:53:18 /TESTDB11/ora_data00/undotbs_TESTDB11_01.dbf
  4       Full 10218583389193 03-DEC-2013 13:53:18 /TESTDB11/ora_data00/tools_TESTDB11_01.dbf
  9       Full 10218583389193 03-DEC-2013 13:53:18 /TESTDB11/ora_data00/bmluapp52_TESTDB11_01.dbf
  28      Full 10218583389193 03-DEC-2013 13:53:18 /TESTDB11/ora_data00/bmluref52_TESTDB11_01.dbf
  47      Full 10218583389193 03-DEC-2013 13:53:18 /TESTDB11/ora_data00/bmluopr52_TESTDB11_01.dbf
  67      Full 10218583389193 03-DEC-2013 13:53:18 /TESTDB11/ora_data00/bmluref52f_TESTDB11_01.dbf
  70      Full 10218583389193 03-DEC-2013 13:53:18 /TESTDB11/ora_data00/bmluapp52f_TESTDB11_01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ --------------------
284     Full    1.33M      DISK        00:00:01     03-DEC-2013 14:08:04
        BP Key: 286   Status: AVAILABLE  Compressed: YES  Tag: ENV_52_DB_BKP
        Piece Name: /TESTDB11/ora_data02/RMAN_backup/TESTDB11/TESTDB11_UAT52_TBS_DB_BKUP_13:52:58-12-03-2013_1_289.rman
  Control File Included: Ckp SCN: 10218583390120   Ckp time: 03-DEC-2013 14:08:03

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ --------------------
285     1.38M      DISK        00:00:00     03-DEC-2013 14:08:05
        BP Key: 287   Status: AVAILABLE  Compressed: YES  Tag: ENV_52_DB_BKP
        Piece Name: /TESTDB11/ora_data02/RMAN_backup/TESTDB11/TESTDB11_UAT52_TBS_DB_BKUP_13:52:58-12-03-2013_1_290.rman

  List of Archived Logs in backup set 285
  Thrd Seq     Low SCN    Low Time             Next SCN   Next Time
  ---- ------- ---------- -------------------- ---------- ---------
  1    15628   10218583389183 03-DEC-2013 13:53:13 10218583390129 03-DEC-2013 14:08:05

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ --------------------
286     Full    1.33M      DISK        00:00:01     03-DEC-2013 14:08:08
        BP Key: 288   Status: AVAILABLE  Compressed: YES  Tag: TAG20131203T140807
        Piece Name: /TESTDB11/ora_data02/RMAN_backup/TESTDB11/ctl/CTLBKP_TESTDB11_13:52:58-12-03-2013.CTL
  Control File Included: Ckp SCN: 10218583390148   Ckp time: 03-DEC-2013 14:08:07

 The duplicate command looks like:

 RUN {
SET NEWNAME FOR DATAFILE 1  TO '/testdb11/ora_data02/RMAN_backup/auxiliary_dest/dbf/system01.dbf';
SET NEWNAME FOR DATAFILE 2  TO '/testdb11/ora_data02/RMAN_backup/auxiliary_dest/dbf/sysaux.dbf';
SET NEWNAME FOR DATAFILE 3  TO '/testdb11/ora_data02/RMAN_backup/auxiliary_dest/dbf/undotbs01.dbf';
SET NEWNAME FOR DATAFILE 4  TO '/testdb11/ora_data02/RMAN_backup/auxiliary_dest/dbf/tools01.dbf';
SET NEWNAME FOR DATAFILE 9  TO '/testdb11/ora_data02/RMAN_backup/auxiliary_dest/dbf/bmluapp52.dbf';
set until sequence 15629 thread 1;
DUPLICATE TARGET DATABASE TO AUXU
TABLESPACE test52,TOOLS
  LOGFILE
    GROUP 1 ('/testdb11/ora_data02/RMAN_backup/auxiliary_dest/redo/redo01a.log',
             '/testdb11/ora_data02/RMAN_backup/auxiliary_dest/redo/redo01b.log') SIZE 200M reuse,
    GROUP 2 ('/testdb11/ora_data02/RMAN_backup/auxiliary_dest/redo/redo02a.log',
             '/testdb11/ora_data02/RMAN_backup/auxiliary_dest/redo/redo02b.log') SIZE 200M reuse;

}

No comments:

Post a Comment