SQL Query to calculate database size
Below is the query to check the disk space.
SELECT sys.databases.name as DBName,
CONVERT(VARCHAR,SUM(size)*8/1024)+' MB' AS [Disk Size]
FROM sys.databases
JOIN sys.master_files
ON sys.databases.database_id=sys.master_files.database_id
GROUP BY sys.databases.name
ORDER BY sys.databases.name
How to check log size and clear log
DBCC SQLPERF(logspace)
DBCC LOGINFO
Below is the query to shrink the log. The first parameter is the log name. you can get the name by pressing the right click on the database and click Properties and then select Files Tab. The second parameter is database size in MB