October 18, 2005 at 10:47 pm
It would be wonderful if when your SQL Error Log was 314.15926 MB long, you had the option of just reading the "Last [N] Lines", and not have to wait an eternity for the file to load and your machine to run out of memory...
- john
October 18, 2005 at 11:52 pm
Use any Windows implementation of tail, for instance by installing Cygwin.
October 20, 2005 at 5:32 am
And do every night something like:
exec dbspCheckErrorLog 500000
___________________________________________
CREATE procedure dbspCheckErrorLog
@limit float = 1000000
as
declare @size float
create table #logs
( Lognum int
, Logdate varchar(22)
, Size float
)
insert into #logs exec master..xp_enumerrorlogs
select @size = size from #logs where LogNum = 0
if @size > @limit begin
print'Errorlog size is ' + ltrim(str(@size)) + ' Bytes, limit is ' + ltrim(str(@limit)) + ' Bytes. Log will be cycled...'
exec sp_cycle_errorlog
end
else
print 'Errorlog size is ' + ltrim(str(@size)) + ' Bytes, limit is ' + Ltrim(str(@limit)) + ' Bytes. Log not cycled.'
drop table #logs
return
___________________________________________
regards
karl
Best regards
karl
October 20, 2005 at 7:53 am
You could just run EXEC master..xp_readerrorlog instead of loading it into EM to read. You could also schedule a weekly job using dbcc errorlog to help maintain the size. You can even increase the number of log files you want to keep....
Linda
October 20, 2005 at 11:41 am
Here's what I do....
EXEC SP_CYCLE_ERRORLOG
GO
Then I go to the folder where the error logs are stored and open the one I need in notepad.
-SQLBill
October 26, 2005 at 3:37 pm
OK, thanks for the suggestions all.
- john
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply