If we run below script it gives us details about memory used by each of the databases . The script returns results in MB. Please remember that it retrieves the data from operating system’s buffer and it keeps on changing. However, this gives information at least relevant to the moment when we are running query.
SELECT DB_NAME(database_id) DatabaseName,
COUNT (1) * 8 / 1024 AS SizeinMB
GROUP BY database_id
ORDER BY COUNT (*) * 8 / 1024 DESC
We hope you find the tip as helpful, I hope you liked the article. Please share your valuable suggestions and feedback in the comments.