SQL Server 2012/14 Installation Error

SQL Server 2012/14 Express Edition fails after Installation

This problem appears near the end of the installation of SQL Server 2012/14 Express Edition. SQL Service needs to start once the installation is complete instead failing to leave the below errors in the event viewer:

Log Name:      Application
Source:        MSSQL$SQLEXPRESS
Date:          21.09.2015 13:50:56
Event ID:      17207
Task Category: Server
Level:         Error
Keywords:      Classic

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\MSDBLog.ldf'. Diagnose and correct the operating system error, and retry the operation.

Most solutions on the web suggested to uninstall and try with another account, but that didn’t work for me. Here is how I got it to work:

  1. Make sure that the stopped “SQL Server (SQLEXPRESS)” service is running under the “Local System” account
  2. Open a cmd box and start the service with
    NET START MSSQL$SQLEXPRESS /f /T3608
    (Yes, it will start!)
  3. Start SQLCMD with:
    SQLCMD -S .\SQLEXPRESS
  4. Issue the following SQL commands, you will see some wrong file paths:
    SELECT name, physical_name, state_desc FROM sys.master_files ORDER BY database_id;
    go
  5. Now correct these paths in the DB:
    ALTER DATABASE model MODIFY FILE ( NAME = modeldev, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\model.mdf');ALTER DATABASE model MODIFY FILE ( NAME = modellog, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\modellog.ldf');ALTER DATABASE msdb MODIFY FILE ( NAME = MSDBData, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\MSDBData.mdf');ALTER DATABASE msdb MODIFY FILE ( NAME = MSDBLog, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\MSDBLog.ldf');ALTER DATABASE tempdb MODIFY FILE ( NAME = tempdev, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\temp.mdf');ALTER DATABASE tempdb MODIFY FILE ( NAME = templog, FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\temp.ldf');
    go
  6. Exit the SQLCMD:
    exit
  7. Stop the SQL service:
    NET STOP MSSQL$SQLEXPRESS
  8. Start the SQL service normally. It will now start and do the initialisation of the tables, this might take a bit longer.
  9. In SQL Configuration Manager, make sure that all protocols are active:
    SQL Server Network Configuration > Protocols for SQLEXPRESS > Shared Memory, Named Pipes and TCP/IP = enabled

That shall allow the SQL Service to start successfully.

Leave a Reply

Your email address will not be published. Required fields are marked *

PHP Code Snippets Powered By : XYZScripts.com