Categories
Dynamics NAV HOW TO Microsoft SQL Server

HOW TO take offline a database in SQL Server

HOW TO take offline a database in SQL Server?

Microsoft Sql Server Management Studio

Right click on the database node > Tasks > Take Offline

T-SQL Script

Execute the following query
[sourcecode lang=”sql”]
ALTER DATABASE [DatabaseName] SET OFFLINE WITH
ROLLBACK IMMEDIATE
GO
[/sourcecode]

If it seems that the command doesn’t work or the execution requires more time or to force to take offline or

if you’ll receive the following error:
ALTER DATABASE failed because a lock could not be placed on database ‘{DatabaseName}’. Try again later.

click on the following link to show the Solution:
ALTER DATABASE failed because a lock could not be placed on database

Did my HOW TO help you? Leave a reply.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.