ONTEC Are you ready Uhr

RESTORE OR DUPLICATE ORACLE DATABASE TO DIFFERENT FILE LOCATION

RESTORE OR DUPLICATE ORACLE DATABASE TO DIFFERENT FILE LOCATION

Inhaltsverzeichnis

One simple way to restore or duplicate your Oracle database to another host and even to a different location is the „set newname for database“ option in RMAN.

One simple way to restore or duplicate your Oracle database to another host and even to a different location is the „set newname for database“ option in RMAN.

First you need access to the last backup or your database. Then you have to edit the pfile/spfile for the new location of the control files.

In my backup concept, I do a manual backup of the spfile and the controlfile at the end of every backup and name it like this, so it`s easy to find. Now restore the controlfiles and mount the database:

RMAN> restore controlfile from '/home/oracle/Backup/XXX/controlfile_XXX_0dks69nh1_1';
RMAN> alter database mount;

If the backup destination changed from that stored in the controlfiles, you have to catalog the DB backup from this new destination:

RMAN> catalog start with '/home/oracle/Backup/XXX/*';

Because of the new location of all the datafiles, you can use „set newname for database“ and then restore all the files to it:

RMAN> run
{
set newname for database to '/oracle/YYY/oradata/%b';
restore database;
SWITCH DATAFILE ALL;
SWITCH TEMPFILE ALL;
recover database;
alter database open resetlogs;
}

The variable „%b“ is a substitution and is explained as

Variable Summary
%b Specifies the file name stripped of directory paths. For example, if a data file is named /oradata/prod/fi­nancial.dbf, then %b results in financial.dbf.

Other variables you can find e.g. here:

Duplicating a Database: Advanced Topics

Diesen Beitrag teilen

LinkedIn
Reddit
Telegram
WhatsApp
Email
Print
WordPress Cookie Hinweis von Real Cookie Banner