Irrelevant thoughts of an oracle DBA

4 February 2008

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

Filed under: backup — dhoogfr @ 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.

3 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

  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

  3. yogesh,

    I did not know that, thanks for the tip

    Comment by dhoogfr — 9 April 2008 @ 17:58

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.