When SQL Server database is offline, it means the database is temporarily unavailable and cannot be accessed for use by any application or user until it is brought back online.
The database may be taken offline temporarily for maintenance tasks such as backups, index rebuilds, or schema changes.
To check the status of a SQL Server database and determine whether it is offline or online, you can use the following T-SQL command:
USE [master]; SELECT state_desc, name FROM sys.databases where [name] = 'SQL Tutorial';
As you can see in below image, [SQL Tutorial] is ONLINE. Let's take it to OFFLINE.
1. Run below SQL command in SSMS :
USE [master]; ALTER DATABASE [SQL Tutorial] SET OFFLINE;
2. Above command will take [SQL Tutorial] database to OFFLINE.
That's it! You have successfully taken [SQL Tutorial] database OFFLINE using T-SQL.
1. Right-click on the database that you want to take offline >> Select "Tasks" >> Select "Take Offline".
2. In take database offline dialog box, select the checkbox "Drop All Active Connections", this will close active connections before taking database offline >> Click on the "OK" button.
3. There you go, [SQL Tutorial] database taken OFFLINE successfully.
That's it! You have successfully taken [SQL Tutorial] database OFFLINE using GUI.
SQL can't be used entirely offline as it requires a database server, but some tasks can be performed offline with SQLite.
To make a database offline in SQL Server, detach it from the server.
Yes, you can practice SQL offline with tools like SQLite or by setting up a local database server.
An offline database is a database that is not actively connected to a database server and can be accessed locally on a device.