I want to create a "database in a box" type of backup, that is to have a fully usable backup in a directory that I can use to either:
- restore the database in its original place in case of problems
- copy to a different server and restore there for development/testing and so on
I would like to do this in the simplest way and, most importantly, in a script.
The database is in archivelog mode and the backup is taken while it's online.
So, for backup, this command seems to be the shortest, simplest:
backup database include current controlfile plus archivelog;
But for restore I have a problem: how do I know which file in that backup contains the controlfile? They all look the same. I need to restore the controlfile first with
restore controlfile from '/path/to/backup_file';
I determine the file on the machine where I took the backup with
list backup of controlfile;
But how can I do it on the machine where I want to restore? The restore script would look like this:
startup nomount;
restore controlfile from '/path/to/what/file';
alter database mount;
restore database;
recover database;
alter database open resetlogs;
Thanks.