1

SQL services wont start due to incorrect drive letter after windows restore

Had a server crash, was successfully able to reinstall windows and restore the server SQL and all the necessary services were already installed.

Only problem the windows drives letters are wrong. So the services are pointed to the incorrect drive letter. I cant change the services in reedit or change the drive letter in disk management. Is there a way to do a repair in SQL add remove programs to associate's the necessary services with the correct drive letter?

Here's a example of the services Path to executable I:\Program Files\Microsoft SQL Server\MSSQL.1\

only problem the actual drive letter is E:

Services that wont start SQL SERVER SQL SERVER AGENT SQL Server Analysis SQL Server Analysis Services SQL Server Integration Services SQL Server Reporting Services

3
  • Consider ask this on Server Fault
    – partlov
    Commented Jan 17, 2013 at 20:26
  • This question now exist on all three forums (DBA.SE, SO, and SF). I would say DBA.SE should be its resting place.
    – user507
    Commented Jan 17, 2013 at 22:18
  • SQL Server doesn't contain only executables in Program Files. It also contains/uses registry keys that you are missing. If this is a reinstall of Windows, I completely agree with Remus, you need to reinstall SQL Server from scratch. Just keep your eyes on the database backups (or at least save the mdf and ldf files for all your databases) like it's your fortune.
    – Marian
    Commented Feb 21, 2013 at 13:08

3 Answers 3

2

I assume you've restored entire partitions, but the partition drive letters are now wrong.

If SQL is looking for I: then you have three choices

a) Fix the drive letter of the partition that's now got the data. You said this is not an option. Is that because I: is already taken, or because something else is now looking for this data based on its new drive letter (E:)

b) Add an additional drive letter for the partition - nothing stops you referring to the same partition by more than one drive letter. This isn't an option if I: is already taken and you can't move that data from I:

c) Create a symbolic link on your new I: drive to point things back to what's now on E:. Start an elevated command prompt. Then type

I:
cd "\Program Files\"
mklink /d "Microsoft SQL Server" "E:\Program Files\Microsoft SQL Server"

If you already have a Microsoft SQL Server folder on your new I: then change the mklink command to make the MSSQL.1 folder as the symlink rather than the Microsoft SQL Server folder.

2
  • Having reread Remus' answer, if you've reinstalled Windows and SQL Server then it's a new install. You can look up how to move the master database and then reattach your other DBs. The master database can change with SQL patch versions so you'd want to make sure you're patched up to the same level you were previously.
    – Ian Yates
    Commented Jan 18, 2013 at 5:24
  • I have not restored Windows on my machine, one day the service just pointed to the wrong drive, but making this symlink works for me. :)
    – NoLifeKing
    Commented Mar 14, 2018 at 7:00
2

I don't know about the other services, but for the main database service you can go into SQL Server Configuration Manager (start - all programs - microsoft sql server 2008 - configuration tools - sql server configuration manager) and change where the master database is located.

Right click SQL Server(MSSQLSERVER)[parens may be different for named instances] - properties. Go to the Advanced tab. In the startup parameters (make sure the service is off first), update it to where your master files are physically located, should look something like this for you:

-dE:\SQL\Databases\master.mdf;-ee:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\Log\ERRORLOG;-lE:\SQL\Databases\mastlog.ldf

Once you've edited it to the correct locations hit apply and restart the service and see if it comes up.

1

At the very least, you need to change your drive letter back as in the original configuration. But if reinstalled (not repaired) Windows then you basically have a new machine and you must re-install SQL and everything else on it.

2
  • Remus, do you think creating mount points to the proper paths is an option in this case? Commented Jan 17, 2013 at 22:53
  • 1
    No, it's not. SQL Server install is more than just copying files to E:\Program Files (or whatever path).
    – bojan
    Commented Feb 21, 2013 at 12:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.