While it is not recommended (mostly due to security reasons), SQL can be run on a Domain Controller. But the following 2 points have to be considered:
- The order is important: SQL can be installed on a DC. But a SQL server cannot be made a DC. So: DC first, then SQL
- You cannot use the following 3 accounts for the SQL service:
Local Service, Network Service, MSSQL$SQLEXPRESS
Although I used these guidelines, it did not work for me. Near the end of the install, when the SQL service is started for the first time, I got these log entries:
Log Name: Application
Date: 21.09.2015 13:50:56
Event ID: 17207
Task Category: Server
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.
The installation stopped. 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:
- Make sure that the stopped "SQL Server (SQLEXPRESS)" service is running under the "Local System" account
- Open a cmd box and start the service with
NET START MSSQL$SQLEXPRESS /f /T3608
(Yes, it will start!)
- Start SQLCMD with:
SQLCMD -S .\SQLEXPRESS
- 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;
- 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');
- Exit the SQLCMD:
- Stop the SQL service:
NET STOP MSSQL$SQLEXPRESS
- Start the SQL service normally. It will now start and do the initialisation of the tables, this might take a bit longer.
- 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
So now your DB instance is ready, but there is one problem, there are no valid users (except the sa account) in it, so you can't login and use it.
To sort this problem, go to my post here.