Recycling Error log is another important thing in case if you are storing login auditing with login success to Error log. With Recycling error log to avoid losing important data one should increase the number of Error logs stored.
For Example: If Error log is growing at a rapid level then it can be recycled every two days and its setting can be changed to keep 50 error log files or higher which would account around 100 days.
1. Set the number of log files to 50 from the default of 6 to do this:
• SQL 2005 – Right click on SQL Server logs folder in Managment studio and choose Configure from the pop up menu.
• Click the Check box Limit the number of errorlogs before they are recycled and we set it to 50 to allow us to keep potentially useful data if we have to do multiple re-starts.
2. To Create a SQL Job that executes
EXEC sp_cycle_errorlog
to run every two days.(Monday, Wednesday, Friday, Sunday)
3. Optional:-
--to create a folder with todays date as 20-02-2012
exec xp_cmdshell 'md E:Rest%date:/=-%'
--to copy all Error log files to the created folder
exec xp_cmdshell 'copy "C:Program FilesMicrosoft SQL ServerMSSQL10.MSSQLSERVERMSSQLLog"Errorlog*.* E:Rest%date:/=-%'
4. Optional:- To change the defualt location for Error Log in Startup parameters. This will need a restart of the SQL Services after change.
Note: Be extra careful to check the folder struction exists on New location for error logs.
Monthly to archive all error logs to some other location which is named after the date of archiving.
Learn about SQL Server detecting logical consistency based issues and how to resolve them.
Learn about SQL Server error 1222 and how to resolve the lock request time out…
Discover the new features of Microsoft SQL Server 2022 and how they compare to previous…
SQL Server Error 1222 lock request time out period exceeded Lock request time out…
SQL Server Error : 427, Severity: 20. Could not load the definition for constraint ID…
SQL Server Error : 204, Severity: 20. Normalization error in node %ls.
This website uses cookies.