Custom Search
www.rocket99.com : Technical Guides Sybase Oracle UNIX Javascript


Technical Guides
Sybase
Oracle
UNIX
Javascript




Of Interest

Business Intelligence and Analytics



Oracle Training





Sybase » Administration » Monitoring » Utilities

Transaction Log Checking: Wait Until It Clears

     



This procedure will check the state of the transaction log,
and will pause until is is cleared or until @pct_limit mb are free.
This is helpful for batch systems which hammer a lot if data into the
database at a quick pace.






create proc sp_sybase_logcheck (@mode varchar(50) = null, @pct_limit money = 80 ) as



declare
@pct money,
@mb1 money,
@log_size money

set nocount on

select @mb1 = ( data_pgs (8, doampg) ) * 8 / 1000
from sysindexes where id = 8

select @log_size = sum(size)
from master.dbo.sysusages u
where u.dbid = db_id() and u.segmap = 4

select @pct = @mb1 / @log_size * 100



while @pct > @pct_limit
begin

if @mode like '%verbose%'
select 'Trans log % full is .... ', @pct

waitfor delay "00:00:10"


select @mb1 = ( data_pgs (8, doampg) ) * 8 / 1000
from sysindexes where id = 8

select @log_size = sum(size)
from master.dbo.sysusages u
where u.dbid = db_id() and u.segmap = 4

select @pct = @mb1 / @log_size * 100
end



return
go









Sybase : Related Topics

Sybase : Administration : Display Locks on Tables

Sybase Web Site
Sybase Mobile Web Site
Oracle Web Site



Get the latest Rocket99 news and tech tips via






Site Index About this Guide to Sybase, Oracle, and UNIX Contact Us Advertise on this site




Copyright © 2012 Stoltenbar Inc All Rights Reserved.