Consider that your SQL is holding many files and the log files eating up the space. Here i found 1 solution to handle the same.
For that we need to make sure that the mdf files are not related to any databased used.
for that we can use the following query
SELECT DB_NAME(database_id), * FROM sys.master_files
From the above query result you can find out the unused DB files. So delete the respective 'mdf' and 'ldf' files to get the space used by the same, Please recheck the same by using the following query to make sure that the file is not linked to any dtatabse.
SELECT DB_NAME(database_id), * FROM sys.master_files where physical_name like ('%yourfile.mdf%')
After the same, we can shrink the log files to delete the space used by the log
USE DbName
GO
DBCC SHRINKFILE (DbName_log)
For that we need to make sure that the mdf files are not related to any databased used.
for that we can use the following query
From the above query result you can find out the unused DB files. So delete the respective 'mdf' and 'ldf' files to get the space used by the same, Please recheck the same by using the following query to make sure that the file is not linked to any dtatabse.
SELECT DB_NAME(database_id), * FROM sys.master_files where physical_name like ('%yourfile.mdf%')
After the same, we can shrink the log files to delete the space used by the log
USE DbName
GO
DBCC SHRINKFILE (DbName_log)
This will shrink the log Files.
Thanks for reading my blog, Keep Rocking, Keep Coding,,,
0 comments:
Post a Comment