FIX: Cannot remove the secondary filegroup after you upgrade the database to SQL Server 2014

Applies to: SQL Server 2014 DeveloperSQL Server 2014 DeveloperSQL Server 2014 Enterprise More

Symptoms


Consider the following scenario:
  • You have a Microsoft SQL Server 2012 or earlier version database that has multiple filegroups, and the secondary filegroup is the default filegroup.
  • You back up the database, and then restore it on SQL Server 2014.
  • You set the primary filegroup as the default filegroup, and then try to remove the secondary filegroup.
In this scenario, you cannot delete the secondary filegroup even if all the data files under it are deleted. The error message shows that the secondary filegroup cannot be removed because it is not empty.

Cause


The issue occurs because the database version upgrade creates system objects on the default filegroup instead of the primary filegroup in SQL Server 2014. The secondary filegroup still contains some system objects.

Resolution


This fix introduces the trace flag 3861 to move system tables into the primary filegroup.
After you apply the hotfix that is described in this article, when you start SQL Server by using trace flag 3861 as a startup parameter, it can move the system tables into the primary filegroup.
If you have not restored the database backup yet, you could enable the trace flag at server level:
dbcc traceon(3861,-1)
<Restore the database>
dbcc traceoff(3861,-1)
The issue was first fixed in the following cumulative update of SQL Server.

Cumulative Update 4 for SQL Server 2014

Status


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.