{"id":1859,"date":"2019-11-01T23:13:44","date_gmt":"2019-11-01T23:13:44","guid":{"rendered":"http:\/\/www.theSQLReport.com\/?p=1859"},"modified":"2019-11-01T23:15:55","modified_gmt":"2019-11-01T23:15:55","slug":"errorlog-configuration-problem-when-upgrading-sql-server","status":"publish","type":"post","link":"http:\/\/www.theSQLReport.com\/?p=1859","title":{"rendered":"Errorlog Configuration Problem When Upgrading SQL Server"},"content":{"rendered":"<p class=\"yiv9234680408MsoNormal\"><b>Problem:<\/b><\/p>\n<p class=\"yiv9234680408MsoNormal\">This morning when working with one of my SQL Server servers, I went looking for an error log from last August.\u00a0 After finding that I was only able to go back six days, I checked the directory that stored SQL Server&#8217;s error logs,\u00a0 and noticed a gap in the logs from October to last March.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/ErrorlogsMissing.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1863 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/ErrorlogsMissing.jpg\" alt=\"Errorlog Directory\" width=\"1126\" height=\"501\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/ErrorlogsMissing.jpg 1126w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/ErrorlogsMissing-300x133.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/ErrorlogsMissing-768x342.jpg 768w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/ErrorlogsMissing-1024x456.jpg 1024w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/ErrorlogsMissing-210x93.jpg 210w\" sizes=\"(max-width: 1126px) 100vw, 1126px\" \/><\/a><\/p>\n<p>When I checked the configuration for the error logs in SQL Server Management Studio, I saw that the setting was configured at the default setting of 6 error logs for history.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/ErrorLogsDefaultSetting.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1862 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/ErrorLogsDefaultSetting.jpg\" alt=\"default setting of 6 error logs\" width=\"900\" height=\"593\" \/><\/a><\/p>\n<p class=\"yiv9234680408MsoNormal\">When I joined my company, I changed it&#8217;s standard for SQL Server to keep 99 error logs for history, and have a scheduled job that rotates the error log once a day.<\/p>\n<pre class=\"yiv9234680408MsoNormal\">-- Set Error logs parameter to 99\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 USE [master]\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 GO\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE'\r\n\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ,N'Software\\Microsoft\\MSSQLServer\\MSSQLServer'\r\n\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ,N'NumErrorLogs'\r\n\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ,REG_DWORD\r\n\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ,99\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 GO<\/pre>\n<p>However, when I looked at the registry entry for that SQL Server server, I saw that the registry key \u201cNumErrorLogs\u201d was missing.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/RegistrySQLServer2016.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1860 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/RegistrySQLServer2016.jpg\" alt=\"registry key \u201cNumErrorLogs\u201d was missing\" width=\"1077\" height=\"415\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/RegistrySQLServer2016.jpg 1077w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/RegistrySQLServer2016-300x116.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/RegistrySQLServer2016-768x296.jpg 768w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/RegistrySQLServer2016-1024x395.jpg 1024w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/RegistrySQLServer2016-210x81.jpg 210w\" sizes=\"(max-width: 1077px) 100vw, 1077px\" \/><\/a><b>Root Cause:<\/b><\/p>\n<p class=\"yiv9234680408MsoNormal\">The registry key \u201cNumErrorLogs\u201d \u00a0is configured in the registry folder for the version SQL Server is running.\u00a0 When I upgrade this SQL Server from version 2014 to 2016 last March, the registry folder MSSQL12.MSSQLSERVER was replaced with the new registry folder MSSQL13.MSSQLSERVER, and the registry key NumErrorLogs was not moved.<\/p>\n<p><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/RegistrySQLServer2014.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1864 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/RegistrySQLServer2014.jpg\" alt=\"registry key NumErrorLogs\" width=\"927\" height=\"351\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/RegistrySQLServer2014.jpg 927w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/RegistrySQLServer2014-300x114.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/RegistrySQLServer2014-768x291.jpg 768w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/RegistrySQLServer2014-210x80.jpg 210w\" sizes=\"(max-width: 927px) 100vw, 927px\" \/><\/a><\/p>\n<p class=\"yiv9234680408MsoNormal\"><b>Resolution:<\/b><\/p>\n<p class=\"yiv9234680408MsoNormal\">Just re-run the following script after the upgrade.\u00a0 This step now has been added to my company&#8217;s procedures for upgrading SQL Server.<\/p>\n<pre class=\"yiv9234680408MsoNormal\">-- Set Error logs parameter to 99\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 USE [master]\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 GO\r\n\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE'\r\n\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ,N'Software\\Microsoft\\MSSQLServer\\MSSQLServer'\r\n\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ,N'NumErrorLogs'\r\n\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ,REG_DWORD\r\n\u00a0\u00a0\u00a0\u00a0 \u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ,99\r\n\u00a0\u00a0\u00a0\u00a0\u00a0 GO<\/pre>\n<p class=\"yiv9234680408MsoNormal\"><a href=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/ErrorlogsCorrectSetting.jpg\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-1861 size-full\" src=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/ErrorlogsCorrectSetting.jpg\" alt=\"Best Practices Standard for Error Logs\" width=\"818\" height=\"612\" srcset=\"http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/ErrorlogsCorrectSetting.jpg 818w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/ErrorlogsCorrectSetting-300x224.jpg 300w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/ErrorlogsCorrectSetting-768x575.jpg 768w, http:\/\/www.theSQLReport.com\/wp-content\/uploads\/2019\/11\/ErrorlogsCorrectSetting-210x157.jpg 210w\" sizes=\"(max-width: 818px) 100vw, 818px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Problem: This morning when working with one of my SQL Server servers, I went looking for an error log from last August.\u00a0 After finding that I was only able to &hellip; <a class=\"readmore\" href=\"http:\/\/www.theSQLReport.com\/?p=1859\">Continue Reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":1862,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[159,172,171,157],"class_list":["post-1859","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql-server","tag-errorlog","tag-numerrorlogs","tag-registry","tag-upgrade"],"_links":{"self":[{"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/1859"}],"collection":[{"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1859"}],"version-history":[{"count":7,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/1859\/revisions"}],"predecessor-version":[{"id":1871,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/posts\/1859\/revisions\/1871"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=\/wp\/v2\/media\/1862"}],"wp:attachment":[{"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1859"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.theSQLReport.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}