<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Storage on SQL Server Scripts</title><link>https://www.sqlserver70.com/tags/storage/</link><description>Recent content in Storage on SQL Server Scripts</description><generator>Hugo -- gohugo.io</generator><language>en</language><copyright>SQLServer70.com</copyright><lastBuildDate>Thu, 02 Apr 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://www.sqlserver70.com/tags/storage/index.xml" rel="self" type="application/rss+xml"/><item><title>SQL Server Database Size Report for All Databases</title><link>https://www.sqlserver70.com/post/sql-server-database-size-report-all-databases/</link><pubDate>Thu, 02 Apr 2026 00:00:00 +0000</pubDate><guid>https://www.sqlserver70.com/post/sql-server-database-size-report-all-databases/</guid><description>
&lt;h2 id="report-database-size-in-mb-and-gb-for-all-sql-server-databases"&gt;Report Database Size in MB and GB for All SQL Server Databases&lt;/h2&gt;
&lt;p&gt;This script queries &lt;code&gt;sys.master_files&lt;/code&gt; and &lt;code&gt;sys.databases&lt;/code&gt; to report the total allocated size in megabytes and gigabytes for every user database on the SQL Server instance, sorted by largest database first.&lt;/p&gt;
&lt;script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1012089347386563"
crossorigin="anonymous"&gt;&lt;/script&gt;
&lt;ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-1012089347386563"
data-ad-slot="8593449130"&gt;&lt;/ins&gt;
&lt;script&gt;
(adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;
&lt;h2 id="purpose-and-overview"&gt;Purpose and Overview&lt;/h2&gt;
&lt;p&gt;Knowing how large each database is — and tracking how that size changes over time — is a core part of SQL Server capacity planning. Running out of disk space is one of the most disruptive events a DBA can face: it halts log backups, prevents transactions from committing, and can take databases offline. This script, adapted from the DBA-Scripts collection by Bulent Gucuk, reads allocated file sizes from &lt;code&gt;sys.master_files&lt;/code&gt; and joins to &lt;code&gt;sys.databases&lt;/code&gt; to produce a single server-wide size report. It runs from the master database, requires no cross-database queries, and takes milliseconds to execute — making it safe to run at any time, including during a production incident.&lt;/p&gt;</description></item></channel></rss>