Access Denied While Accessing SQL Server Master.mdf

How to get rid of SQL Server error 17204 and 17207


SQL user could found given below errors messages in the SQL Server error log or in the Windows Application Event when transaction log files or database of SQL Server can't start.

When user starts database of SQL Server or during SQL Server instance startup process, above described error might be occur. In these scenarios you could find both 17204 and 17207 errors and any one of them.

There will be two possibilities i.e. if these errors are found by user database, that database kept in the RECOVERY_PENDING state and can't be accessible by applications. Second thing if errors are found by system database then SQL Server instance will not start user won't be able to connect this instance of SQL Server and eventually will result in the offline state of SQL Server failover cluster.

The Main Cause of the Errors 17204 and 17207:

Startup process of SQL Server database involves initializing various data structures that indicates database, database files, opening of files and last recovery on the database. The file that belongs to database is opened by Windows API CreateFile which is used by SQL Server.

These errors (17204 and 17207) are encountered when SQL Server attempts to open the database files during startup process. These error messages contains following information:

The common cause for these errors is incorrect location or path and permission problems etc.

Solution to Recover from these Errors:

  • To resolve these errors user need to understand operating system error code and troubleshoot that error. After that user can restart the database by using ALTER DATABSE SET ONLINE. There might be possibilities that these operating system errors cannot be resolved.
  • User can use command from an OS shell net helpmsg <error code> if the errors 17204 and 17207 contains an error code not whole description.
  • If you found OS(Operating System) error "Access is Denied" then follow following methods:

1. Check the all permissions of the file from the properties of the file in Windows Explorer. Windows groups to Access Control are used by SQL Server.

2. Review the user account in which SQL Server service is running or user can use Windows Task Manager to get this confirmed. If user has changes the service account, then use SQL Server Configuration Manager Utility.

If any of the methods described above fails to perform the task then user can use SQL Server database recovery tool which will help them to access their database very easily. By using this tool user can easily restore all corrupt, damaged or inaccessible database.