--The historic data is logged in a table in every 4 hours and the following query in run in the table to find the current grown rate of the databse file
SELECT Database_Name,Space_Used_in_MB,File_Size_in_MB,(cast(Space_Used_in_MB as float)/cast(File_Size_in_MB as float)) * 100 as newval
FROM Monitor_db..SQLAdmin_Monitor_db_file_info
WHERE FILE_ID = 1
AND (cast(Space_Used_in_MB as float)/cast(File_Size_in_MB as float)) * 100 >= 95
AND Time_collected IN (SELECT MAX(time_collected) FROM hCFS_SQLMonitor..SQLAdmin_Monitor_db_file_info )
ORDER BY File_Size_in_MB
This blog is created to add all the information and experiences that I have learnt while working on MS sql server as a DBA. The blog is also updated frequently with the real world problem that I encounter hands on at work and the resolutions to resolve them. I hope this blog will be of some use to you and you will revisit. Thank you for stopping by and you are welcome to leave comments.
Tuesday, October 7, 2014
Script: To find the database file where the file space is used more than 94 % of the current file size
Labels:
Administration,
autogrowth,
database monitor,
datafile,
filesize,
script
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment