How to get sizes of all databases on SQL Server?

There are several ways to find the size of SQL Server databases. However, the easiest method to get the list of all the databases along with their sizes is by using the system stored procedure sp_databases. Here is an example on how to execute this stored procedure and the result.

EXEC sp_databases;

/* Result */
DATABASE_NAME	    DATABASE_SIZE	REMARKS
DnnDev.me	    41280	        NULL
master	            6592	        NULL
model	            16384	        NULL
msdb	            42368	        NULL
MtbToolsDB	    291840	        NULL
SirApp	            16384	        NULL
SirDB_201804	    167552	        NULL
tempdb	            16384	        NULL
Test.MyTecBits.com  24576	        NULL
WideWorldImporters  3379200	        NULL

NOTE: In this, the size of the database is given in kilobytes. Also, this method will not give you the sizes of log file and data file separately. So, you can use this method to find the database with large size.

get sizes of all databases on SQL Server

Go here for more SQL Server tips.

Reference


Leave your thoughts...

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