Database Journal
MS SQL Oracle DB2 Access MySQL PostgreSQL Sybase PHP SQL Etc SQL Scripts & Samples Tips Database Forum

» Database Journal Home
» Database Articles
» Database Tutorials
MS Access
SQL Scripts & Samples
» Database Forum
» Slideshows
Free Newsletters:

News Via RSS Feed

Database Journal |DBA Support |SQLCourse |SQLCourse2

Featured Database Articles


Posted Jun 5, 2000

Automation of Error Log Cycling

By Tanya Stolyar

SQL Server version: 7.0 +

As a DBA you may want to automate process of cycling an errorlog file.
This script includes the following:
* stored procedure 'usp_dba_cyclelog' .
* It purges an errorlog file if it's size larger then value
specified by @filesize parameter (Bytes)
* sends e-mail to notify a recipient and attaches the
information about existing errorlog files.
* you can specify the errorlog file location with @errorlog
parameter. If it is not specified the

is used.

* scheduled task to call usp_dba_cyclelog' stored procedure.

Before executing the cyclelog.sql script you need to replace
* string <recipient_name> with the semicolon-separated list of
the recipients of the mail.
* string <size_in_Bytes> with the proper value
* string <db_name> with the database name where the
'usp_dba_cyclelog' stored procedure will be created

Make sure that SQL Mail and SQL Server Agent are running.

I got the information on xp_getfiledetails & xp_enumerrorlogs from Brian
'Undocumented T-SQL Tricks With Logs'. Please refer to this article
regarding the security issue of using these stored procedures.

Download cyclelog.SQL

MS SQL Archives

Comment and Contribute


(Maximum characters: 1200). You have characters left.



Latest Forum Threads
MS SQL Forum
Topic By Replies Updated
SQL 2005: SSIS: Error using SQL Server credentials poverty 3 August 17th, 07:43 AM
Need help changing table contents nkawtg 1 August 17th, 03:02 AM
SQL Server Memory confifuration bhosalenarayan 2 August 14th, 05:33 AM
SQL Server Primary Key and a Unique Key katty.jonh 2 July 25th, 10:36 AM