Monday, January 28, 2013

Find Database size in SQL-Server

Find Database size in SQL-Server


Note: user must be DBOwner to execute this Procedure.

 

sp_helpdb  will give all databases in the sql-server instance
and their sizes ,

Name of the Database: pubs
DB size in MB/GB
database ID <=> dbid
Created Date.
Status online/offline
compability_level:  110 --> means SQL Server 2012.


 

name    db_size    owner    dbid    created    status    compatibility_level
AdventureWorks2012        205.75 MB    machine-target\Administrator    7    Oct 26 2012    NULL    110
EntLibQuickStarts          5.08 MB    sa    11    Nov  5 2012    NULL    110
LibMgmt          7.00 MB    sa    13    Nov 12 2012    Status=ONLINE, Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=SIMPLE, Version=706,  IsFullTextEnabled    110
master          6.63 MB    sa    1    Apr  8 2003    Status=ONLINE, Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=SIMPLE, Version=706,    110
model          5.31 MB    sa    3    Apr  8 2003    Status=ONLINE, Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=SIMPLE, Version=706,    110
msdb         21.25 MB    sa    4    Feb 10 2012    Status=ONLINE, Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=SIMPLE, Version=706,  IsFullTextEnabled    110
MyOrderDatabase          5.38 MB    machine-target\Administrator    18    Jan  3 2013    NULL    110
nopcommerce         10.38 MB    sa    6    Oct 26 2012    NULL    110
Northwind          6.06 MB    sa    9    Oct 27 2012    NULL    110
pubs          5.08 MB    sa    8    Oct 27 2012    NULL    110
 

If u have least privileges

 

Syntax:

Exec sp_helpdb pubs 


name    db_size    owner    dbid    created    status    compatibility_level
pubs          5.08 MB    sa    8    Oct 27 2012    Status=ONLINE...,  110

Name of the Database: pubs
DB size in MB/GB
database ID <=> dbid
Created Date.
Status online/offline
compability_level:  110 --> means SQL Server 2012.

Tags: Find Database size in Sql-Server, Finding database sizes in Sql-Server, Find Database Size,Find Data base size in Sql-Server, Find Database ID in SQL,Find Database Status in sql,  Find Database Created Date,Find owner of the Database,Find DBID in SQL-Server,

No comments:

Post a Comment