Friday, March 30, 2012

How to rename a database?

hi

I want to rename the phisical file of the dabase for instance rename <MyDatabase.mdf> to <Renameddatabase.mdf>

every time I do so whether directly renamin the file or by

using Alter Database command I face an error

note that I don't want to logically rename the database

please tell me step by step what to do

thanks in advance

Easiest way is to take a backup of your existing database and restore it with renaming the mdf files. Have you read the books online (help file)?

Are any users (other than yourself) connected to the database while you try to rename the file?

ALTER DATABASE database_name MODIFY FILE ( NAME = logical_name , FILENAME = 'new_path\os_file_name' )Have you tried this command?

No comments:

Post a Comment