Sql-server – SQL Server Management Studio crashes when attaching an mdf file

permissionssql serversql server 2014ssms

After the Windows 10 November update 1511, 10586 I cannot attach my databases with SSMS. It would just say that it has stopped working as shown below

SSMS has stopped working

I checked the error log and so far this is what I've got

2016-01-19 02:35:46.19 spid51 Attempting to load library 'xprepl.dll' into memory. This is an informational message only. No user action is required.
2016-01-19 02:35:46.21 spid51 Using 'xprepl.dll' version '2014.120.2000' to execute extended stored procedure 'xp_repl_encrypt'. This is an informational message only; no user action is required.
2016-01-19 02:35:49.34 spid10s .NET Framework runtime has been stopped.
2016-01-19 02:35:49.47 spid10s SQL Server is terminating in response to a 'stop' request from Service Control Manager. This is an informational message only. No user action is required.
2016-01-19 02:35:49.47 spid10s SQL Trace was stopped due to server shutdown. Trace ID = '1'. This is an informational message only; no user action is required.

What could be the problem? I've tried googling if this was a common issue but unfortunately there were no similar problems.

I have tried repairing SSMS through the installer.

Update error log

2016-01-19 12:16:48.69 spid52 Error: 17204, Severity: 16, State: 1.
2016-01-19 12:16:48.69 spid52 FCB::Open failed: Could not open file C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\GroundCommander.mdf for file number 0. OS error: 5(Access is denied.).
2016-01-19 12:16:49.26 spid52 Error: 17204, Severity: 16, State: 1.
2016-01-19 12:16:49.26 spid52 FCB::Open failed: Could not open file C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\GroundCommander.mdf for file number 0. OS error: 5(Access is denied.).
2016-01-19 12:16:49.48 spid52 Error: 17204, Severity: 16, State: 1.
2016-01-19 12:16:49.48 spid52 FCB::Open failed: Could not open file C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\GroundCommander.mdf for file number 0. OS error: 5(Access is denied.).
2016-01-19 12:16:49.61 spid52 Error: 17204, Severity: 16, State: 1.
2016-01-19 12:16:49.61 spid52 FCB::Open failed: Could not open file C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\GroundCommander.mdf for file number 0. OS error: 5(Access is denied.).
2016-01-19 12:16:49.83 spid52 Error: 17204, Severity: 16, State: 1.
2016-01-19 12:16:49.83 spid52 FCB::Open failed: Could not open file C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\GroundCommander.mdf for file number 0. OS error: 5(Access is denied.).
2016-01-19 12:16:49.98 spid52 Error: 17204, Severity: 16, State: 1.
2016-01-19 12:16:49.98 spid52 FCB::Open failed: Could not open file C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\GroundCommander.mdf for file number 0. OS error: 5(Access is denied.).
2016-01-19 12:16:50.21 spid52 Error: 17204, Severity: 16, State: 1.
2016-01-19 12:16:50.21 spid52 FCB::Open failed: Could not open file C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\GroundCommander.mdf for file number 0. OS error: 5(Access is denied.).
2016-01-19 12:16:50.36 spid52 Error: 17204, Severity: 16, State: 1.
2016-01-19 12:16:50.36 spid52 FCB::Open failed: Could not open file C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\GroundCommander.mdf for file number 0. OS error: 5(Access is denied.).
2016-01-19 12:16:50.57 spid52 Error: 17204, Severity: 16, State: 1.
2016-01-19 12:16:50.57 spid52 FCB::Open failed: Could not open file C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\GroundCommander.mdf for file number 0. OS error: 5(Access is denied.).
2016-01-19 12:16:50.75 spid52 Error: 17204, Severity: 16, State: 1.
2016-01-19 12:16:50.75 spid52 FCB::Open failed: Could not open file C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\GroundCommander.mdf for file number 0. OS error: 5(Access is denied.).
2016-01-19 12:16:50.91 spid52 Error: 17204, Severity: 16, State: 1.
2016-01-19 12:16:50.91 spid52 FCB::Open failed: Could not open file C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\DATA\GroundCommander.mdf for file number 0. OS error: 5(Access is denied.).
2016-01-19 12:16:55.58 spid54 Attempting to load library 'xpstar.dll' into memory. This is an informational message only. No user action is required.
2016-01-19 12:16:55.60 spid54 Using 'xpstar.dll' version '2014.120.2000' to execute extended stored procedure 'xp_instance_regread'. This is an informational message only; no user action is required.

Best Answer

@J.P Masangcay, I have gone through your Error log and find out two things which is as follows :

1) Error: 17204
2) OS error: 5(Access is denied)

I would like to say that as @ypercubeᵀᴹ already comments it's related to os like OS permission issue. So, as per above errors definitely we can say that it's Windows Service Accounts based errors.

The SQL Server (MSSQLSERVER) service account and members of the local Windows Administrators group.

AS per MSDN BOL Here When you are detaching or attaching a database, the Database Engine tries to impersonate the Windows account of the connection performing the operation to guarantee that the account has permission to access the database and log files.

Depending on the type of operation [opening databases during server startup, database attach, restore, etc] the user account that is used for impersonation and accessing the database file will vary. For Ref Here and Here.

Hope it will help out to you.