Copy Backupsets from ASM to Local File System

SQL> alter system set db_recovery_file_dest_size = 20g;
System altered.

SQL> alter system set db_recovery_file_dest = '+FRA';
System altered.

SQL> alter database open;
Database altered.

oracle@rac01{MYDBA1}/apps/oracle> rman target /
RMAN> backup database plus archivelog delete input;

Starting backup at 30-MAY-11
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=28 instance=MYDBA1 device type=DISK
piece handle=+FRA/mydba/backupset/2011_05_30/annnf0_tag20110530t221427_0.320.752537669 tag=TAG20110530T221427 comment=NONE
piece handle=+FRA/mydba/backupset/2011_05_30/nnndf0_tag20110530t221430_0.318.752537671 tag=TAG20110530T221430 comment=NONE
piece handle=+FRA/mydba/backupset/2011_05_30/ncsnf0_tag20110530t221430_0.319.752537717 tag=TAG20110530T221430 comment=NONE
piece handle=+FRA/mydba/backupset/2011_05_30/annnf0_tag20110530t221520_0.322.752537721 tag=TAG20110530T221520 comment=NONE

Finished backup at 30-MAY-11

RMAN> list backup;

List of Backup Sets
===================
BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
1       51.25M     DISK        00:00:01     30-MAY-11     
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20110530T221427
        Piece Name: +FRA/mydba/backupset/2011_05_30/annnf0_tag20110530t221427_0.320.752537669

  List of Archived Logs in backup set 1
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    370     21024735   30-MAY-11 21065551   30-MAY-11
  2    348     21058468   30-MAY-11 21064126   30-MAY-11

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    1.52G      DISK        00:00:44     30-MAY-11     
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20110530T221430
        Piece Name: +FRA/mydba/backupset/2011_05_30/nnndf0_tag20110530t221430_0.318.752537671
  List of Datafiles in backup set 2
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 21065563   30-MAY-11 +DATA/mydba/datafile/system.256.724854319
  2       Full 21065563   30-MAY-11 +DATA/mydba/datafile/sysaux.257.724854321
  3       Full 21065563   30-MAY-11 +DATA/mydba/datafile/undotbs1.258.724854323
  4       Full 21065563   30-MAY-11 +DATA/mydba/datafile/users.259.724854323
  5       Full 21065563   30-MAY-11 +DATA/mydba/datafile/undotbs2.264.724854533

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3       Full    17.70M     DISK        00:00:01     30-MAY-11     
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20110530T221430
        Piece Name: +FRA/mydba/backupset/2011_05_30/ncsnf0_tag20110530t221430_0.319.752537717
  SPFILE Included: Modification time: 30-MAY-11
  SPFILE db_unique_name: MYDBA
  Control File Included: Ckp SCN: 21065725     Ckp time: 30-MAY-11

BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
4       8.00K      DISK        00:00:01     30-MAY-11     
        BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: TAG20110530T221520
        Piece Name: +FRA/mydba/backupset/2011_05_30/annnf0_tag20110530t221520_0.322.752537721

  List of Archived Logs in backup set 4
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    371     21065551   30-MAY-11 21065731   30-MAY-11

RMAN> backup backupset 1,2,3,4 format '/oracle/backup/testrman/%U';
 รจ this command is to backup the backupsets from ASM ‘+FRA’ to file system /data/backup/testrman

+FRA/mydba/backupset/2011_05_30/annnf0_tag20110530t221427_0.320.752537669
piece handle=/oracle/backup/testrman/01mdlk23_1_2 comment=NONE
+FRA/mydba/backupset/2011_05_30/nnndf0_tag20110530t221430_0.318.752537671
piece handle=/oracle/backup/testrman/02mdlk26_1_2 comment=NONE
+FRA/mydba/backupset/2011_05_30/ncsnf0_tag20110530t221430_0.319.752537717
piece handle=/oracle/backup/testrman/03mdlk3k_1_2 comment=NONE
channel ORA_DISK_1: finished piece 1 at 30-MAY-11
channel ORA_DISK_1: backup piece complete, elapsed time: 00:00:01
 +FRA/mydba/backupset/2011_05_30/annnf0_tag20110530t221520_0.322.752537721
piece handle=/oracle/backup/testrman/04mdlk3o_1_2 comment=NONE
channel ORA_DISK_1: finished piece 1 at 30-MAY-11
channel ORA_DISK_1: backup piece complete, elapsed time: 00:00:01
Finished backup at 30-MAY-11

RMAN> backup spfile include current controlfile format '/oracle/backup/testrman/source_ctl';
piece handle=/oracle/backup/testrman/source_ctl tag=TAG20110530T222524 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 30-MAY-11

Then you can copy these backup pieces to a new server and restore the database on file system.  You will need to restore spfile from the source backup and create spfile from pfile.  You need to modify the pfile for these parameters  (control_files, db_create_file_dest, db_file_name_convert, log_file_name_convert, undo_tablespace) .  After that, you can restore control file, restore database, recover database until cancel using backup controlfile, and open database resetlogs.


1 comment:

  1. Thank you for the clean explanation. But how to automate the script that picks the very latest backupsets and copy it to the file system to put on the offsite tapes.?

    Barry

    ReplyDelete