We have a very busy sql environment and currently have an issue that our sql db run out of disk space because the db is either reaches its max set size or if the db file is set to grow until the disk is full. I'm looking for a sql script to automate this as conditions below:
- Script to run every maybe 5 minutes
- Script to loop through each db and all dbs and check all databases on the server for both data file and log files
- If the data/log file reaches 90% of it set size, then check if the file is capped, if it's capped then auto expand the cap size if the disk has available space. Maybe save like 10% on disk
- If the file is not capped, then the disk the data/log file is on must reaches its full, then auto create new data/log file on the set drive (say F drive. this drive will be saved for this purpose)
Thank you very much!