Occasionally a database administrator may need to set a Microsoft SQL Server database to ‘offline’, normally because he or she needs to cut external access to the database without wanting to detach or delete it.
Sometimes a problem arises when the user attempts to set the database offline and they receive the error below:
ALTER DATABASE failed because a lock could not be placed on database [database]. Try again later. ALTER DATABASE statement failed. (Microsoft SQL Server, Error: 5061)
This is an incredibly irritating problem and it’s hard to find a solution. Those who hunt will likely find a solution mentioning the following:
ALTER DATABASE database SET SINGLE_USER WITH ROLLBACK IMMEDIATE
This command will not help.
This PDF provides a guaranteed solution that will allow you to take your database offline and goes through in detail how you need to execute a stored procedure to diagnose the database and then perform a further stored procedure to prepare it for being taken offline.
As with all our PDF downloads, if you encounter any issues then simply contact us for support. If we can't help you, we refund the cost of the PDF.