SQL Change Automation 4

The SQL LocalDB instance 'RedGateTemp' does not exist

The following error text appears when running a SQL Change Automation PowerShell cmdlet or add-on:

Error message

 ... The SQL LocalDB instance 'RedGateTemp' does not exist ...


Your RedGateTemp instance can be corrupt. This is a known issue with LocalDB.


Delete the corrupt RedGateTemp instance from LocalDB. SQL Change Automation will recreate this when needed.

If you're using an external tool, such as TeamCity, you'll need to log on to the same account the service uses before deleting the RedGateTemp instance. 

 If you're not using an external tool

Open a separate command prompt.

 If you're using an external tool

Find what account the external tool is using:

  1.  In the Windows Start menu, enter services.msc
  2. Find the external tool, and note the entry in the Log On As column. In this example, the TeamCity build agent is running under Local System:

Use Microsoft's PsExec tools to log on to the account the external tool is using:

  1. Download and unzip PsTools, which contains PsExec. See Using PsTools.
  2. Open an elevated command prompt.
    1. In the Windows Start menu, type cmd
    2. Right-click the command prompt program and select Run as administrator
  3. Using the command prompt, navigate to the PsExec download location
  4. Enter one of the following commands, depending on which account you need to run to configure the build agent:
    1. For Local System, enter psexec -i -s cmd.exe
    2. For Local Service, enter psexec -u "nt authority\Local Service" cmd.exe
    3. For other accounts or for more information about using PsExec, see PsExec
  5. A new command prompt is displayed. You should be logged on to the correct account for your external tool. To check this, enter whoami

You can now delete the RedgateTemp instance:

  1. At the command prompt, enter SqlLocalDB.exe info RedGateTemp
    If an error message is displayed containing LocalDB instance "RedGateTemp" is corrupted!, delete the instance. 
  2. Enter SqlLocalDB.exe delete RedGateTemp

  3. Enter SqlLocalDB.exe info to display a list of instances. Check that the RedGateTemp instance no longer exists. 

You can now try running the process again. The instance should be created automatically without corruption errors.

Fix 2

You can also check Windows Event Log, if there is an error similar to "LocalDB parent instance version is invalid: MSSQL11E.LOCALDB", delete the relevant GUID entry located at HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SQL Server\UserInstances.

If you're still experiencing issues with LocalDB, contact Redgate Support.

Didn't find what you were looking for?