FIX: SQL Server takes long time to open database after recovery to add or remove a data file in SQL Server 2014 or SQL Server 2012

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

Symptoms


Assume that you add or remove a data file in a Microsoft SQL Server 2014 or SQL Server 2012 database. SQL Server might take a long time to complete the database startup task after recovery if the number of databases, database files, or both is large.

Note This issue generally does not affect the database access as the database recovery is finished and the database is online. However, if the database is configured in database mirroring, this issue may cause the failover operation of the database to be blocked.

Cause


This issue occurs when you have files in a dummy, dropped, or droppedreusepending state because you would incorrectly count these files.

Note The issue in KB 2932120 FIX: SQL Server takes long time to open the databases after the recovery phase when the number of databases or database files or both is large in SQL Server 2012 or SQL Server 2014 has the same symptom to this issue. However, its cause differs from the cause of this issue. The issue in KB 2932120 occurs when you are not comparing the number of files to the number of files that are reported by the master database.

Resolution


The issue was first fixed in the following cumulative update of SQL Server.

Cumulative Update 1 for SQL Server 2014 SP1

Cumulative Update 6 for SQL Server 2012 SP2

Cumulative Update 7 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.