Link to home
Start Free TrialLog in
Avatar of send2mark
send2markFlag for United States of America

asked on

SQL Query for SharePoint

I'm looking for a query that will show my Site Collections with size. I tried select * from Sites and that will give me the size without the URL.  select * from webs where ParentWebID is NULL will show me the sub sites which would be fine too, but it doesn't show the size.
Avatar of Jamie McAllister
Jamie McAllister
Flag of Switzerland image

It is not supported to directly query the Databases. Even a read query can introduce a lock that effects operation of the product.

Consider using this space monitoring tool instead:

http://www.thesug.org/blogs/lsuslinky/SSM/Pages/default.aspx
it may probably be easier if you would run from command prompt on the SP sherver:
stsadm -o enumsites -url http://YOUR_ROOT_SITE_URL
This command will display a list of all the site collections in your environment, including the sizes.
Avatar of send2mark

ASKER

irinuc, its a good idea, but I need to know which database they're in. That is why I am doing it in SQL. We have 14 Content databases and I am moving site collections because some of them are getting too big.
What version of Share Point do you have? I think in MOSS, this command lists also the database where the site collection is located.
Let me double check that, to make sure; maybe you need to add another parameter to the command...
ASKER CERTIFIED SOLUTION
Avatar of irinuc
irinuc
Flag of Romania image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial