Microsoft KB Archive/180738

= PRB: Windows NT Error 2140 when starting SQL Server =

Article ID: 180738

Article Last Modified on 7/14/2005

-

APPLIES TO


 * Microsoft SQL Server 6.0 Standard Edition
 * Microsoft SQL Server 6.5 Standard Edition

-



This article was previously published under Q180738



SYMPTOMS
Attempting to start the MSSQLServer service may cause the following error:

Windows NT Error 2140: An internal Windows NT error occurred.

The following error may also appear in the SQL Server errorlog:

Init config error 2. The system cannot find the file specified.

Opening master.dat for config information.



CAUSE
These errors can be caused by any of the following:  The tempdb database has been set to read-only. If this is the cause, you will see lines similar to the following at the end of the SQL Server error log:

1999/07/23 20:43:16.85 spid1 Clearing temp db 1999/07/23 20:43:20.76 spid1 Attempt to BEGIN TRANsaction in database 'tempdb' failed because database is READ ONLY. 1999/07/23 20:43:20.76 kernel Failed to create temp db

 The Master.dat file is not in the correct directory, or the Windows NT account being used does not have appropriate permissions to that directory. The Windows NT user account that the MSSQLServer service starts under does not have permission to the registry keys. An sp_configure value has been set out of range. Registry entries are missing.



WORKAROUND
If the tempdb database has been set to read-only, do the following: <ol> Open a command prompt and start SQL Server with the command sqlservr -c -f .</li>  Connect to the SQL Server in ISQL or ISQL/w, and run the following command: sp_dboption tempdb, 'read only', false SQL Server should now start normally. </li></ol>

If the problem was not caused by tempdb being read-only, then use the following steps: <ol> Check to make sure the Master.dat file exists in the <SQL_root>\Data directory. There may be a case where the master device was installed to another directory. To determine this, check the errorlog from the <SQL_root>\Log directory. If you find an operating system error 2 ("Could not find the file specified"), it will also list the path to the directory where SQL Server expects to find Master.dat.

If you locate Master.dat and it is not in the <SQL_root>\Data directory, use the following command to start the MSSQLServer service:

sqlservr /d<path_to_Master.dat> /e<path_to_errorlog>

Note There is no space between the command switches (that is, "d" or "e") and the paths. For more information on the SQLSERVR command-line executable program, see the SQL Server Books Online.

If SQL Server starts, the startup entries in the registry are incorrect. To correct them, skip to step 4 of this procedure, below.</li> In Control Panel Services, select the MSSQLServer service and click Startup. In the Log On As section, note what account SQL Server is running under. Make sure this Windows NT account has all the appropriate permissions to read all the SQL Server registry keys, as well as the directory containing the Master.dat file. For additional information on MSSQLServer service permissions, see the following article in the Microsoft Knowledge Base:

164167 INF: Troubleshooting SQL Security Manager Messages

</li> Check to make sure that the sp_configure values are not set too high. For information on how to do this, see the following article in the Microsoft Knowledge Base:

173090 INF: Changing configuration values when SQL Server won't start

</li> If none of the preceding steps resolves the problem, run Registry Rebuild for SQL Server from SQL Server setup. To do this, perform the steps below.

Note It is recommended that you make a complete backup of your system before performing the registry rebuild. <ol style="list-style-type: lower-alpha;"> Restart the computer and log on as the administrator of the local computer.</li> Use SQL Server Setup to note the options that are currently configured in the registry, for example, the network libraries that SQL Server is currently listening in on, or the Security model (Standard, Integrated, or Mixed) that SQL Server is using.</li> From a command prompt, issue the following command from the <SQL_root>\Binn directory:

setup /t RegistryRebuild = On

Note This command must be typed exactly as shown, including capitalization. The spaces surrounding the equal sign (=) are required.

SQL Server Setup will start. It will appear as though SQL Server is being reinstalled, but it is just rewriting the registry information. Ensure that the path to where SQL Server and Master.dat are located is correct. Reset any options noted in the previous step (step b.)

Note Information on the character set, sort order, and size of the master database is stored within the existing Master.dat file.</li> Start SQL Server normally.</li></ol> </li></ol>

<div class="moreinformation_section">

MORE INFORMATION
For more information on the RegistryRebuild option of Setup, see the following article in the Microsoft Knowledge Base:

157805 BUG: RegistryRebuild Option of setup is not documented

Additional query words: initconfig event log errorlog

Keywords: kbprb kbpending KB180738

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.