After having moved a .mdf when SSMS would not start

  • We had run out of space on a drive that was storing several .mdf files and I could not start SSMS so I stopped all MSSQL services and moved a test db's .mdf file. Things are moving again but after having read this article about the proper way to move them [/url] I am wondering how I can get the test db back working again.

    I was thinking using the article's method to move another file and then manually move the test db back to its original location. Does that sound like a good plan?

  • Is there any reason you can't just reattach the testdb from the location where you moved it?

  • I'd recommend moving the .mdf file back, taking the database offline, move the files, run an alter database statement to move the pointers to the new file location then bring the database online again.

  • The database will not come ONLINE because there is a mismatch between the location of the mdf-file stored in the system database and the physical location of the file on disk. Alter the location in the system database with the statement below (change to your needs) and bring the database online.

    ALTER DATABASE [{dbname}] MODIFY FILE (NAME = {logical_name}, FILENAME = '{full_path_and_filename}')

    ALTER DATABASE [{dbname}] SET ONLINE

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • I had a chance to try to let the master files know that the database is moved, but things are complicated by the fact that the drives where the files are located are clustered.

    I had tried moving the .mdf file to a cluster disk that should be associated with another instance of sql server on the same box and tried moving it to the local disk but both gave me the same message:

    Cannot use file 'C:\datatel\data\ActiveCampusTest.mdf' for clustered server. Only formatted files on which the cluster resource of the server has a dependency can be used. Either the disk resource containing the file is not present in the cluster group or the cluster resource of the Sql Server does not have a dependency on it.

    I was thinking I could add the cluster disk as a dependency of this server instance, but I'm not sure if that's possible since the cluster disk is already part of another instance. The other option I was thinking was to move the entire database to another instance. Any ideas where I should go next?

  • You can't add a dependency unless the disk is part of the same resource group, which it's not if it's for another instance.

    You need to provision more space or add a new disk to that resource group. If you move to another instance, you'll need to reconfigure the app, alias, clients, transfer jobs, logins etc.

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply