Sql-server – Sql Server Installation can’t find files

installationsql serversql-server-2012

Okay, I wasn't sure whether to ask this here or on Server Fault, but the FAQ for DBA says it includes db configuration, so I'm going with here.

I'm installing Sql Server Express 2012 on a clean Windows Server 2012 box.

The install seems to go fine right up till the very end.

I left the program install directory at C:\Program Files....
I changed the instance root directory to D:\SQLE2012ROOT\.

Install chugs along happily, and when it ends, it says setup completed, but encountered the following error:

Feature:              Database Engine Services
Status:               Failed: see logs for details
Reason for failure:   An error occurred during the setup process of the feature.
Next Step:            Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
Component name:       SQL Server Database Engine Services Instance Features
Component error code: 0x851A001A
Error description:    Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes.

(it also gives a URL to go to, but clicking it just takes you to a Microsoft home page that shows consumer products to buy, like Surface and XBox. Thanks MS!)

The SQL service in Service Manager is stopped, and if you try to start it, chokes with message about service-specific error code 945, which googling, says it means Sql Server cannot find the necessary files.

Looking in the Event Logs after trying to start the service shows these two errors (each shows twice, once for MSDBData.mdf and once for model.mdf):

FileMgr::StartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'e:\sql11_main_t.obj.x86release\sql\mkmastr\databases\objfre\i386\modellog.ldf'. Diagnose and correct the operating system error, and retry the operation.  

and

FCB::Open failed: Could not open file e:\sql11_main_t.obj.x86release\sql\mkmastr\databases\objfre\i386\MSDBData.mdf for file number 1. OS error: 21 (The device is not ready.).

It would make sense that it cannot find those files, as the E: is an optical drive on the server, with no media mounted in it.

The million dollar question though is WHY it is looking for the files in that location? I've checked, and the setup DID actually create the files in the correct location under my specified instance root (D:\SQLE2012ROOT\MSSQL11.SQLE2012\MSSQL\DATA). But for some unknown reason, Sql Server is LOOKING for them under what looks like a development project build directory off the E: drive.

I looked in the registry and grepped on the C: to see if I could find where it was pointing to this wrong directory and simply re-point it, but I couldn't find anywhere where it pointed to that location.

I've already uninstalled once, and reinstalled from scratch again, and it did the same thing. The install file used was the 64 bit one that includes Management Studio, SQLEXPRWT_x64_ENU.


I've tried a number of things now, and could not get the 2012 to install. So I figured maybe just go to 2016 and see if that works. It installed but again had the same error as before, about Waiting on the Database Recovery handle. After setup concluded, I tried to start the service manually, and got the same errors in the event log about being unable to locate the MSDBDATA and MODEL files, though it has a different wrong path this time. Now it is attempting to look for those files in the directory D:\B\S2\Sources.obj.x86Release\sql\mkmastr\databases\mkmastr.proj\. I checked the startup parameters for the service in Sql Server Configuration Manager…

enter image description here

The file paths listed in the startup parameters ARE CORRECT.
I have no idea why it is looking for the files in this other wonky D:\B\S2... directory.

Best Answer

I think you are trying to start instance from a failed installation. Un installing and reinstalling SQL Server may clear this error.

Please look into below link which deals with similar issue.

https://connect.microsoft.com/SQLServer/feedback/details/684859/during-install-set-the-default-location-of-databases-problem