November 27, 2007 at 10:57 am
Currently I am automating a nightly restore of a database backup from off-site.
RESTORE DATABASE @aDatabaseName FROM
DISK = @aBackupLocation WITH FILE = 1,
MOVE @aDatabaseName TO @aMdfLocation,
MOVE @aLogName TO @aLdfLocation,
NOUNLOAD, REPLACE, STATS = 10
The first run after creating the database works correctly. However after the first run the restore has renamed the logical file name for the database.
OttawaFabrication to FABDB
There are multiple offsite locations with logical filenames similar or identical.
I can do an alter after the restore (below),
ALTER DATABASE [OttawaFabication] MODIFY FILE (NAME=N'FABDB', NEWNAME=N'OttawaFabrication)
but was searching for a setting in [RESTORE DATABASE].
Thanks, just looking for an elegant one step, though two steps is a workable plan B ...
Daryl
November 28, 2007 at 8:10 pm
I see that @aDatabaseName is used with RESTORE DATABASE and MOVE. Are the database name & logical name of the data file actually the same in the original database? I know in most cases it is, but I have come across ones where it isn't.
MARCUS. Why dost thou laugh? It fits not with this hour.
TITUS. Why, I have not another tear to shed;
--Titus Andronicus, William Shakespeare
November 29, 2007 at 9:55 am
The original database ( and logical) name is FTDB. I went for a more informational name for the replicated copy.
thanks
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply