Adding Registry Keys

When you install SQL Server, the setup program writes a set of default startup options in the Windows NT Registry under the key:

HKEY_LOCAL_MACHINE
    \SOFTWARE
        \Microsoft
            \MSSQLServer
                \MSSQLServer

If you want to create and store alternate sets of startup options in the Registry ¾ for example, to start SQL Server in single-user mode ¾ copy the MSSQLServer key (under MSSQLServer) to a new key, and then edit the options in the new key to suit your needs. Each startup option is stored as a separate parameter in the Parameters entry of the MSSQLServer key, starting with SQLArg0, then SQLArg1, and so on. The order of the parameters is not important.

Only experienced users should use REGEDT32 to edit the Windows NT registry. Editing of the Registry is not generally recommended, and inappropriate or incorrect changes can cause serious configuration problems for your system.

    To copy the Server key to a new key
  1. Start the Registry editor (run the REGEDT32.EXE program).
  2. Switch to the HKEY_LOCAL_MACHINE window.
  3. Double-click the SOFTWARE entry.
  4. Double-click the Microsoft entry.
  5. Select the MSSQLServer entry.
  6. From the Edit menu, choose Add Key.
  7. In the Key Name box, enter a name for the new key.
  8. Choose the OK button.
  9. Select the MSSQLServer entry (under MSSQLServer).
  10. From the Registry menu, choose Save Key.
  11. In the File Name box, enter a filename for the saved key.
  12. Choose the OK button.
  13. Select the new key.
  14. From the Registry menu, choose Restore.
  15. In the File Name box, enter the filename for the saved key.
  16. Choose the OK button.
  17. Choose the Yes button.

For example, you could create a new key called SingleUser and then edit this Registry entry to include the additional -m startup option.

HKEY_LOCAL_MACHINE
    \SOFTWARE
        \Microsoft
            \MSSQLServer
                \SingleUser
                    \Parameters

Using this procedure, you could create a new key called SingleUser, and then edit this entry

HKEY_LOCAL_MACHINE
    \SOFTWARE
        \Microsoft
            \MSSQLServer
                \SingleUser
                    \Parameters

to include the additional -m startup option.

The entire Parameters entry for the SingleUser key would look like this:

HKEY_LOCAL_MACHINE
    \Software
        \Microsoft
            \MSSQLServer
                \SingleUser
                    \Parameters
SQLArg0 : REG_SZ : -dC:\SQL\DAT\MASTER.DAT
SQLArg1 : REG_SZ : -eC:\SQL\LOG\ERRORLOG
SQLArg2 : REG_SZ : -m
 

To start SQL Server using this alternate key, you would start SQL Server from the command line using the -s startup option, as shown in the following example:

sqlservr -c -sSingleUser