Backup a complete database:
(If the target database is in archive mode, this can be done while the database is open)
RMAN>
run {
# backup complete database to disk
allocate channel c1 type disk;
backup full
tag full_db
format '/usr1/ora817/test/rman/db_d.dmp'
(database);
release channel c1;
}
You can create a script and use it multiple times, so each time you
don't need to type the above script. Just make sure to drop the old
backup files.
RMAN>
create script full_db_backup {
allocate channel c1 type disk;
backup full database
format '/usr1/ora817/test/rman/db_%d.dmp';
release channel c1;
}
This is how you run the script:
RMAN>
run { execute script full_backup ;}
Archive logs too can be backed up along with the database in one script:
RMAN>
create script full_db_arc_backup {
allocate channel c1 type disk;
backup full database
format '/usr1/ora817/test/rman/db_%d.dmp';
release channel c1;
allocate channel c2 type disk format '/usr1/ora817/test/rman/arc_%d.dmp';
backup (archivelog all delete input);
release channel c2;
}
- '%d' puts database name in the backup file name.
- 'all delete input' in above script deletes all the archive logs once the backup is
complete, thus frees up the space.
RMAN>
run { execute script full_db_arc_backup ;}