How to recover data in filegroup databases?

I have a database with two files:

1- PrimaryFileGroup
2- ArchiveFileGroup

I now have a backup from the first filegroup: Primary.bak . and restore below script:

USE [master]
GO
ALTER DATABASE MyDatabase
SET SINGLE_USER
    WITH

 ROLLBACK IMMEDIATE;

RESTORE DATABASE MyDatabase
    FILEGROUP = 'PRIMARY'
    FROM DISK = 'C:\Primary.bak'
    WITH PARTIAL, REPLACE 
GO

ALTER DATABASE SaleTabriz
SET MULTI_USER

It is successfully recovering. but my other tables, which are in the ArchiveFileGroup , are included with the error below, while I would like to choose from them:

The query processor cannot create a plan for the table or the Client view because the table is in a filegroup that is not online

What is my mistake?

+4
source share
2 answers

, , .

:

alter database xxxDB modify file (name = 'xxxDB_File1', online)

. , , , , , , .

0
RESTORE DATABASE MyDatabase
   FROM DISK = 'C:\Primary.bak',
   FILEGROUP = 'PRIMARY',
   FROM DISK = 'C:\Secondary.bak',
   FILEGROUP = 'SECONDARY'
   WITH PARTIAL, REPLACE ;
GO
-1

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


All Articles