Rename Database and Physical Database Files’ Names from SSMSPosted: October 13, 2011
1. Rename Database Name:
Run a T-SQL script to rename the database:
–In Single-User Mode to change name
ALTER DATABASE [myMarsh] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
ALTER DATABASE [myMarsh] MODIFY Name = [myMarshNew]
— Set Database to Multi-User Mode
ALTER DATABASE [myMarshNew] SET MULTI_USER WITH ROLLBACK IMMEDIATE
2. Rename Logical Name:
From SSMS: Right Click on Database >> Properties>>(Next Window) Files >>
You can change the Logical Name to reflect the new database name for both mdf and ldf files.
3. Rename Data files’ names
You need to dettach the database first and rename the files’ names with name names in file system and Reattach the database files with the changes names back online.