Home > RMAN > Database COLD backup script using RMAN.

Database COLD backup script using RMAN.

October 8, 2011

COLD backup means, taking the backup of the database when db is down. But if we are using RMAN for backup we need to keep the database in mount state.

copy the following contents to a file with name DB_COLD_BACKUP_using_RMAN.rc

=============================================

run {
CONFIGURE CONTROLFILE AUTOBACKUP on;
   shutdown immediate;
   startup mount;
   allocate channel dup1 device type disk;
   allocate channel dup2 device type disk;
   backup database;
   release channel dup1;
   release channel dup2;
   alter database open;
  }

=============================================

Now set the DB environment using your regular method then run the following command.

rman target / @DB_COLD_BACKUP_using_RMAN.rc
Few points:-

1) Here i have not specified any location for backup so it goes to default location. For details, please run “show all” command so that you will come to know where backup will go. if no location is specifed in the config, then it goes directly to FRA area.

2) Ensure that “controlfile autobackup is on;” If not please change the same using following command @ RMAN prompt.

CONFIGURE CONTROLFILE AUTOBACKUP ON;
3) To check the current config details run @RAMN PROMPT.
show all
======================

For reference i am here with mentioning the output the above script.

-bash-3.2$ rman target / @DB_COLD_BACKUP_using_RMAN.tc

Recovery Manager: Release 11.2.0.1.0 – Production on Sat Oct 8 22:22:12 2011

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: TEST (DBID=2058381472)

RMAN> run {
2>    shutdown immediate;
3>    startup mount;
4>    allocate channel dup1 device type disk;
5>    allocate channel dup2 device type disk;
6>    backup database;
7>    release channel dup1;
8>    release channel dup2;
9>    alter database open;
10>   }
11>
using target database control file instead of recovery catalog
database closed
database dismounted
Oracle instance shut down

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area    1975283712 bytes

Fixed Size                     1337436 bytes
Variable Size               1493174180 bytes
Database Buffers             469762048 bytes
Redo Buffers                  11010048 bytes

allocated channel: dup1
channel dup1: SID=134 device type=DISK

allocated channel: dup2
channel dup2: SID=10 device type=DISK

Starting backup at 08-OCT-11
channel dup1: starting full datafile backup set
channel dup1: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/product/oradata/TEST/sysaux01.dbf
input datafile file number=00004 name=/u01/product/oradata/TEST/users01.dbf
input datafile file number=00005 name=/u01/product/oradata/TEST/example01.dbf
channel dup1: starting piece 1 at 08-OCT-11
channel dup2: starting full datafile backup set
channel dup2: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/product/oradata/TEST/system01.dbf
input datafile file number=00003 name=/u01/product/oradata/TEST/undotbs01.dbf
channel dup2: starting piece 1 at 08-OCT-11
channel dup2: finished piece 1 at 08-OCT-11
piece handle=/u01/product/flash_recovery_area/TEST/backupset/2011_10_08/o1_mf_nnndf_TAG20111008T222317_7910004j_.bkp tag=TAG20111008T222317 comment=NONE
channel dup2: backup set complete, elapsed time: 00:02:26
channel dup1: finished piece 1 at 08-OCT-11
piece handle=/u01/product/flash_recovery_area/TEST/backupset/2011_10_08/o1_mf_nnndf_TAG20111008T222317_791000hd_.bkp tag=TAG20111008T222317 comment=NONE
channel dup1: backup set complete, elapsed time: 00:02:48
Finished backup at 08-OCT-11

Starting Control File and SPFILE Autobackup at 08-OCT-11
piece handle=/u01/product/flash_recovery_area/TEST/autobackup/2011_10_08/o1_mf_s_764029346_79105bfv_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 08-OCT-11
released channel: dup1
released channel: dup2

database opened
Recovery Manager complete.
 

RMAN> show all;

RMAN configuration parameters for database with db_unique_name NEWORCL are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘%F’; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM ‘AES128’; # default
CONFIGURE COMPRESSION ALGORITHM ‘BASIC’ AS OF RELEASE ‘DEFAULT’ OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_neworcl.f’; # default

RMAN>

Advertisements
Categories: RMAN
  1. MARCELO
    June 18, 2013 at 6:46 PM

    Thanks, so much.

  1. No trackbacks yet.
Comments are closed.
%d bloggers like this: