Can I copy a filegroup from one database to another?

I want to extract a subset of a database and copy to another server / database. Is it possible to copy / archive one filegroup from one database and attach / restore another?

+3
source share
2 answers

You cannot restore a filegroup to another database. Any recovery operation must go through the recovery stage, when the log is played with the restored data files, and in the new database there will be a log that does not correspond to the restored file group, so the mechanism will reject the backup.

You cannot detach / attach filegroups; detachment and attachment do not work at the filegroup level, only at the database level.

You also cannot copy / overwrite the file when the database connects to the network, the recovery process will detect a discrepancy and declare the database damaged.

+2
source

Use the correct "SELECT * FROM old_db.old_tbl INTO new_db.new_tbl" for each table.

0
source

Source: https://habr.com/ru/post/1717652/


All Articles