The error messages in your Event Viewer clearly indicate that SQL Server Express cannot find critical system database files (MSDB, model) which are expected to be located at e:\sql11_main_t.obj.x86release\sql\mkmastr\databases\objfre\i386\
. This is happening because the installation process somehow retained build server paths instead of using proper local paths.
This typically occurs when:
- The SQL Server installation was performed from a build directory rather than proper installation media
- There was an incomplete or corrupted installation
- The VPS environment differs significantly from the build environment
Here's how to properly fix this issue:
1. Verify Current Data Paths
First, check where SQL Server is currently looking for files by examining the registry:
REG QUERY "HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQLServer" /v DefaultData
REG QUERY "HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQLServer" /v DefaultLog
2. Reinstall System Databases
The most reliable solution is to rebuild the system databases:
-- Stop SQL Server service if running
NET STOP MSSQL$SQLEXPRESS
-- Run this command from an elevated command prompt
"C:\Program Files\Microsoft SQL Server\110\Setup Bootstrap\SQLServer2012\setup.exe" /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=SQLEXPRESS /SQLSYSADMINACCOUNTS="BUILTIN\ADMINISTRATORS" /SAPWD="YourStrongPassword"
3. Verify the Repair
After rebuilding, check the new paths:
SELECT name, physical_name
FROM sys.master_files
WHERE database_id IN (1,2,3,4) -- system databases
If you have access to the original files, you can:
- Locate the actual database files (they might be in C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA)
- Update the registry paths to point to the correct location
- Restart the SQL Server service
To avoid similar problems:
- Always use official installation media
- Verify installation paths during setup
- Check the SQL Server error logs after installation
After applying the solution, verify the service is running:
NET START MSSQL$SQLEXPRESS
sc query MSSQL$SQLEXPRESS
You should see the service in RUNNING state and be able to connect using SQL Server Management Studio.
After installing SQL Server 2012 Express on a fresh VPS and rebooting, the SQL Server service fails to start with error messages indicating missing database files in non-existent paths (e.g., e:\sql11_main_t.obj.x86release\...
). The event logs show critical errors when attempting to locate system databases:
FCB::Open failed: Could not open file e:\sql11_main_t.obj.x86release\...\MSDBData.mdf FileMgr::StartLogFiles: OS error 2 occurred while opening 'e:\...\MSDBLog.ldf'
The core issue stems from incorrect file paths for system databases (master
, model
, msdb
) that were created during installation. The paths reference a development machine's drive (E:\) rather than your actual VPS configuration (C:\). This typically happens when:
- The installation media was built from development sources
- The setup process didn't properly relocate database files
- Registry entries contain incorrect file paths
1. Verify Current Configuration
Run this SQLCMD command to check current file locations (if possible):
sqlcmd -E -Q "SELECT name, physical_name FROM sys.master_files"
2. Rebuild System Databases
Use the SQL Server setup utility with reconstruction parameters:
Setup.exe /QUIET /ACTION=REBUILDDATABASE /INSTANCENAME=SQLEXPRESS /SQLSYSADMINACCOUNTS="YourAdminAccount" /SAPWD="YourStrongPassword" /SQLCOLLATION=SQL_Latin1_General_CP1_CI_AS
3. Manual File Relocation (Alternative)
For advanced users who need to preserve existing configurations:
-- After starting SQL Server in minimal configuration mode ALTER DATABASE model MODIFY FILE (NAME='modeldev', FILENAME='C:\Program Files\...\model.mdf') ALTER DATABASE model MODIFY FILE (NAME='modellog', FILENAME='C:\Program Files\...\modellog.ldf') -- Repeat for msdb and master databases
When installing SQL Server Express on new VPS instances:
- Always verify default file locations during installation
- Use command-line parameters to specify paths explicitly:
Setup.exe /SQLUSERDBDIR="C:\SQLData" /SQLUSERDBLOGDIR="C:\SQLLogs" ...
- Consider using newer SQL Server Express versions (2016+) with better container support
If problems persist, check these key items:
- Service account permissions on target directories
- Available disk space (minimum 2GB free for system databases)
- Antivirus software blocking file access