Sunday, March 11, 2012

Database restore with REPLACE avoiding MOVE

When restoring a full database backup into an existing database, WITH
REPLACE is used to overwrite the existing target database. This
suggests that the physical path and file name for the data and log
files of the target database will be overwritten. However, error
message 1834 indicates that an explicit MOVE needs to be done of the
physical data and log files, eventhough those are already known.
How do you restore a backup into an existing database, automatically
using the target's physical files and avoiding MOVE?
You can do a RESTORE FILEISTONLY FROM DISK='your backup file' to see where
the database files will go. If they are not going to where you want to place
them, you must use the MOVE option regardless where the database files of the
currently existing database may be placed.
Linchi
"j.roumimper@.gmail.com" wrote:

> When restoring a full database backup into an existing database, WITH
> REPLACE is used to overwrite the existing target database. This
> suggests that the physical path and file name for the data and log
> files of the target database will be overwritten. However, error
> message 1834 indicates that an explicit MOVE needs to be done of the
> physical data and log files, eventhough those are already known.
> How do you restore a backup into an existing database, automatically
> using the target's physical files and avoiding MOVE?
>

No comments:

Post a Comment