title: Bringing SQL Server filegroups online
body: <p>We've experienced an sql injection attack which corrupted our main db.</p>
  
  <p>The main db had two partitioned tables into filegroups.</p>
  
  <p>The corrupt database entered into Suspect mode, and it's been impossible for us to use.</p>
  
  <p>I was able to restore a backup of the db with partial (no filegroups, since we didn't have backup of those.. I know bad thing).</p>
  
  <p>I was now able to remove the db in suspect mode so we are left with the restored db and the file groups that were linked to the corrupt db.</p>
  
  <p>Now I'm trying to figure out how to bring those file groups back online.</p>
  
  <p>I've tried removing them so I can then add them back on, but I can't remove them since I get </p>
  
  <pre><code>Msg 5056, Level 16, State 2, Line 1
  Cannot add, remove, or modify a file in filegroup 'FG_Audit' because the filegroup is not online.
  </code></pre>
  
  <p>Is there any work around? I've found posts where they talk about restoring from backup but we don't have one of the filegroups.</p>
  
  <p>Have we lost that data? How do we remove the filegroups? Backups now stopped working because of this.</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>If I run this</p>
  
  <pre><code>SELECT 
   f.name file_group, 
   d.name file_name, 
   d.state_desc file_state
  FROM sys.filegroups f
  JOIN sys.database_files d
   ON f.data_space_id = d.data_space_id;
  GO
  </code></pre>
  
  <p>All the file groups that the DB is complaining about being off line they say "RECOVERY_PENDING"</p>