Roman Rehak

SQL Server and things not related

<July 2008>
SuMoTuWeThFrSa
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789


Navigation

SQL Server Sites

Subscriptions

News

eXTReMe Tracker

Post Categories



Problems when removing a filegroup

This week we ran into a weird problem. We were not able to remove an empty filegroup, SQL Server was throwing the 5042 error “The filegroup 'FG18' cannot be removed because it is not empty”. There were definitely no files in that filegroup so the whole thing appeared to be more like a bug. As it turns out, this can happen if a table that was using the filegroup had statistics defined on that filegroup. You can tell if you have any dangling statistics for that filegroup if you run this query and replace X with your filegroup ID:

 

select object_name(id) AS TableName, * from dbo.sysindexes where groupid = X

 

Once you know the table name, you can run DROP STATISTICS and hopefully after that you should be able to remove the filegroup.

 




Cross-posted from SQLBlog! - http://www.sqlblog.com


posted on Thursday, April 26, 2007 5:19 PM by Roman





Powered by Dot Net Junkies, by Telligent Systems