Removing offline/defunct files in SQL server 2008
        Posted  
        
            by philox
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by philox
        
        
        
        Published on 2010-04-12T17:38:48Z
        Indexed on 
            2010/04/12
            17:43 UTC
        
        
        Read the original article
        Hit count: 959
        
sql
|sql-server-2008
How to remove traces of files marked as OFFLINE or DEFUNCT in Microsoft SQL server 2008?
I have been playing around with a setup where I create a database with 3 file-groups which are: Primary, FileGroupData and FileGroupIndex. The clustered index is using FileGroupData and a non-clustered index is set to use FileGroupIndex. To simulate a disk failure I've shut down SQL server and manually deleted the files in index file-group. To start the database I'll mark the files 'OFFLINE', but after that I can't delete the index files, which are now offline.
I don't have backup of the files as they are merely indices, but that has the implication that I can't restore the files and have their status as "ONLINE".
How would you recommend removing the files and the file-group as they still show up in management studio under files/file-groups. Management studio is not able to delete them.
As far as I can tell this is different from the question posted in : http://stackoverflow.com/questions/462637/how-do-i-remove-offline-files-from-a-sql-server-2005-database
/Philip
© Stack Overflow or respective owner