If I read your post correctly then you seem to assume that you create a database and then use RMAN to restore and recover the data. That's not how it works.
Whether you try to restore an already existing database or whether it was shutdown properly doesn't matter. RMAN only requires a database Instance to perform any restore or recovery. Any existing data that is different from the file to be restored will simply be overwritten. The procedure, however, will be different depending on whether or not the spfile and controlfile of the database (target) already exist.
If the Instance parameter spfile and controlfile of the database you are restoring already exist, then there is no need to set the DBID - you don't need to restore the spfile. In such case, simply start the Instance to mount the existing controlfile. This will enable RMAN to obtain information what data files need to be restored and what backups are available. You can also customize the process if you need to, for example, to rename datafiles or restore from different locations, or even clone a database, but that's a different story.
In your scenario, you can probably do the following:
$ source oraenv <<< ORCL # set the shell environment, assuming ORCL is your database SID
$ rman target /
RMAN> startup force nomount # includes shutdown abort.
RMAN> restore controlfile from autobackup;
RMAN> startup mount;
RMAN> restore database; # a crosscheck and re-cataloging of FRA is included.
RMAN> recover database;
RMAN> alter database open resetlogs;
You will have to open the database using resetlogs after you restore the controlfile from backup or when the online redo logs are missing, or in your case do not apply to the restored database. RMAN does not backup or restore the online redo logs.
If you need to restore a database from scratch, perhaps you will find the following info resourceful:
Also be aware that there are many misconceptions and wrong info about Oracle out there. It's always best to read the original Oracle documentation.
And btw, you're using a silly generic thread subject. "RMAN backup". Think how this could be useful for others who are looking for information.
Thanks for responding to my question.
I am new to this, so please bear with me.
you wrote:If I read your post correctly then you seem to assume that you create a database and then use RMAN to restore and recover the data. That's not how it works.
My response for Clarification: The stage database was created before i got to the company, and I was told that everything was the same as the production database. And I am task with restoring the RMAN backup from production into the stage database....I showed you the RMAN script above.
you wrote: Any existing data that is different from the file to be restored will simply be overwritten.
my response: I am confused about your statement, is this from my earlier post? if so, i am assuming that you are telling me that i don't have to delete any files.
Without deleting any files, my new rman script should run like so:
1. SQL> shutdown immediate; (afterwards, i exit out of sql to the os)
2. rman target /
3. RMAN> STARTUP NOMOUNT;
4. RMAN> RESTORE CONTROLFILE FROM "/raas/ICP/controlfile_backup_manualghu42105_1_1";
5. RMAN> STARTUP MOUNT;
6. RMAN> RESTORE DATABASE;
7. RMAN> RECOVER DATABASE;
8. RMAN> alter database open resetlogs;
you wrote: And btw, you're using a silly generic thread subject. "RMAN backup". Think how this could be useful for others who are looking for information.
my response: I didn't realize it was silly thread subject, i didn't know what else to name it....i am open to suggestions here.
You may restore the database like you would restore the production database. The script or what you have so far might work, but I have no crystal ball to look over your shoulder or know what you have available.
My response was not about your previous post. I just explained how RMAN works since your question suggests that you have some common and fundamental misconceptions. If this is all new to you and confusing then you need to study RMAN reading the documentation. It will also be essential in such case to setup a test environment to practice. You need to have some understanding before you can even ask the right questions A forum is no substitute.
My point about the subject line is that it's not useful for anyone to determine what this is about, or even find a compelling reason to read your post. When you send someone an email, do you use "email message" as the subject too? Keep in mind that this is a public forum and help is from other users. It shouldn't be too difficult to come up with something more reasonable, such as "How to refresh the database", for example, or include the error code.
1 person found this helpful
Thanks a lot Dude for your help...I will start the process on Monday.