Changing DB logical filename | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Changing DB logical filename


I restore .bak to different server with new dbname in EM but it kept the old logical filename. How can I update the logical filename to new name?
ALTER DATABASE DatabaseName
MODIFY FILE (NAME = logical_file_name, NEWNAME = new_logical_name)

By the way if you are going to perform other modifications to the database useing ALTER DATBASE, it is recommended you use multiple ALTER DATABASE statments for optimal performance. <img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />
Note that the Alter Database statment only work on SQL 2000. There is no supported way to change logical filename in SQL 7 and below. Having different logical filename on a database doesn’t impact functionality.
True but it could confuse some one, so if you are running 2000 I would go ahead and change the file name as well it wont hurt.
]]>