Search code examples
sqlsql-serverdatabasedatabase-restore

"Logical file 'Movies' is not part of database"


Usually when I need to make a manual change I just back up my SQL Server Management Studio 2012 database called Movies, then upload it to my host, then use their restore feature to implement it.

I am still in a testing phase so data does not need to be kept that is acquired online, however I wanted to try keeping the data today so I used the host's backup option which created a DB_76779_test_backup.bak file for me.

I then download this and "attempted" to updated it's information into the SQL database on my machine (Movie) which I believe is where I messed everything up.

From what I remember I right-clicked my database "Movies" and selected "Tasks -> Restore -> Database", I kept everything as is, but for Source I selected Device then chose the DB_76779_test_backup.bak file and and below that selected "Movies" as the Database and hit OK.

enter image description here

This seemed to work fine, so I opened and edited the tables values that needed to be changed. Then as usual, I just backed it up, FTPed it to the host, and restored my database.

I got an error however when trying to restore and my support told me the following.

"Logical file 'Movies' is not part of database 'DB_76779_test'. Use RESTORE FILELISTONLY to list the logical file names."

I'm afraid we only support restores of databases that contain only 1 .mdf file and 1 .ldf file with no extra partitions.

I am assuming that since the only different thing I did this time was restore my database on my computer is that somehow I broke it, or created more than 1 mdf and ldf file (no clue what those even are). All I was trying to do was keep the actual data from online, so I am not even sure if that was correct way to go about this, but regardless I am unable to restore the database on my host now..

What mistake have I made? I only know a basic level of databasing and not much of the "under the hood" mechanics.


Solution

  • That SSMS dialog is a little difficult to work with some times. It looks like you want to rename your database to Movies. The problem is when you change the name field it does not update the logical names it is using for the files. IIRC simply switching to the Files "tab" on the left will update it and then you can restore fine. That or do your restore with the "old" name and then name the database after restore.