views:

19

answers:

1

dear sir, i have table1 in filegroup1 and when i use "select * from table1" Query then error message out

The query processor is unable to produce a plan for the table or view 'table1' because the table resides in a filegroup which is not online.

What is the solutions

A: 

There are some reasons why you get that error. First of all the error occurs if you a have filegroup with a damaged or missing data file, so you might want to check this first.

You can check in sys.databases state_desc column. If this states RECOVERY_PENDING, you need to set the file that is missing(or damaged) to offline state before you'll be able to get your database online and working.

ALTER DATABASE userDB MODIFY FILE (NAME=’damagedFile’, OFFLINE)

and then put the database online:

ALTER DATABASE userDB SET ONLINE

and it should work, but without you damaged file. If you have a backup you can recover the damaged file from there.

Adrian Faciu

related questions