TSQL Script to Take Database Offline and Take Database Online Microsoft SQL Server 2014

TSQL Script to Take Database Offline and Take Database Online Microsoft SQL Server 2014

DBIf You wish to take a Microsoft SQL Server 2014 database offline or online, You need to use the GUI . GUI path is Tasks-Take Online or Take Offline.

On the other hand you can do it as a following sql scripts

Firstly, you can take offline

USE master
GO
ALTER DATABASE DB_Name
SET OFFLINE WITH ROLLBACK IMMEDIATE
GO

Secondly, you can take online

USE master
GO
ALTER DATABASE DB_Name
SET ONLINE
GO

Leave a Reply

Your email address will not be published. Required fields are marked *