Script to check the db space of all databases on azure db
Courtesy : https://www.sqlservercentral.com/articles/check-azure-sql-db-space-used
SELECT [database_name], start_time AS 'LastCollectionTime', storage_in_megabytes AS 'CurrentSize(MBs)', allocated_storage_in_megabytes AS 'AllocatedStorage(MBs)' FROM ( SELECT ROW_NUMBER() OVER(PARTITION BY [database_name] ORDER BY start_time DESC) AS rn, [database_name], start_time, storage_in_megabytes, allocated_storage_in_megabytes FROM sys.resource_stats ) rs WHERE rn = 1
No comments:
Post a Comment