Wednesday, December 4, 2013

SharePoint 2013 - Get list size (part 2)

In one of my previous posts, I wrote a small SQL query which returns the size of SharePoint lists directly from SharePoint's database. That query works with SharePoint 2007 and 2010, but not with 2013 version because the database structure is slightly changed in 2013 version.

Instead of building another SQL query  that works with 2013 version, I've decided to use SharePoint's inbuilt procedure that returns the size of all lists of one Site Collection. This same procedure can be used on the older versions of SharePoint also.

The name of the procedure is dbo.proc_GetListSizes. It can be found in SQL Server Management Studio by expanding your database name (WSS_Content) and then by expanding "Programability" and then "Stored Procedures" like shown in image below. 



SQL Server Management Studio - position of proceudre in tree list


This is command for execution of procedure in SQL Server Management Studio. Parameter @SiteId is ID of your Site Collection.


Execution of proc_GelListSizes procedure


And this is the result. Along with the size of all List on that Site Collection, there are some additional informations:

Results of proc_GetListSize procedure execution




If you want to see the entire size of your database and size of table space, you can use command sp_spaceused like this:


Results of sp_spaceused procedure execution


No comments:

Post a Comment