November 3, 2003 at 8:40 am
Hi,
Help!, we are restoring an existing db to a new db, but need to change the Datafile filename of the target as we are restoring it to the same server the original Db is located on ( hence the need for different filenames ).
We have no trouble with the Db Name, that works ok & the names of the datafiles (.mdf & .ldf ) are ok as we restore using the MOVE command, but the Datafile filenames ( as viewed in Enterprise Manager ) are the same as the Db we are restoring from & we cannot seem to change this !. If we query the master.sysaltfiles table we see the following;
NEW Db
testdev2app_Data D:\Db_Data\SqlServer\UAT\JIM_Data.mdf
testdev2app_Log D:\Db_Data\SqlServer\UAT\JIM_Log.ldf
OLD Db
testdev2app_Data D:\DB_DATA\SqlServer\UAT\DEV2APP.mdf
testdev2app_Log D:\DB_DATA\SqlServer\UAT\DEV2APP_log.ldf
Can anyone help as I'm sure this may cause us a problem in future.
Many thanks in advance.
j
November 3, 2003 at 8:49 am
It seems you are tring to change the logical file name. If you run SQL Server 2000, use Alter database command to To modify the logical name of a data file or log file, specify in NAME the logical file name to be renamed, and specify for NEWNAME the new logical name for the file.
MODIFY FILE (NAME = logical_file_name, NEWNAME = new_logical_name...). See BOL for details.
November 3, 2003 at 9:30 am
Allen,
You are a scholar & a gentleman !
In other words, thanks, it worked a treat.
Regards.
j
November 4, 2003 at 1:59 am
another way would have been to detach the database, rename the files and then re-attach the new filename.
November 4, 2003 at 2:38 am
Hi Junie01,
Tried your response before, i.e restored db, detached db, renamed the physical files on disk, attached db, but to no avail. It did not change the logical filename, only the physical & so I was left with the old (incorrect) logical name pointing to the newly renamed physical files !?
Allen's answer was spot on.
Regards.
j
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply