Error log in SQL Server Original

Error log:
Sql Server Error Log files contain informational messages, warnings, critical server events, auditing information etc. And this information in the log file is very critical for analyzing any Sql Server issues.

Location:


Default error log are 6.

Increasing the number of Sql Server Error Logs files

By default as explained above Sql Server will have one Current Sql Server Log file and 6 Archived error log files. If we are recycling the error logs daily, then at any given point in time we will have the history of the error logs of the last 6 days excluding the current day.
Sql Server provides a mechanism where we can increase the number of archived error log files from the default 6 to any number between 6 to 99.
Step 2: In the Sql Server Error Logs configuration window as shown in the below image change the Maximum number of error log files from the default 6 to the desired number of error log files that you want to maintain.

Recycling or Re-Initializing the Error Log file.

In Sql Server by default the Error Log files are recycled only when the Sql Server Service is restarted. Otherwise, it will keep appending the errors, warnings, information etc to the same current error log file i.e. ERRORLOG. If Sql Server service restart is a rare event then the current log file will be of very huge size.
Sql Server provides a mechanism where we don’t need to restart the service to recycle the error logs, instead we can execute the system stored procedure SP_CYCLE_ERRORLOG to reinitialize the error logs.
EXECUTE SP_CYCLE_ERRORLOG 

3. Limiting the Size of the Sql Server Error Logs file

To set the maximum size of each error log file as 10 MB. Setting this value to 10 MB makes sure that the error logs are recycled each time the current log file reaches the 10 MB size.
EXEC SYS.XP_INSTANCE_REGWRITE
    N'HKEY_LOCAL_MACHINE',
    N'Software\Microsoft\MSSQLServer\MSSQLServer',
    N'ErrorLogSizeInKb',
    REG_DWORD,
    10240

4. Changing the Sql Server Error Logs folder location

By default Sql Server ErrorLog files are located in the same drive/path which is used/selected during Sql Server Installation.
To avoid filling up of that particular drive. To change the Sql Server ErrorLog files location you may need to chane in configuration manager of sql server.
xp_readerrorlog()

• The first parameter specifies which log to return and the default is “0”.
 For the second parameter, you specify which log to review.  The default is 1 for the SQL Server database engine, but you can specify a 2 for the SQL Server agent.

The 3rd and 4th parameters allow you to specify 2 search strings to search the log with.

The 5th and 6th allow you to specify start and end date 
The 7th is for order by like ascending or descending

So to find the deadlock history from previous error log using xp_readerrorlog, execute the following:

EXEC master.dbo.xp_readerrorlog 3, 1, N'', N'deadlock', '20190222', '20190323', N'desc' 
sp_readerrorlog():

sp_readerrorlog 3, 1, N'', N'deadlock'

Name

Azure Backup Database Clustering Crash Dumps DBCC Deadlock Link Server Log Shipping Maintenance Migration Mirroring Monitoring Performance Tuning Permissions Post Installations Prerequisites Replication Restore Database SQL Installations SQL on Linux SQL Uninstallations SSIS T-SQL Windows Server
false
ltr
item
hybriddba.blogspot.com: Error log in SQL Server Original
Error log in SQL Server Original
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgajYKJhMxM0gcdRoYLTlvJs1dJhPLMrTS9__AaspGVQXIf5VEmuzdl9t0A7nIrkwf-yuIFU3moxuy6Nn4NCLYhldcsK1X_Vn9iq3OwWLohS2VRGdqnARaObYN8nIJCwwU8Qklhb1EGQPtC/s1600/1579192774313033-0.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgajYKJhMxM0gcdRoYLTlvJs1dJhPLMrTS9__AaspGVQXIf5VEmuzdl9t0A7nIrkwf-yuIFU3moxuy6Nn4NCLYhldcsK1X_Vn9iq3OwWLohS2VRGdqnARaObYN8nIJCwwU8Qklhb1EGQPtC/s72-c/1579192774313033-0.png
hybriddba.blogspot.com
https://hybriddba.blogspot.com/2018/08/error-log-in-sql-server-original.html
https://hybriddba.blogspot.com/
https://hybriddba.blogspot.com/
https://hybriddba.blogspot.com/2018/08/error-log-in-sql-server-original.html
true
7679493960263860249
UTF-8
Not found any posts Not found any related posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU Tag ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Contents See also related Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy