I have a similar problem to this one here : How to remove a list of accidently deleted databases from Sql Server Management Studio's tree-like list? but the provided solution to that question hasn't helped me.
I have a number of database .mdf files that were created (and subsequently deleted from the folder) by VS's web testing.
My SSMS is now chock full of .mdf database files that no longer exist that I can't get rid of.
Current things I have tried (to no avail):
1. Refreshing the databases (at every level of the tree)
2. Right-click and deleting the databases. I receive the error:
3. Recreating the file in the given folder structure (Still doesn't recognise it)
If possible I'd like to avoid having to completely reinstall SS all over again.
If you? ve the Full database backup available, you can try recovering deleted records using the transaction log with Log Sequence Number (LSN). If the backup is corrupted, use Stellar Repair for MS SQL to recover the deleted data in SQL Server or in other formats like Comma Separated Value (CSV) files, HTML, or XLS.
To remove a database from the current server without deleting the files from the file system, use sp_detach_db. USE master; ALTER DATABASE [databasename] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; DROP DATABASE [databasename] ; Note, database backups will not be deleted as part of the process documented above.
I had the same problem. Accidentally deleted a database and could not get it removed from the list in SSMS.
In SSMS right click on database then "Delete". Ignore the error, press "Cancel" in dialog. Then right click on database again, choose "Policies"->"Delete Health States". Refresh the instance databases and the database should not be in the list.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With