Many a times before a application upgrade, we would like to take a cold backup of the database just to take care of some "mess-up" and would just want to restore it if something goes wrong.
The following is the preferred way for me to take a RMAN cold backup.
Take the BACKUP
===============
Put the DB in mount mode.
rman target / nocatalog<<EOF>backup.log
run{
allocate channel d1 device type disk format '/oracle/arch/rmanbkp/HOMEDB_FULL_%d_%T_%U';
backup as compressed backupset tag rman_backfulcold_HOMEDB database include current controlfile ;
}
EOF
Query from RMAN to see where the control file resides
list backup;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
13 Full 39.13M DISK 00:00:06 04-MAR-13
BP Key: 13 Status: AVAILABLE Compressed: YES Tag: RMAN_BACKFULCOLD_HOMEDB
Piece Name: /oracle/arch/rmanbkp/HOMEDB_FULL_HOMEDB_20130304_0do3ltu7_1_1
List of Datafiles in backup set 13
..
..
..
..
Piece Name: /oracle/arch/rmanbkp/HOMEDB_FULL_HOMEDB_20130304_0no3ltuo_1_1
List of Datafiles in backup set 23
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
28 Full 301818 04-MAR-13 /oracle/oradata02/HOMEDB/data/forumindextabspace01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
24 Full 1.03M DISK 00:00:01 04-MAR-13
BP Key: 24 Status: AVAILABLE Compressed: YES Tag: RMAN_BACKFULCOLD_HOMEDB
Piece Name: /oracle/arch/rmanbkp/HOMEDB_FULL_HOMEDB_20130304_0oo3ltup_1_1
Control File Included: Ckp SCN: 301818 Ckp time: 04-MAR-13
STEPS TO RESTORE
================
startup nomount
Restore the CONTROL FILE from the backup piece identified above.
run
{
allocate channel c1 device type disk format '/oracle/arch/rmanbkp/HOMEDB_FULL_%d_%T_%U';
restore controlfile from '/oracle/arch/rmanbkp/HOMEDB_FULL_HOMEDB_20130304_0oo3ltup_1_1';
}
alter database mount;
run
{
allocate channel c1 device type disk format '/oracle/arch/rmanbkp/HOMEDB_FULL_%d_%T_%U';
restore database from tag='rman_backfulcold_HOMEDB';
}