How to delete a Database -Error throws the action cant be completed

Posted on

Question :

Am trying to delete the WSS_UsageApplication database in my sql server 2012 SP2 and this is one of the databases associated with SharePoint.
since its consuming huge db space – 62 GB!! of my hard disk and my application is very very slow.

How to delete this database?
when i tried to delete this from Data folder, am unable to delete the same.
it says the error :

the action cant be completed because the file is open in sql server.

[![unabel2delete-DB][1]][1]

Answer :

You can’t delete it because it’s open in SQL Server.

If you want to delete it, you’ll have to stop SQL Server and delete the files.

You could also go on the server and run DROP DATABASE WSS_UsageApplication;, assuming you have permission, and the database isn’t in use. You may need to run ALTER DATABASE WSS_UsageApplication SET SINGLE_USER WITH ROLLBACK IMMEDIATE; first.

But really, deleting a 62 GB database because your ‘application is slow’ seems like a terrible idea. Since you’re here asking why you can’t delete a database that’s in use by SQL Server, you probably haven’t taken steps to tune anything. SharePoint is supported by Microsoft. Have you opened a ticket with them?

62 GB is also absolutely nothing. I’m typing to you from a laptop with two 1 TB SSDs in it. Is this really a concern?

You should at very least take a FULL backup of the database before proceeding.

Leave a Reply

Your email address will not be published.