How to use the GUI Tools In SQL

One of the easiest ways to get the size of a database in SQL Server is to use GUI tools, such as SQL Server Management Studio (SSMS) or Azure Data Studio路 These tools provide various reports and properties that display the size of a database in a user-friendly way路

For example, in SSMS:

  • right-click on a database
  • Go to Reports, then Standard Reports, and then click Disk Usage路

This will open a report that shows the disk space used by the data and log files of the database, as well as the unallocated space and the reserved space路 The report also shows a pie chart and a bar chart that visualizes the system-stored distribution of the space路

GUI

Output:

Output

Advantages and Disadvantages of using the GUI tools

Advantages

Disadvantages

Easy to use

Not suitable for automation or scripting

Povide a clear and comprehensive view of the size of a database

May not be available or accessible in some environments

How to Get Database Size in SQL

SQL database size is vital for effective management. It indicates the storage space occupied by tables, indexes, and other components. Knowing the size of a database is useful for various purposes, such as monitoring the growth, estimating the backup time, planning the storage capacity, and optimizing performance路

In this article, we will learn how to get the size of a database in SQL Server using different queries or management tools.

Similar Reads

Get SQL Database Size

The size of a database in SQL Server may be measured in exclusive ways, depending on what we need to include or exclude路 For instance, we can measure the scale of the facts documents, the log documents, the reserved space, the used area, the unallocated area, or the whole space路 We also can measure the size of a single database, a set of databases, or all databases within the server....

Using the GUI Tools

One of the easiest ways to get the size of a database in SQL Server is to use GUI tools, such as SQL Server Management Studio (SSMS) or Azure Data Studio路 These tools provide various reports and properties that display the size of a database in a user-friendly way路...

Using the sp_spaceused Stored Procedure

Another way to get the size of a database in SQL Server is to use the sp_spaceused system stored procedure路 This stored procedure displays the number of rows, disk space reserved, and disk space used by a table, indexed view, or Service Broker queue in the current database, or displays the disk space reserved and used by the whole database路...

Using the sp_helpdb Stored Procedure

Another system-stored procedure that can be used to get the size of a database in SQL Server is sp_helpdb路 This stored procedure lists databases that either reside in an instance of the SQL Server or are accessible through a database gateway路...

Using the sp_databases Stored Procedure

Yet another option to get the size of a database in SQL Server is the sp_databases system stored procedure路 This stored procedure lists databases that either reside in an instance of the SQL Server or are accessible through a database gateway路...

Using the sys.master_files Catalog View

Another way to get the size of a database in SQL Server is to use the sys路master_files catalog view路 This view contains a row per file of a database as stored in the master database路...

Using the sys.databases Catalog View

The last method we will cover in this article is to use the sys路databases catalog view路 This view contains one row per database in the instance of SQL Server路...

Conclusion

This article explained various methods to determine a database size in SQL Server, including GUI tools, system stored procedures, and system catalog views路...