/ / How to delete database sql server

How to delete database sql server?

0

There are situations where sometimes a database is stuck in recovery mode.

1. During the Restore process without running this command –
RESTORE DATABASE mydatabase WITH RECOVERY

2. when the drive space is not sufficient and the transaction log size is unable to handle.

So – for the above two reasons, my database went to recovery mode. If you try to delete the database from SSMS (SQL Server Management Studio), the system will throw an error.

1. In order to delete, stop your SQL Server Services (including SQL Server Agent).
2. Navigate to the location where your mdf and ldf files are reside.
3. Delete both of them, and restart the SQL Server services.
4. Open SSMS and expand the databases folder, you will still see the database is in In Recovery (Pending) state.
5. You can then, right click on the database and delete it.

Comments: