Archive

Archive for May, 2013

BI SQL # 115 : SQL Server DBA Scripts : Simply find DB Size in MB and GB

Hi Folks,

In this article we are going to cover How to Simply find DB Size in MB and GB.

In this post we are going to discuss following points:

  • Problem Statement of SQL Script:
  • Description of SQL Script:
  • SQL Script Output Column
  • SQL Script Code
  • SQL Script Output Screenshot
  • User Level to execute

 

Problem Statement of SQL Script:

How to find all Database Size in GB and MB format?

Description of SQL Script:

This script will display Database Size in MB and GB

SQL Script Output Column

image

SQL Script Code

SELECT d.NAME
    ,ROUND(SUM(mf.size) * 8 / 1024, 0) Size_MBs
    ,(SUM(mf.size) * 8 / 1024) / 1024 AS Size_GBs
FROM sys.master_files mf
INNER JOIN sys.databases d ON d.database_id = mf.database_id
WHERE d.database_id > 4 -- Skip system databases
GROUP BY d.NAME
ORDER BY d.NAME

SQL Script Output Screenshot

image

User Level to execute

    100

        Hope you will like How to Simply find DB Size in MB and GB.

        If you really like reading my blog and understood at least few thing then please don’t forget to subscribe my blog.

      If you want daily link and analysis or interesting link go to following website which will give @ your inbox please subscribe our following link resource blog :

      Link Resource Website

      For More information related to BI World visit my Mentalist Blog

      SQL Server Mentalist >> SQL Learning Blog

      Business Intelligence Mentalist >> BI World

      Infographic Mentalist >> Image worth explaining thousand Words

      Microsoft Mentalist >> MVC,ASP.NET, WCF & LinQ

      DBA Mentalist >>Advance SQL Server Blog

      Microsoft BI Mentalist >> MS BI Development Update

      Connect With me on

      | FaceBook |Twitter | linkedIn| Google+ | WordPress | RSS |

      %d bloggers like this: