0

Is it possible to move SQL Server file-group from one database to another one on the same server ?

If no , is there any work around?

Hossam Elsagheer
  • 151
  • 1
  • 5
  • 15
  • If it is about file-group backup , yes you can do and restore it to any other databases within the instance. Doesn't work across instance. – TharunRaja Sep 29 '17 at 04:01

1 Answers1

0

You cannot do it.

If you want to restore FG1 of db1 to another database db2, you should at least restore PRIMARY filegroup of db1 with move. And this will effectively overwrite PRIMARY FG of db2.

From this moment db2 will know nothing about what it was. It will know that it has all the files of db1.

So this is the same as to restore to a new non-existing database.

Summary.

You can restore PRIMARY + some other FG, but this always be a database with the structure that db1 had, with only difference that not all FG are online.

sepupic
  • 8,409
  • 1
  • 9
  • 20
  • I have two databases db1 has fg1,2,3 and db2 has fg4,5,6 , after moving fg1, db1 now contains fg2,3 and db2 fg1,4,5,6 .PRIMARY fg of db1 and db2 are identical and fg1,fg2,...,fg6 are all identical in structure but different in data. is that possible or not?? – Hossam Elsagheer Sep 29 '17 at 14:41
  • It's not possible – sepupic Sep 29 '17 at 14:46