开发者

Would like to know SQL Azure available space from ASP.Net web application

I am doing smoke test of my web application and in that I am required to check free database space out of total space to disp开发者_如何学编程lay alert on smoke test page. I am connected to Sql Azure database. How can i do this, anyone can suggest me here to implement this smoke test??


Ryan Dunns's Blog has a entry on Calculating The Size Of Your SQL Azure Database namely:

select
  sum(reserved_page_count) * 8.0 / 1024
from
  sys.dm_db_partition_stats
GO

select
  sys.objects.name, sum(reserved_page_count) * 8.0 / 1024
from
  sys.dm_db_partition_stats, sys.objects
where
  sys.dm_db_partition_stats.object_id = sys.objects.object_id
group by sys.objects.name

run the query and display it on your smoke test page - or run the query on a schedule and send out an alert as you approach your db max size.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜