Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 
 

Display SQL Server log errors

SQL Server Tips by Donald Burleson


This is one of the many SQL Server Windows scripts to display errors from the logs, from the book "High Performance SQL Server DBA".

 See code depot for full script

Sometimes error counts and analysis of log errors is not enough.  Perhaps an informational event that affected performance repetitively occurred in the logs for a particular day that was missed.  A good way of finding these cyclical, repetitive log events is by doing a daily volume analysis over the log to see if any day exploded with messages compared to the others.  The following procedure, up_bn_log_daily_volume , will break down message volume by day so one can easily see all log errors:  

 
IF OBJECT_ID('up_bn_log_daily_volumes') IS NOT NULL
BEGIN
    DROP PROCEDURE up_bn_log_daily_volumes
    IF OBJECT_ID('up_bn_log_daily_volumes') IS NOT NULL
        PRINT '<<< FAILED DROPPING PROCEDURE up_bn_log_daily_volumes >>>'
    ELSE
        PRINT '<<< DROPPED PROCEDURE up_bn_log_daily_volumes >>>'
END
go
CREATE PROCEDURE up_bn_log_daily_volumes
(@LogNumber smallint = 0, -- 0 is the current error log
 @ErrorsOnly bit = 0)
AS
    DECLARE @DateLimit    datetime,
            @SQLStatement varchar(60)

    set nocount on
    set ARITHABORT off
    set ARITHIGNORE on
    set ANSI_WARNINGS off
   
    -- Error Log Information
    SELECT @SQLStatement = 'EXEC master..xp_readerrorlog'
    IF @LogNumber > 0
    BEGIN
     SELECT @SQLStatement = @SQLStatement + ' ' + LTRIM(STR(@LogNumber))
    END

    CREATE TABLE #errorlog (ErrorText varchar(255), ContinuationRow int)
   
    INSERT INTO
        #errorlog
    EXEC(@SQLStatement)

    -- Remove entries that begin with a tab or are less then 35 characters in length - not date format.
 
    DELETE
    FROM
        #errorlog
    WHERE
        SUBSTRING(ErrorText,1,1)=CHAR(9)
        OR LEN(ErrorText) < 35
        OR isdate(SUBSTRING(ErrorText,1,10)) = 0

    -- Do only errors if requested
    IF @ErrorsOnly = 1
    BEGIN
        DELETE
          FROM #errorlog
        WHERE NOT  (ErrorText LIKE '% error%' OR
                    ErrorText LIKE '%failed%' OR
                    ErrorText LIKE '%table corrupt%' OR
                    ErrorText LIKE '%level 16%' OR
                    ErrorText LIKE '%level 17%' OR
                    ErrorText LIKE '%level 21%' OR
                    ErrorText LIKE '%Severity: 16%' OR
                    ErrorText LIKE '%Severity: 17%' OR
                    ErrorText LIKE '%Severity: 21%') AND
                    ErrorText NOT LIKE '%DBCC CHECKALLOC%0 errors%' AND
                    ErrorText NOT LIKE '%DBCC CHECKTABLE
%0 errors%'
    END
-- display daily volume analysis
    select
        top 5 day = substring(ErrorText,1,10),
        message_count = sum(isdate(substring(ErrorText,1,10)))
    from
        #errorlog
    where

See code depot for full script


IF OBJECT_ID('up_bn_log_daily_volumes') IS NOT NULL
    PRINT '<<< CREATED PROCEDURE up_bn_log_daily_volumes >>>'
ELSE
    PRINT '<<< FAILED CREATING PROCEDURE up_bn_log_daily_volumes >>>'
go
GRANT EXECUTE ON up_bn_log_daily_volumes TO public
go

This is one of the many SQL Server scripts to display error log statistics from the book "High Performance SQL Server DBA".


 

 

��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  

and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2020

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.