SQL Server Log View

Source: Internet
Author: User

Sqlserve errorlog files Sometimes encounter large files, may be executed by command xp_readerrorlog or Sp_readerrorlog, you can add search text or start and end time

--Log View--exec xp_readerrorlog @FileNum, @Type, @SearchText1, @SearchText2, @StartTime, @EndTime, @order--@FileNum: Log number--@Type: Query type (1:sql Server log; 2: Agent error log)--@SearchText1: Search for text--@SearchText2: Search text (with @SearchText1 for "and" relationships)--@StartTime: Log query start time--@StartTime: Log query end time--@order: Time sort (ASC or DESC)EXECXp_readerrorlog0,1N'cannot open'N'dbname','2017-11-20','2017-11-30','DESC'execSp_readerrorlog0,1,'cannot open','dbname'

Sp_readerrorlog altogether four parameters (i.e. the first four parameters of Xp_readerrorlog)

The use of sp_helptext can be seen, Sp_readerrorlog is actually called Xp_readerrorlog

Querying SQL Agent Current log information

Exec 0,2

Another: The stored procedure sp_cycle_errorlog can generate new log files and loop the error log extension number as if the service were restarted.

    EXEC Sp_cycle_errorlog     GO

SQL Server Log View

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.