Restoring and Recovering the Database on a New Host using RMAN
This blog will demonstrate detailed steps to restore a database on New Host using RMAN. You can also use it to move a production database to new host as test database.
Here, we are going to use the source database with the DB_NAME=ORCL and we are going to restore this ORCL database on the test database machine.
1. Preparing to restore the database on a new host:
If you use the procedure in this section, then the DBID for the restored database equals the DBID for the original database. Do not register a test database created in this way in the same recovery catalog as the source database. Because the DBID of the two databases is the same, the metadata for the test database can interfere with RMAN's ability to restore and recover the source database.
by connecting to the database with RMAN as shown below:
Take backups of all the datafiles, controlfiles, spfile and archivelog files on the source database machine.
Perform following steps on the source database machine:
Ensure that the initialization parameter file and the backups of datafiles, controlfiles and archivelogs are available on the new host machine for the restore operation. Copy all the backup files from the old host to new host using operating system utility or you can transfer it through pendrive also. If you are using operating system utility then you can perform following step to copy the files from shared folder 'backup' of Neha-pc:
When we restore the database, we are not going to have the active redo logs from the source database, so we will need the last SCN of archivelogs for the restore operation. We can find it by querying V$BACKUP_ARCHIVELOG_DETAILS.
2. Creating the instance for the test machine and creating the pfile by restoring it from spfile:
Perform the following steps on the test database machine:
Use the oradim utility to create the instance for orcl database on the test machine.
When we start the database in nomount mode we receive error because the parameter file is not found. This is expected because we are restoring to a new host, hence, Oracle will use a “dummy” parameter file to start the instance.
Restore and edit the server parameter file which is in the SP_FILE.BKP. Since SPFILE is a binary file we need to create the file from it and then make the initialization parameter changes.
CONTROL_FILESinitialization parameter and then mount the database. After that, catalog the datafiles and archivelogs from the FULL_DATAFILES_350.bkp, ARCHIVE_LOG_356.bkp and ARCHIVE_LOG_357.bkp.
Execute the following RMAN restore and recovery script. The script does the following things:
- SET NEWNAME : For each data file on the destination host that is restored to a different path than it had on the source host, use this command to specify the new path on the test machine. If the file systems on the destination system are set up to have the same paths as the source host, then do not use
SET NEWNAMEfor those files restored to the same path as on the source host.
- ALTER DATABASE RENAME FILE :
commands to specify the path name on the destination host. If the file
systems on the destination system are set up to have the same paths as
the source host, then do not use
ALTER DATABASE RENAME FILEfor those files restored to the same path as on the source host.
- SET UNTIL : Perform this
operation to limit recovery to the end of the archived redo logs. The recovery stops with an error if no
SET UNTILcommand is specified.
- RESTORE the database.
- SWITCH DATAFILE ALL : Run the
SWITCH DATAFILE ALLcommand so that the control file recognizes the new path names as the official new names of the data files.
- RECOVER the database.
Post a Comment