• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 676
  • Last Modified:

Rename Database File Name and Log?

Please see my attached Screen Shot.
How can I rename the file name to match the database file and log?

Thanks,
Mark
SQL-Rename.jpg
0
smithmrk
Asked:
smithmrk
1 Solution
 
san_spyCommented:
Do you want to rename the physical file name or logical file name?

If its physical file name..

Detach the database rename the physical files and re attach them.

If its logical names check the below url.

http://support.microsoft.com/kb/814576
0
 
smithmrkAuthor Commented:
Your Awsome!
Thanks,
Mark
0
 
uscshaggyCommented:
You definitely can't just change the name of the file on disk that the db and log use directly.  Two ways to accomplish the name change are:

1. Rename the logical name in the File Name column above in your screenshot to something else (add a 1 to the end), and then add a new file using the File Name you want and the physical file name that matches.  Then delete the original file (through SQL Mgmt Studio) and SQL will migrate all the data to the new file you just created.  If SQL 2000 won't let you delete the first file, then try option 2.

2. Backup and restore the database using the 'RESTORE INTO' option to specify different files on disk to restore into.  This way you keep the logical names and can specify a new physical location.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now