简体   繁体   中英

When restoring SQL DB from .bak file all tables are missing

I received a .bak file from a client and I have been struggling for 2 days trying to get it to work. When restore the file to a new db in SQL Server 2012 the restore succeeds but there are no tables in the restored database. I have tried different almost everything I can possibly find on the web and I really think the backup may not have been performed correctly (I am not looking forward to going back to the client with that information).

I appreciate any and all ideas. Thanks

You need to go back to the client and tell them that they gave you the wrong backup, because it is empty.

If the backup could be restored successfully, and there are no tables in it, then there were no tables in it when it was backed up, either. There is no way that the backup could "not have been performed correctly" and still succeed (and produce a restorable backup), and end in this scenario. Unless they backed up the wrong database or provided you with the wrong .bak file.

Probably the only thing the client will be mad about is that you waited two days to tell them.

I had the same problem. I was creating the database first, then right clicking it and selecting restoring. This resulted in no tables. Instead I right clicked "Databases" and selected restore from there. Now I can see all tables.

Sounds like the customer backed up a blank database before sending it over. I restore a ton of customer-supplied backups and I'm never surprised what I find. Go back to the client, ask for a new FULL DATABASE backup, and try again.

At the risk of a "me too" answer, it sounds like whoever gave you that backup gave you the wrong thing. But you can confirm by doing a restore headeronly from disk = 'path_to_backup' which should tell you all sorts of useful information including:

  • Server name
  • Database name
  • Backup date

I had the same problem today. It turned out I'd copied over the .bak file for the system database instead of the one for the main DB. Head in the clouds as I'm off to a festival this evening.

Maybe double-check your file if you have the same problem. Mine was from the same directory, same date-stamp and a gibberish name, so an easy mistake to make... I like to think.

I ran into the same issue -- no table was restored. What I did was that I just created a new database and restored to the new database. Everything worked as expected.

Use this backup script while backup

BACKUP DATABASE [database_name]

TO DISK = N'C:\\yourpath\\filename.bak'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM