How to clear error logs using a query in SQL Server without restarting the server instance?
Reference : How to Recycle SQL Server Error Log file without restarting SQL Server Service
Use [master];
GO
SP_CYCLE_ERRORLOG
GO
clear error logs using a query in SQL Server without restarting the server instance:
SP_CYCLE_ERRORLOG
After run the command, please check: "C:\Program Files\Microsoft SQL Server\MSSQL12.MSSQLSERVER\MSSQL\Log" and delete old file (like: ERRORLOG.1, ERRORLOG.2 ...). I open SQL port 1433, so my ERRORLOG about 20Gb. Some one scan my Sql password. Don't open port 1433 to internet.
You can run: sp_cycle_errorlog
That will start a new log file.
If you want to really delete log entries, you'd have to run that command seven times. By default there are seven logs cycled through. But often DBAs change that to maximum possible of 99.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With