SQL Prompt 10 - database is locked
GarySBR
Posts: 1 New member
in SQL Search
Hello. Once in a while my SSMS session will get taken over by SQL Prompt getting "database is locked" errors. Opening a new query tab will hang SSMS for about 30 or 60 seconds, the Red Gate error dialog will pop up with "database is locked" (sometimes multiple lines of it in the one dialog), clicking through the pop up will open the query tab. Trying to close SSMs gracefully will not work, as every attempt to close leads to the freeze, delay then the popup...I have to kill the ssms process.
Which database is Prompt having trouble with...a db on the instance or its own internal db? I haven't found anything about database is locked in the Prompt log files.
Thanks!
Which database is Prompt having trouble with...a db on the instance or its own internal db? I haven't found anything about database is locked in the Prompt log files.
Thanks!
Tagged:
Answers
1. Close SSMS
2. Open the latest SQL Prompt log file in %localappdata%\Red Gate\Logs\SQL Prompt 10 and search for the error message "database is locked"
Sample result is as follows:
Result: it is verified that the error has something to do with SQL Prompt 10 due to the error message could be found. It is clear now that the error message was raised by SQLite
3. Move to folder %localappdata%\Red Gate\SQL Prompt 10
There are two SQLite databases, SavedTabs.db and SqlHistory.db
4. Create a backup of each, for example with Ctrl+C, Crt+V of each file
Note: a backuped SQLlite file have no locks anymore
5. Delete or rename each of SavedTabs.db and SqlHistory.db
6. Rename the backuped files to SavedTabs.db and SqlHistory.db
7. Start SSMS
I checked the logs, and found that this was the first error logged (in the sqlprompt-sqlhistory log file):
UNIQUE constraint failed: Queries.CurrentPath
In the other log file (sqlprompt) I then have various database locked errors after that point - this is the first one:
Once it started, I could reset the service to unlock the files and view tab history. However, this kept happening most times I opened a tab and Every Time I tried to add a Star to a tab. It would hang a few seconds and then show the error.
I had to kill SSMS when closing since that also threw the error which blocked a clean shutdown.
I uninstalled and downgraded to 10.12.1 and so far, it's been ok - (at least for 30 min so far)
Has any progress in addressing this issue been made?
It isn't a root-cause fix, but I can tell you for sure that this is related to Tab History.