One day when I checked the disk space on C:\ drive where I have installed SQL Server, then space is full and free space is not available. I have checked all the folders and files on C:\ drive, but the problem was different. The size of SQL Server error log file goes very high and this cause to disk was full. I have reviewed and the current error log files cause for the same. I have tried to remove it to make free space on disk, but I could not delete as it was used by SQL Server. Then I have applied one script to detach the current error logs and create a new file in the error logs.
Generally, when the new error files generated when SQL Service restart. The script looks as follows, here I have given a sample example as how to detach last active ERROR logs from SQL Server, so after that we can remove those previous error log files. We have a look for the file shots of SQL Server error log files and Agent error log files as well before the script run.
Generally, when the new error files generated when SQL Service restart. The script looks as follows, here I have given a sample example as how to detach last active ERROR logs from SQL Server, so after that we can remove those previous error log files. We have a look for the file shots of SQL Server error log files and Agent error log files as well before the script run.
-- Using MSDB database to run the command
USE MSDB
GO
-- Removing SQL Server error logs
EXEC SP_CYCLE_ERRORLOG
GO
-- Removing SQL Server Agent error logs
EXEC SP_CYCLE_AGENT_ERRORLOG
GO
Let us go, through the screen below which will show the new files created for the same. What do you think, have you applied any script or schedule to create new error log files and remove previous error log files?
No comments:
Post a Comment
Please Use Good Leanguage