SQL Server Error 1039: Option Specified More Than Once
In this article
SQL Server Error 1039 occurs when a command-line argument or a startup parameter is provided multiple times in the configuration, causing a conflict that prevents the service from starting or the utility from executing. To fix this, you must identify the duplicate flag in the SQL Server Configuration Manager or the registry and remove the redundant entry.
What You'll Need
- Administrative access to the Windows Server or workstation hosting the SQL Server instance.
- SQL Server Configuration Manager installed on the machine.
- Access to the Windows Registry Editor (regedit) for manual overrides if the Configuration Manager fails.
- The specific error log or event viewer output to identify which exact option is being duplicated.
Step-by-Step
- Identify the Duplicate Parameter: Before making changes, open the Windows Event Viewer. Navigate to Windows Logs > Application and look for the Error 1039 entry. The log will typically specify which parameter is duplicated (for example, if
-mor-fappears twice). Note this parameter exactly as it appears. - Open SQL Server Configuration Manager: Click Start, search for SQL Server Configuration Manager, and run it as an Administrator. Labels and menu paths may vary slightly depending on the version of SQL Server installed.
- Locate the SQL Server Service: In the left-hand pane, click on SQL Server Services. In the center pane, right-click the specific instance of SQL Server that is failing to start (e.g., SQL Server (MSSQLSERVER) or a named instance like SQL Server (SQLEXPRESS)).
- Access Startup Parameters: Select Properties from the right-click menu. In the Properties window, click on the Startup Parameters tab.
- Scan for Duplicates: Look through the list of parameters in the "Startup parameters" text box. This is a single text field where parameters are listed side-by-side. Look for any flag that appears more than once. Common culprits include
-m(single-user mode),-f(minimal configuration), or memory-related flags like-m(which can be ambiguous depending on context). - Remove the Redundant Entry: Carefully delete the duplicate parameter. Ensure you leave exactly one instance of the required parameter. Be cautious not to delete the space between parameters, as this can lead to further syntax errors.
- Save and Apply: Click OK to save the changes and close the Properties window.
- Restart the Service: Right-click the SQL Server service again and select Start. If the service was already in a "Starting" or "Stopping" state, you may need to kill the process in Task Manager before attempting to start it again.
Common Mistakes
One of the most frequent mistakes is confusing similar-looking parameters. For instance, some administrators may accidentally add -m for single-user mode while another script has already added it for a different configuration purpose. Another common error is deleting the wrong instance of a parameter when using a named instance, accidentally modifying the default instance instead.
Users also frequently forget to run the Configuration Manager as an Administrator. Without elevated privileges, the changes made to the Startup Parameters tab may appear to save, but the system will fail to write the changes to the Windows Registry, leaving the duplicate parameter in place and the error unresolved.
Additionally, some users attempt to fix the error by reinstalling the SQL Server instance. This is rarely necessary and results in significant downtime and potential data loss if backups are not handled correctly. Error 1039 is a configuration issue, not a corruption of the binary files, and can be solved entirely through parameter cleanup.
Tips
To prevent this error in the future, avoid using automated scripts to add startup parameters without first checking if the parameter already exists. If you are using PowerShell to manage SQL Server configurations, implement a check that reads the current startup parameters string and only appends the new flag if it is not already present in the string.
Keep a documented record of the startup parameters used for each environment (Development, Staging, Production). When migrating configurations between servers, manually verify the parameters rather than copying and pasting the entire string, as different hardware environments may require different memory or CPU affinity settings.
When working in single-user mode (-m), remember that only one connection is allowed. If you are troubleshooting Error 1039 while in single-user mode, ensure that no other background services (like SQL Server Agent or a monitoring tool) have already seized the single available connection, or you will be unable to log in even after fixing the duplicate parameter.
Troubleshooting
If the SQL Server Configuration Manager does not show a duplicate but the error persists, the issue may be residing directly in the Windows Registry. This can happen if a third-party tool or a corrupted script wrote to the registry bypassing the official management tool.
Manual Registry Fix:
- Press Win + R, type
regedit, and press Enter. - Navigate to the following path:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL[Version].[InstanceName]\MSSQLServer\Parameters. - Look for the
SQLArg0,SQLArg1, etc., values. Each value represents a startup parameter. - Compare the values. If you see two entries with the same flag (e.g.,
SQLArg2is-mandSQLArg5is also-m), you must remove the duplicate. - To remove a registry entry safely, you cannot simply delete the
SQLArgkey if it breaks the sequence. Instead, clear the value of the duplicate entry or re-index the remaining arguments sequentially. - Restart the server or the SQL service to apply the registry changes.
If the service still refuses to start, check the SQL Server Error Log located in the LOG folder of the installation directory. The log provides a more granular view of the boot sequence and will confirm if the 1039 error has been resolved or if a new configuration error (such as a typo in a remaining parameter) has emerged.
Frequently Asked Questions
Can Error 1039 happen after a Windows Update?
It is unlikely for a standard Windows Update to add duplicate parameters. However, if a system restore was performed or if a configuration backup was applied over a newer version, duplicate entries can occur in the registry.
Does this error affect the SQL Server Agent?
Error 1039 specifically affects the SQL Server Database Engine. While the Agent depends on the Engine to run, the Agent itself does not cause this error; it simply fails to start because the underlying Engine service cannot initialize.
Is it safe to remove all startup parameters?
No. Some parameters are essential for the instance to function, especially for named instances or those using non-standard ports and memory limits. Only remove the specific duplicate identified in the error logs.
Why does the Configuration Manager not always show the duplicate?
The Configuration Manager provides a simplified view. If the registry contains malformed entries or parameters that don't follow the standard SQLArg numbering sequence, the GUI may fail to display them, necessitating a manual registry check.
Will fixing this error cause data loss?
No. Startup parameters control how the SQL Server engine initializes (e.g., memory allocation, single-user mode, trace flags). They do not modify the actual database files (.mdf or .ldf), so your data remains safe.
Can I fix this using SQL Server Management Studio (SSMS)?
No. SSMS requires the SQL Server service to be running to connect. Since Error 1039 prevents the service from starting, you must use external tools like Configuration Manager or the Registry Editor.