41: Restoring database from backup in different locations in different machine: - Agnivo102/Database_Architect GitHub Wiki

Restoring database from backup in different machine:

Step 1:

First take a copy of the backup file in separate machine. You can do it over network using scp or you can use the shared folder to do this.

Step 2:

Next step is creating an oracle environment for the database in the other server. For the edit the Pratap file just like we do during database creation manually.

Step 3:

Next step is creating the password file. You can create a new one with the same password for the database or copy that databases password file. Here I have copied the password file of another database with the same sys user password.

Step 4:-

Now go into rman tool. Currently we don't have spfile or pfile. So we can't use the sqlplus to start the database. But the rman tool can forcefully start the database into nomount state even without the spfile.

Startup nomount;

Step 5:-

Now that the database is started run this command to restore the spfile from the backup.

This one is for the spfile and control files.

This one is for the data files, like remember the tag name which I had given.

Restore spfile from 'backup location';

This will restore the spfile.

This will also create the pfile.

Step 6:

Now open the pfile in another terminal and create the locations where the control files and data files and audit dump file is saved.

Step 7:

Now shutdown the database from RMAN tool and start it up to nomount again inside sqlplus. This time the database will use the spfile to startup.

Step 8:

Now go to RMAN tool again and restore the control file.

Step 9: Now mount the database and restore the datafiles.

Now in control file which is the physical repository of backups, it is written that last backup was saved in the fast recovery area location of the other machine. So if we used the command restore database; it will try the restoration by using the backup from there but nothing is present here.

So now we have to use this command: catalog start with '/u01/backup'; to tell the control file to use those files as backup.

Step 10:

Now restore the database.


Now open the database.

Restoring database in a completely different location in u02 directory in a different machine. That is, its data files and control files will be in u02 directory.

Step 1:

First create the directory. The copy the backup files in that directory.



Step 2:

Note:

This one is showing strange errors don't know why.

Lets do this with the prod database backup files from the previous again. The backup files are already moved to a different location.

Step 2 again:

Start the Rman tool with prod database. Restore spfile in there. And create pfile from it.


Step 3:

Now to change the location of the files we need to change the locations of the control files in the spfile.

This was the previous state of the file.

I changed it to this.

Step 4:

Now delete the spfile and create the spfile again from the updated pfile.


Step 5:

Now restart the database in nomount state and restore the control file.


See control files got restored in the new place.

Step 6:

Now the next step is to change the control file which contains the location of the datafiles. We need to change that from the previous location.

The control file looks completely in-editable directly as its a binary file.

We also can't do the changes like this by changing tablespace. Tablespace cannon be altered until the database is in open state and we can't open the databasw unless the data files are properly in place.

I also tried to check the spfile and control completely using the v$parameter view and don't see any property for data files which we can chnage using alter system.

The datafiles gets restored in the previous location as I couldn't change the control file.



The control files are in different space but the data files are in the previous place.

Steps 7:

Success:

Finish:

Note: One important thing. The server from where the database originally existed and the server where the database backup s copied they both need to have the same memory specification i,e same hard disk space and same RAM. Or restoration won't work.