The SQL LocalDB instance 'RedGateTemp' does not exist
Published 31 July 2019
The following error text appears when running a SQL Change Automation PowerShell cmdlet or add-on:
... 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.
Open a separate command prompt.
Find what account the external tool is using:
- In the Windows Start menu, enter services.msc
- 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:
- Download and unzip PsTools, which contains PsExec. See Using PsTools.
- Open an elevated command prompt.
- In the Windows Start menu, type cmd
- Right-click the command prompt program and select Run as administrator
- Using the command prompt, navigate to the PsExec download location
- Enter one of the following commands, depending on which account you need to run to configure the build agent:
- For Local System, enter psexec -i -s cmd.exe
- For Local Service, enter psexec -u "nt authority\Local Service" cmd.exe
- For other accounts or for more information about using PsExec, see PsExec
- 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:
- At the command prompt, enter SqlLocalDB.exe info RedGateTemp
If an error message is displayed containing LocalDB instance "RedGateTemp" is corrupted!, delete the instance.
Enter SqlLocalDB.exe delete RedGateTemp
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.
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.