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

» Database Journal Home
» Database Articles
» Database Tutorials
MS SQL
Oracle
DB2
MS Access
MySQL
» RESOURCES
Database Tools
SQL Scripts & Samples
Links
» Database Forum
» Sitemap
Free Newsletters:
DatabaseDaily  
News Via RSS Feed


follow us on Twitter
Database Journal |DBA Support |SQLCourse |SQLCourse2
 

Featured Database Articles

MS SQL

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

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\Parameters\SQL
Arg1
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
Knight
'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


















Thanks for your registration, follow us on our social networks to keep up-to-date