Irrelevant thoughts of an oracle DBA

4 February 2008

rman backup to tape when you don’t have a tape

Filed under: backup — Freek D'Hooge @ 23:14

Something I already knew for a couple of years, but recently rediscovered it: rman has the possibility to mimic a backup to tape.
You can do this by specifying the oracle test disk api when allocating the channel:

[oracle@ragna oracle]$ cd /opt/oracle
[oracle@ragna oracle]$ mkdir tape_backup
[oracle@ragna oracle]$ export ORACLE_SID=LOKI
[oracle@ragna oracle]$ rman target / nocatalog

Recovery Manager: Release 10.2.0.3.0 - Production on Mon Feb 4 21:04:33 2008

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: LOKI (DBID=2591136617)
using target database control file instead of recovery catalog

RMAN> run {
 allocate channel ch00 device type 'SBT_TAPE'
    PARMS="SBT_LIBRARY=oracle.disksbt,
    ENV=(BACKUP_DIR=/opt/oracle/tape_backup)";
 backup datafile 1 format='%U';
}
2> 3> 4> 5> 6>
allocated channel: ch00
channel ch00: sid=140 devtype=SBT_TAPE
channel ch00: WARNING: Oracle Test Disk API

Starting backup at 04-FEB-08
channel ch00: starting full datafile backupset
channel ch00: specifying datafile(s) in backupset
input datafile fno=00001 name=/opt/oracle/oradata/LOKI/system01.dbf
channel ch00: starting piece 1 at 04-FEB-08
channel ch00: finished piece 1 at 04-FEB-08
piece handle=1dj7t4rb_1_1 tag=TAG20080204T210443 comment=API Version 2.0,MMS Version 8.1.3.0
channel ch00: backup set complete, elapsed time: 00:00:25
channel ch00: starting full datafile backupset
channel ch00: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ch00: starting piece 1 at 04-FEB-08
channel ch00: finished piece 1 at 04-FEB-08
piece handle=1ej7t4s4_1_1 tag=TAG20080204T210443 comment=API Version 2.0,MMS Version 8.1.3.0
channel ch00: backup set complete, elapsed time: 00:00:06
Finished backup at 04-FEB-08
released channel: ch00

RMAN> list backup;

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

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
36      Full    346.25M    SBT_TAPE    00:00:23     04-FEB-08
        BP Key: 36   Status: AVAILABLE  Compressed: NO  Tag: TAG20080204T210443
        Handle: 1dj7t4rb_1_1   Media:
  List of Datafiles in backup set 36
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 2854789    04-FEB-08 /opt/oracle/oradata/LOKI/system01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
37      Full    8.75M      SBT_TAPE    00:00:04     04-FEB-08
        BP Key: 37   Status: AVAILABLE  Compressed: NO  Tag: TAG20080204T210443
        Handle: 1ej7t4s4_1_1   Media:
  Control File Included: Ckp SCN: 2854804      Ckp time: 04-FEB-08
  SPFILE Included: Modification time: 04-FEB-08

RMAN> exit

Recovery Manager complete.
[oracle@ragna oracle]$ ls -lhd tape_backup/
drwxr-xr-x  2 oracle oinstall 4.0K Feb  4 21:05 tape_backup/
[oracle@ragna oracle]$ ls -lh tape_backup/
total 356M
-rw-rw-rw-  1 oracle oinstall 347M Feb  4 21:05 1dj7t4rb_1_1
-rw-rw-rw-  1 oracle oinstall 8.8M Feb  4 21:05 1ej7t4s4_1_1
-rw-r--r--  1 oracle oinstall 2.0K Feb  4 21:05 Oracle_Disk_SBT_Catalog

Neat isn’t it?
But what can you use it for, I hear you say?
Well, euh…..  Testing I suppose or maybe for learning purposes. I’m sure someone might know a good use for it.

Advertisements

11 Comments »

  1. Hi,
    I have been working on an Oracle DBA/Sysadmin Dashboard. What do you think are the key ingredients of a DBA dashboard?

    Your opinion is highly regarded
    Regards
    Nilesh
    Dashboards

    Comment by njethwa — 14 February 2008 @ 21:19 | Reply

  2. Goal
    Backup Flash Recovery Area to Disk Location

    Solution
    The ‘backup recovery area’ command only works with SBT channels. There is a planned fix to allow DISK channels to be supported.

    The RMAN disksbt library, which emulates a SBT library (but writes backups to disk location), can be used as a supported workaround to backup the FRA to a disk location:

    run {
    allocate channel dev1 type sbt parms=’SBT_LIBRARY=oracle.disksbt, ENV=(BACKUP_DIR=/backup)’;
    backup recovery area;
    }

    Comment by Yogesh — 7 April 2008 @ 18:02 | Reply

  3. yogesh,

    I did not know that, thanks for the tip

    Comment by dhoogfr — 9 April 2008 @ 17:58 | Reply

  4. This is really useful for a disk to (network) disk backup of the FRA. So dump the tapes, do normal RMAN disk to disk on a local FRA, then backup the FRA to a mounted network drive. No more tapes. I hate tapes!

    Most useful bit of information.

    Comment by Bill — 21 October 2009 @ 17:26 | Reply

  5. Just wonder how you would manage the space of the pseudo tape area on disk? If the disk location for this is almost full, how would you free up the space in there? Thanks.

    Comment by Long — 17 June 2010 @ 1:10 | Reply

  6. Hi, i dont understand why there is appears this: WARNING:oracle test disk api…is that normal??….please, explain me.

    Comment by Rocio Baez — 28 October 2010 @ 18:46 | Reply

    • Because it is not intended to be a production thing, just for test.
      Hence the warning.

      Comment by Freek — 29 October 2010 @ 14:44 | Reply

      • Thank so much…you’re the best!!!!!… do you think could give me your email, please????….

        Comment by Rocio Baez — 29 October 2010 @ 16:03

  7. One of the Best Tips I have ever got.

    Comment by CSK — 27 November 2010 @ 11:01 | Reply

  8. A couple of questions. I configured RMAN to back up database to FRA and then dump FRA to NFS mounted EMC data domain disk as you mentioned here. First question is, when I crosschecked backupset files after deleting a backupset file for testing, RMAN thought it as ‘AVAILABLE’. RMAN marked it as ‘EXPIRED’ when I crossechecked it again after removing the catalog file named ‘Oracle_Disk_SBT_Catalog’ in the backup directory. I don’t know why. The catalog file is updated or created every time RMAN command is issued. My 2nd question is how to manage backups via retention policy. I need to set two differnt retention policies; one for FRA and one for Data Domain as I want to keep backupset files on Data Domain longer than in FRA. My last question is that we used to back up to VTL Data Domain through Netbackup. One difference is saving license cost of Netbackup client for Oracle. What else difference will there be? Thanks in advance. -Ubee

    Comment by Ubee Kwon — 3 February 2011 @ 4:49 | Reply

  9. how check the rman taking backup into disk or tape in oracle database level ?

    Comment by venkat — 11 June 2014 @ 6:07 | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: