Forum Stats

  • 3,826,277 Users
  • 2,260,618 Discussions
  • 7,896,861 Comments

Discussions

RMAN Backup

user12274353
user12274353 Member Posts: 1 Blue Ribbon
edited Sep 24, 2021 10:16PM in Recovery Manager (RMAN)

Can we run a RMAN disk backup to a directory which is different from the DB_RECOVERY_FILE_DEST. When I run a disk backup using the following script, backupset (the one containing the datafiles backup) always go to the DB_RECOVERY_FILE_DEST while the archivelog and controlfile backups go to the directory specified in the script. Is there a way, I can backup everything to the directory specified in the backup script?

#/bin/bash

export BKP_DIR=/DUMPDIR/PRODDB1

$ORACLE_HOME/bin/rman target=/ << EOF  

set echo on

show all;

backup 

 as compressed backupset

 database plus archivelog

 format '$BKP_DIR/%I_%d_%Y%M%D_%u';

exit;

EOF

Answers

  • EdStevens
    EdStevens Member Posts: 28,778 Gold Crown
    edited Sep 26, 2021 1:39AM

    Did you take a look at the documentation? The syntax chart for the BACKUP command shows that the BACKUP DATABASE and the PLUS ARCHIVELOG each have their own FORMAT options.

    ---- Edit to add comment, several hours after original

    In other words, you specified FORMAT for the PLUS ARCHIVE LOG, thus overriding FRA spec, but you did not supply a FORMAT for the basic BACKUP DATABASE, thus causing that to default to the FRA.

  • Nikhil Kotak
    Nikhil Kotak Member Posts: 5 Red Ribbon

    use the format option as below.


    rman target / << EOF > backup_${dt}.log

    CONFIGURE DEVICE TYPE DISK PARALLELISM 5 BACKUP TYPE TO BACKUPSET;

    run

    {

    allocate channel disk1 type disk maxopenfiles 8 maxpiecesize 8G format '/file/systen/path/%d_%u_%s_%p_HOT_0_${dt2}.dbf';

    allocate channel disk2 type disk maxopenfiles 8 maxpiecesize 8G format '/file/systen/path/%d_%u_%s_%p_HOT_0_${dt2}.dbf';

    allocate channel disk3 type disk maxopenfiles 8 maxpiecesize 8G format '/file/systen/path/%d_%u_%s_%p_HOT_0_${dt2}.dbf';

    allocate channel disk4 type disk maxopenfiles 8 maxpiecesize 8G format '/file/systen/path/%d_%u_%s_%p_HOT_0_${dt2}.dbf';

    allocate channel disk5 type disk maxopenfiles 8 maxpiecesize 8G format '/file/systen/path/%d_%u_%s_%p_HOT_0_${dt2}.dbf';

    allocate channel disk6 type disk maxopenfiles 8 maxpiecesize 8G format '/file/systen/path/%d_%u_%s_%p_HOT_0_${dt2}.dbf';

    backup current controlfile format '/file/systen/path/%d_%u_%s_%p_Controlfile_Backup_${dt2}.ctl';

    report schema;

    crosscheck archivelog all;

    backup incremental level 0 as compressed backupset

    (database include current controlfile for standby filesperset 12 tag 'HOT_0_${dt2}');

    release channel disk1; release channel disk2; release channel disk3; release channel disk4;release channel disk5;

    sql "alter system archive log current";

    allocate channel arch1 type disk maxpiecesize 8G format '/file/systen/path/%d_%u_%s_%p_ARCH_0_${dt2}.arch';

    allocate channel arch2 type disk maxpiecesize 8G format '/file/systen/path/%d_%u_%s_%p_ARCH_0_${dt2}.arch';

    allocate channel arch3 type disk maxpiecesize 8G format '/file/systen/path/%d_%u_%s_%p_ARCH_0_${dt2}.arch';

    backup incremental level 0 as compressed backupset

    (archivelog all);

    release channel arch1; release channel arch2; release channel arch3;

    }

    EOF