0

I tried to click on target database, which had a separate table (separate from all the tables stored in the .BAK backup file).

How can I restore the backup on this target database?

I tried restoring it, but the only way I see it's possible is to overwrite the target database with the backup, resulting in the loss of the aforementioned table. Although I do have an option to restore it by specifying a new database name, which would be created on-the-fly, but in MySQL, it is possible to import backup contents without affecting the contents that the target database previously had.

I tried restore operation normally without "Overwrite Existing Database (With REPLACE)" checkbox, but the restore fails when I do so in the "Options" section in Azure Data Studio. Also to mention, in the video tutorials I saw a checkmark against restore in the "Restore Plan" but in my case, the checkmark is unchecked (although on an empty database, even when this checkmark is off, the data is restored successfully).

Below is the link for accurately describes my problem when I try to restore without overwrite, just the thing the discussion didn't specify is, what if I don't want to overwrite the target database and preserve its tables.

SQL-Server: The backup set holds a backup of a database other than the existing

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • Pretty sure you can't append a backup to an existing database in SQL server. – Dale K Mar 04 '23 at 20:46
  • Restore to a new database and copy the data over. Alternatively export the missing table to another database or a file, restore DB then import back – Charlieface Mar 04 '23 at 22:01
  • 1
    MySQL works that way because their "backups" are just an endless string of insert statements. So, yeah, it's not hard to make such a script compatible with an existing database. This isn't how backups in SQL Server work. You need to restore it as a different name and then decide which one will host the union of the data going forward. And I just wouldn't use the GUI for this, at all. – Aaron Bertrand Mar 04 '23 at 22:04
  • I see that we can't append a backup to an existing database, but as you said that the backup can be restored to a different database and then the two databases can be merged into a single one... How can I do that? – Aaradhya Chauhan Mar 05 '23 at 04:50
  • You can copy data from one to the other once they're both online, but this will be a manual process, there is no magic snap-your-fingers "merge two databases into one" button. – Aaron Bertrand Mar 07 '23 at 23:45
  • Then how could that be done in large enterprises? Won't that be unfeasible, if they want to merge their databases into one? – Aaradhya Chauhan Mar 09 '23 at 09:00

0 Answers0