Error Log .2
to delete it to free space on my hard drive. Can the SQL Server ErrorLog file be safely deleted without harming SQL Server?By default SQL Server stores seven ErrorLog files named: ErrorLog ErrorLog.1 ErrorLog.2 ErrorLog.3 ErrorLog.4 ErrorLog.5 ErrorLog.6 In SQL Server 2005 and later versions, the ErrorLog files are stored in the c:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG folder. The ErrorLog file contains the newest information; the ErrorLog.6 file contains the oldest information. Every time SQL Server is restarted, the log files cycle as follows: All data in the ErrorLog.6 file is deleted and a new ErrorLog file is created. All data in the previous ErrorLog file is written to the ErrorLog.1 file. All data in the previous ErrorLog.1 file is written to the ErrorLog.2 file. etc. If one of the ErrorLog files has grown to a large size, the ErrorLog files can be manually cycled by running the sp_cycle_errorlog Stored Procedure. The data in the older ErrorLog files will be overwritten! Copy the older ErrorLog files to some external media if they must be saved. It is safe to delete the files, however, you should not ignore them, and solve the underlying issue. Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest 2 comments: Anonymous said... Thanks Fabrice - very helpful. March 13, 2014 at 5:11 PM eralper said... Thank you for the information, I did not know the stored procedure which updates the log files and deletes the oldest one. Good to know managing the log files by code. September 29, 2015 at 5:12 PM Post a Comment Newer Post Older Post Home Subscribe to: Post Comments (Atom) About Me Fabrice Kauffmann Software Architect and Project Manager since 1993 in a wide variety of business applications (Web & Desktop Development, Content and Document Management, Mobile Devices, Business Intelligence, Database, OCR/ICR/OMR, Image Processing...) View my complete profile Visitors Categories .net core (1) 3d (1) 3g (1) asp.net (15) azure (1) bluetooth (2) c (2) c# (10) camera (2) cloud (2) css (2) database (9) directx (1) exchange (1) firefox (1) gnome (2) html (2) iis (11) javascript (2) jquery (1) linux (3) monitoring (1) node.js (1) nosql (1) opengl (2) python (1) razor (1) sbs (1) sécurité (1) security (1) streaming (1) twitter (1) ubuntu (3) vala (2) VB.NET (1) vs2010 (3) windows 7 (3) windows mobile (2) windows server
log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Database Administrators Questions Tags Users Badges Unanswered Ask Question _ Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top Does SQL Server ever http://fkauffmann.blogspot.com/2012/06/how-to-safely-delete-sql-server.html delete old error log files? up vote 11 down vote favorite I know I can cycle the current error log easily by running sp_cycle_errorlog, but I'm wondering if SQL Server will ever delete the old/archived error log files at all. Can't seem to find an answer to this anywhere... sql-server error-log share|improve this question asked Oct 29 '14 at 14:36 tuseau 5454916 Thanks all for the help. –tuseau Oct 29 '14 at 15:10 add a comment| 4 http://dba.stackexchange.com/questions/81388/does-sql-server-ever-delete-old-error-log-files Answers 4 active oldest votes up vote 16 down vote accepted There is a setting if you right click on "SQL Server Logs" and select "Configure". You can tell it how many log files you want to keep. Once it reaches that number it will start removing the old ones. share|improve this answer answered Oct 29 '14 at 14:43 Kenneth Fisher 16.7k53170 add a comment| Did you find this question interesting? Try our newsletter Sign up for our newsletter and get our top new questions delivered to your inbox (see an example). Subscribed! Success! Please click the link in the confirmation email to activate your subscription. up vote 8 down vote Restart SQL Server 7 times. You will see you still have only 7 ERRORLOG* files (depending on version). This is the current log file and the 6 most recent log files. Note: You may need to change 7 to something else, in the event you changed the number of error logs SQL Server keeps. The max, I believe, is 99. But no matter what your current setting is, it will eventually recycle and purge old files. I tested this and, if you uncheck the box that says: ☐ Limit the number of error log files before they are recycled ...which implies (at least to me) keep all log files, it will still keep only the current error log file plus 6 backups. If you've changed the
up Recent PostsRecent Posts Popular TopicsPopular Topics Home Search Members Calendar Who's On Home » http://www.sqlservercentral.com/Forums/Topic551101-146-1.aspx SQL Server 2005 » Administering » How to best delete SQL Server http://www.databasejournal.com/features/mssql/article.php/3587611/Cycling-the-ERRORLOG-file-and-Deleting-Backup-History-Information.htm 2005 errorlog How to best delete SQL Server 2005 errorlog Rate Topic Display Mode Topic Options Author Message ozkaryozkary Posted Tuesday, August 12, 2008 9:13 AM Valued Member Group: General Forum Members Last Login: Monday, December 28, 2015 7:46 AM Points: 57, Visits: 141 There was an outage error log on a SQL server 2005 server which created many errors. This caused the errorlog to grow too much. We have cycled the log file (sp_cycle_errorlog), so we have a new file. The problem is that we want to recover the disk space used by the previous file (errorlog.1). Apart from just deleting the file, what is the best way to delete error log .2 this file to avoid causing any problems? We have already inspected the contents of the file.thanks. http://ozkary.blogspot.comhttp://og-bit.com Post #551101 Greg CharlesGreg Charles Posted Tuesday, August 12, 2008 9:36 AM SSCarpal Tunnel Group: General Forum Members Last Login: Today @ 5:22 PM Points: 4,066, Visits: 5,754 You won't hurt anything by deleting the old error log file and that's the only way to get rid of it. Greg Post #551134 andrewkane17andrewkane17 Posted Tuesday, August 12, 2008 2:21 PM SSC-Addicted Group: General Forum Members Last Login: Today @ 11:36 AM Points: 415, Visits: 3,165 You should just be able to issue sp_cycle_errorlog until you reach you max set of saved logs, after that you can delete.Andrew Post #551422 Greg CharlesGreg Charles Posted Tuesday, August 12, 2008 3:34 PM SSCarpal Tunnel Group: General Forum Members Last Login: Today @ 5:22 PM Points: 4,066, Visits: 5,754 Actually, if you repeatedly execute sp_cycle_errorlog as Andrew suggests, you wouldn't have to delete the file at all. It would automatically drop off when you went past the configured max number of error logs. Greg Post #551468 rey
RESOURCES Database Tools SQL Scripts & Samples Links » Database Forum » Slideshows » Sitemap Free Newsletters: DatabaseDaily News Via RSS Feed Database Journal |DBA Support |SQLCourse |SQLCourse2 Featured Database Articles MS SQL Posted Feb 28, 2006 Cycling the ERRORLOG file and Deleting Backup History Information By Gregory A. Larsen Every DBA needs a few tricks up his/her sleeves to help them better manage their SQL Server 2000 environment. In this article I will explore a couple of such tricks. I will first explore how to cycle the SQL Server error log, and why you might want to do this. Secondly I will discuss backup history information and why you would need to periodically remove some of the older history information. Cycling the ERRORLOG file Have you ever tried to bring up the error log file and had to wait quite a while before the log is displayed? Then once the error log file was displayed you had to wade through days, weeks, or perhaps months worth of log information prior to getting to the specific timeframe that interested you? Well if you have had this problem then you might want to consider cycling that error log more frequently. By cycling the error log, I mean closing the existing log and creating a new one, without shutting down SQL Server. The error log file can grow quite large if you leave SQL Server up and running for long periods of time, and/or you log lots of information. SQL Server creates a new error log file every time you startup SQL Server. SQL Server limits the number of old error log files that are kept, on disk, prior to being recycled (deleted). By default the number of old error log files that are kept on disk is 6. The current error log file is named ERRORLOG, while older log files have a number appended to their name, such as ERRORLOG.1, ERRORLOG.2, etc. ERRORLOG.1 is the most current old log, ERRORLOG.2 the next most current log, etc. When a new error log file is created and there are as ma