Fix it now
The service tried to open a file named in its startup parameters, could not, and gave up. The published message says an invalid startup option might have caused it, so read the parameters before you touch permissions. Nothing else can happen until master is readable, and you cannot fix this from Management Studio because there is no instance to connect to.
icacls "D:\MSSQL\DATA" /grant "NT SERVICE\MSSQLSERVER":(OI)(CI)M
- Read the instance error log in the LOG folder under the instance directory. If the engine could not write it, the Application event log carries the same startup entries.
- Open SQL Server Configuration Manager, find the instance under SQL Server Services, open its properties and read the Startup Parameters tab. Note the -d, -l and -e values.
- Check on the server that the files named by -d and -l exist at those exact paths, and that the folder in -e exists. If -e points nowhere the engine cannot write its error log and you lose your best diagnostic.
- If a path is wrong, correct it in Configuration Manager rather than anywhere else, then start the service.
- If the paths are right, the operating system error is 5 and the fault is permissions: grant the per-service account Modify on the folder. For a named instance the account is
NT SERVICE\MSSQL$INSTANCENAME.
17113 is raised for whichever startup-parameter file failed. master.mdf is the usual one, but the same error appears for mastlog.ldf and for an unwritable error log path.
If the service starts and stays running, you are done. If it starts and stops within seconds, the real error is in the first lines of the newest error log, and the next section explains how to read them.
Why it happens
Startup is a short and strict sequence. The service reads its startup parameters, opens the master data file named by -d and the master log file named by -l, reads the instance configuration out of master, and only then attaches everything else. Because so little exists at that point, the diagnostics are thin: an operating system error number and a path, and that is deliberately all it can say.
The published text of 17113 is worth reading exactly, because it points somewhere most people do not look first. It says an error occurred while opening a file to obtain configuration information at startup, and that an invalid startup option might have caused the error, and it tells you to verify your startup options and correct or remove them if necessary. The startup options are the first suspect, not the last.
17204 is the file-level detail behind the failure, and it carries a piece of information that turns it from a complaint into a diagnosis: the function name printed before the colon. FCB::Open means a file failed to open. FileMgr::StartPrimaryDataFiles, FileMgr::StartSecondaryDataFiles and FileMgr::StartLogFiles each name which stage was running. STREAMFCB::Startup means a FILESTREAM container. 17207 is the broader form of the same thing: an operating system error occurred while creating or opening a file, with the instruction to diagnose and correct the operating system error and retry.
5120 and 5123 are the same class of access failure reported for database files generally, and you meet them when user databases fail to attach even though master opened correctly. An operating system error of 2 or 3 means the path is wrong or the file is not there. An error of 5 means access denied, and the account being denied is the service account, not you. SQL Server runs under a per-service virtual account by default, and permissions granted to it do not travel with the files: restore a folder from backup, copy files to a new volume, or let a security tool reapply inheritance, and the engine loses the access it had yesterday while the files themselves are intact.
The startup parameters point somewhere wrong
You have this one if Operating system error 2 or 3, and the -d path does not match where master.mdf actually is.
- In Configuration Manager, open the instance properties and the Startup Parameters tab.
- Correct -d to the full path of master.mdf and -l to the full path of mastlog.ldf. Each is a single entry with no space after the letter.
- Leave -e pointing at a folder that exists. If the engine cannot write its error log, your best diagnostic disappears.
- Start the service and read the new error log.
Microsoft’s documented tool for this is SQL Server Configuration Manager, which writes the values into the instance’s registry key in the form the service expects.
The service account lost access to the files
You have this one if Operating system error 5, and the files are present at the paths in the parameters.
- Confirm which account the service runs as, on the Log On tab of the service properties in Configuration Manager.
- Grant that account Modify on the folder holding the system database files:
icacls "D:\MSSQL\DATA" /grant "NT SERVICE\MSSQLSERVER":(OI)(CI)M - For a named instance the account is
NT SERVICE\MSSQL$INSTANCENAME; for a domain account, use that account instead. - Check that a security tool or Group Policy is not reapplying restrictive permissions afterwards.
Another process is holding a system file
You have this one if Operating system error 32 in a 17204 or 17207 entry: the process cannot access the file because it is in use.
- Use Process Explorer or Handle from Windows Sysinternals to find the process holding the file.
- Stop it. Antivirus is the usual answer, and file-level backup agents are the next.
- In a cluster, confirm the previous node’s sqlservr.exe has released its handles before the new node starts.
- Exclude database file extensions from real-time scanning so it does not recur.
The volume is not ready when the service starts
You have this one if Starting the service by hand works, but it fails during boot, on storage presented over the network or by a hypervisor.
- Add a service dependency so SQL Server starts after the storage service it relies on.
- As an interim measure, set the service to delayed start so the storage stack is ready first.
- Check the System event log at boot time to see the order events actually occurred in.
The system database files are genuinely gone or damaged
You have this one if master.mdf is missing or unreadable and there is no copy anywhere.
- Look first for a copy: a file-level backup of the folder, a virtual machine snapshot, or the endpoint product’s quarantine if a security tool removed it.
- If none exists, rebuild the system databases with SQL Server setup.
- Start the instance, then restore master from your most recent backup, following the documented single-user restore sequence.
- Restore msdb afterwards to recover jobs, operators and backup history, then exclude database file extensions from real-time scanning.
Rebuilding gives you a working instance with an empty configuration. User databases are still on disk and can be reattached, but logins, jobs and instance settings come back only from a backup of master and msdb.
Full reference
Which failure you have
| What the entry shows | Where the fault is |
|---|---|
| Operating system error 2 or 3 | The path in the startup parameters does not exist on this server |
| Operating system error 5 | The service account has lost NTFS permission on the folder |
| Operating system error 32 | Another process holds the file. Antivirus is the usual answer |
| It started failing after a drive letter or SAN change | The startup parameters still point at the old location |
| It started failing after moving the files | The -d and -l values were never updated to match |
| 5120 or 5123 for user databases only | Per-database file permissions, not a master problem |
| The service starts then stops within seconds | The real error is in the first lines of the newest error log |
The startup options that matter here
| Option | What Microsoft documents it as |
|---|---|
| -d | The fully qualified path for the master database file. If not provided, the existing registry parameters are used |
| -l | The fully qualified path for the master database log file. If not specified, the existing registry parameters are used |
| -e | The fully qualified path for the error log file. If not provided, the existing registry parameters are used |
| -m | Starts the instance in single-user mode. Only a single user can connect, and the CHECKPOINT process is not started |
| -f | Starts the instance with minimal configuration, which also places it in single-user mode |
| -c | Shortens startup from the command prompt by skipping the Service Control Manager. It is not a configuration mode |
| -T | Starts the instance with a specified trace flag in effect |
The distinction between -c and -f is worth getting right, because they are often quoted together as if they were one thing. -f is what you use when a configuration value such as over-committed memory is preventing startup, and it forces single-user mode as a side effect. -c only affects how the process starts from a command prompt. The pair you want for a master restore is -m.
Reading the function name in a 17204
| Function in the message | What was being started |
|---|---|
| FCB::Open | A file failed to open. The rest of the message names which |
| FileMgr::StartPrimaryDataFiles | The primary data file of a database |
| FileMgr::StartSecondaryDataFiles | A secondary filegroup |
| FileMgr::StartLogFiles | A transaction log file |
| STREAMFCB::Startup | A FILESTREAM container |
If the entry names a user database, master opened successfully and the instance is running: what you have is a database that will sit in RECOVERY_PENDING, not an instance that will not start. That single distinction changes the urgency and the fix.
Rebuilding, and what it costs
Rebuilding the system databases replaces master, model and msdb with fresh copies. Logins, permissions, SQL Agent jobs, linked servers and every instance-level setting revert to defaults, and the only way back is a restore of those databases. Copy the existing files aside before you run setup, even if you believe them to be unusable.
- Copy the whole DATA folder aside with the instance stopped.
- Run SQL Server setup and use the action that rebuilds the system database files for the instance.
- Start the instance and confirm it comes up with a default configuration.
- Restore master using the documented single-user sequence, which needs the instance started with -m.
- Restore msdb to recover jobs, operators, alerts and backup history.
- Reattach user databases, then re-check logins, permissions and anything that lived at instance level.
Every code this article covers
| Code | What it points at | Source |
|---|---|---|
17113 |
An error occurred while opening a file to obtain configuration information at startup. An invalid startup option might have caused it; verify the startup options and correct or remove them | Microsoft Learn |
17204 |
Could not open a named file for a given file number, with the operating system error. The function name in the message identifies which startup stage failed | Microsoft Learn |
17207 |
An operating system error occurred while creating or opening a named file. Diagnose and correct the operating system error, and retry the operation | Microsoft Learn |
5120 |
Unable to open the physical file, with the operating system error number and text | Microsoft Learn |
5123 |
CREATE FILE encountered an operating system error while attempting to open or create the physical file | Microsoft Learn |
Confirm the fix worked
- Confirm the service is running in SQL Server Configuration Manager and stays running after a restart of the server.
- Connect and confirm the instance identifies itself correctly:
SELECT @@SERVERNAME, SERVERPROPERTY('ProductVersion'); - Confirm every database came online:
SELECT name, state_desc FROM sys.databases; - Read the newest error log from the top and confirm master, model, msdb and tempdb all started without file errors.
- Confirm the -e path is writable, so the next failure leaves you a log to read.
Questions people ask about this
Do I need to buy anything, or reactivate, to recover from this?
No. Repairing paths and permissions, and even rebuilding the system databases, all run on the licence and product key you already hold. A startup failure is not a licensing event.
Can I start the instance without master?
No, the engine cannot run without it. What you can do once it starts is run it in single-user mode with -m, which is how the documented master restore is performed. -f gives minimal configuration and also forces single-user mode; -c only skips the Service Control Manager when starting from a command prompt and is not a configuration mode.
Where are the startup parameters stored?
In the instance’s own registry key, which is what SQL Server Configuration Manager edits for you. Microsoft documents Configuration Manager as the tool for setting them, and it writes them in the form the service expects.
The error names a user database, not master. Is that the same problem?
No, and it is much better news. If a 17204 or 5120 names a user database, master opened and the instance is running. That database will sit in RECOVERY_PENDING until the file is made available, but nothing else is affected.
Can I copy master.mdf from another server?
No. Master is specific to the instance that created it and carries that instance’s configuration, logins and file layout. Rebuild the system databases and restore your own master backup instead.
