none
How to get rid of Error Logs completly in Sql Server 2012?

    Question

  • Dear Friends,

    One day i opened the Log file folder in C:\program files\SQLServer 2012\SQL\Log, I was surprised to see the size was more than 1 GB, Although I have put a job in the agent sp_cycle_errorlog.

    But now i want to completely delete the logs so that my folder size could get reduce. Can any one help me how will I do this??

    One my one test database. I open the folder and selected all and deleted. Is this method would work in Production environment? Or it will cause/generate errors for me??

    Saturday, June 15, 2013 12:30 PM

Answers

All replies

  • Recycling is the best practice http://www.brainlitter.com/2009/05/05/massive-sql-errorlogregain-control/  Also find the cause of the most commonly logged error and attempt to fix that first.   That one fix may help to reduce the size.   For example, a third party tool may be trying to access a registry file and the service account for SQL may not have admin rights on the server.   If that is the case, you could find the registry entry and grant access to that hive using registry permission modification (say a Red Gate hive) that would allow the account that runs the sql server to access that part of the registry.

    R, J

    Saturday, June 15, 2013 2:46 PM
  • Dear Friends,

    One day i opened the Log file folder in C:\program files\SQLServer 2012\SQL\Log, I was surprised to see the size was more than 1 GB, Although I have put a job in the agent sp_cycle_errorlog.

    But now i want to completely delete the logs so that my folder size could get reduce. Can any one help me how will I do this??

    One my one test database. I open the folder and selected all and deleted. Is this method would work in Production environment? Or it will cause/generate errors for me??

    I agree Crackdkorn - it's important to find the root cause why error log has grown to 1GB. I would follow recommendation to find out why log file is 1GB to determine the root cause so it does not happen in the future.

    When trying to delete the most current error log you should receive an error message that it is inuse/access denied as SQL Server is using the most current "error log"

    If you are running low on disk space you can use command:

    EXEC master.sys.sp_cycle_errorlog;

    This will recycle the most current error log (from errorlog  to errorlog.1 ) which will allow you to delete the log.

    If you drive is filling up, you can zip up your old log files to another machine for analysis and delete from Server to reclaim your disk space.

    -----------------------------------------------------------------------

    Norm

    If it was helpful please vote as helpful or mark as answer if this answers your question.


    • Edited by Norm Chan Sunday, June 16, 2013 9:38 AM
    Sunday, June 16, 2013 9:37 AM
  • Have you enabled the option "log both success and failure audits" ? If yes then turn of successful logging, in most cases this is the one which fills errorlog file. You can go to server property and then security tab, there you can find Login auditing.. You need to restart to make the changes effective


    Mark as ANSWER if I helped you today :-) www.sql-articles.com

    Monday, June 17, 2013 10:33 AM
  • Guyssssssssssssssss.

    There are no errors in my SQL Server. What the system doing is, that it is saving every piece of information.

    For example I have put many jobs in the Agent, every successful agent information is getting saved in the log file. I open the log file in notepad. There was nothing special except this tiny information, "The agent saved the backup of you data,  on the following path",

    So I want to know that such type of information is not important for me and I want to delete such logs from the Log folder in the SQL Server.

    My question is stilled not answered. I want to know if i delete manually the log files in the Log folder will it effect my database??

    Tuesday, June 18, 2013 11:50 AM
  • The log is important.  You cannot stop logging entirely.  But it should be minimal.

    To stop the backup successful messages, please see:

    http://www.mssqltips.com/sqlservertip/1457/stop-logging-all-successful-backups-in-your-sql-server-error-logs/

    Tuesday, June 18, 2013 10:13 PM