Welcome to the dBforums forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact support.

If you prefer not to see double-underlined words and corresponding ads, place your cursor
here for ContentLink opt out.

Go Back  dBforums > Database Server Software > Sybase > need to calculate percent of log used (ASE 15)

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-07-08, 15:42
Steve2 Steve2 is offline
Registered User
 
Join Date: Jul 2008
Posts: 3
need to calculate percent of log used (ASE 15)

For ASE15, does anyone have a proc that calculates the percent used for a log?

Thanks.
Steve
Reply With Quote
  #2 (permalink)  
Old 07-09-08, 06:41
pdreyer pdreyer is offline
Registered User
 
Join Date: May 2005
Location: South Africa
Posts: 830
Code:
select rundate,dbname , pctdata=convert(decimal(5,2),100-DataFree/DataSize*100) , pctlog=convert(decimal(5,2),100-LogFree/LogSize*100) , LogsegOnDataseg from( select 'rundate'=convert(char(10),getdate(),111)+' '+convert(char(8),getdate(),8) ,'dbname'=db_name(t1.dbid) ,'DataSize'=convert(int,sum (case when t1.segmap!=4 then t1.size/t2.dbpgsmb else null end)) ,'DataFree'=convert(decimal(11,1),sum (case when t1.segmap!=4 then curunreservedpgs(t1.dbid,t1.lstart, t1.unreservedpgs)/t2.dbpgsmb else null end)) ,'LogSize'=convert(decimal(11,0),sum (case when t1.segmap&4=4 then t1.size/t2.dbpgsmb end)) ,'LogFree'=convert(decimal(11,1), ( lct_admin('logsegment_freepages' , t1.dbid) -lct_admin('reserved_for_rollbacks', t1.dbid) )/t2.dbpgsmb) ,'LogsegOnDataseg'=min (case when t1.segmap!=4 and t1.segmap&4=4 then '*' else '' end) from master..sysusages t1 ,(select 'dbpgsmb' = (1048576. / v.low) from master.dbo.spt_values v where v.number = 1 and v.type = 'E' )t2 group by t1.dbid )t3
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On