Solved

Sybase sp_thresholdaction

Posted on 2013-11-21
3
880 Views
Last Modified: 2013-11-29
I have a following sp_thresholdaction in ASE 15. I have added another threshold in db UPMVat, but now I'm just curious when I should trigger the action? or ASE will do automatic sp_thresholdaction when the db UPMVat reach the threshold defined ?


1> sp_helptext sp_thresholdaction
2>
 # Lines of Text
 ---------------
               1

(1 row affected)
 text                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 create proc sp_thresholdaction (@dbname varchar(30), @segment_name varchar(30), @space_left int, @status int)
as
begin
      dump tran @dbname with truncate_only
      return 0
end
                                                                                                                                                                                                                                                                                                                                                   

(1 row affected)
(return status = 0)
1> use UPMVAT
2>
1> sp_helpthreshold
2>
 segment name                 free pages               last chance?                 threshold procedure                        
 ---------------------------- ------------------------ ---------------------------- ------------------------------------------
 logsegment                            500                          0               sp_thresholdaction                        
 logsegment                            192                          1               sp_thresholdaction                        

(2 rows affected)
(return status = 0)
1>
0
Comment
Question by:motioneye
  • 2
3 Comments
 
LVL 24

Assisted Solution

by:Joe Woodhouse
Joe Woodhouse earned 500 total points
ID: 39670924
It will automatically fire the procedure when the thresholds are crossed. There are some details to prevent it firing repeatedly if the number of free log pages wobbles back and forth over the threshold, but in principle it's automatic.

Note that firing the procedure does not mean the log will be truncated. Dumps of the same database serialise, so if for some reason a dump tran is already running, firing the proc will just cause another dump to queue up behind it.
0
 

Author Comment

by:motioneye
ID: 39674337
Hi,
As example below, I have two threshold for one of the db, does it means dump transaction will trigger twice when free pages fall at 500 and subsequently as low as below 192 ?


1> sp_helpthreshold
2>
 segment name                 free pages               last chance?                 threshold procedure                        
 ---------------------------- ------------------------ ---------------------------- ------------------------------------------
 logsegment                            500                          0               sp_thresholdaction                        
 logsegment                            192                          1               sp_thresholdaction
0
 
LVL 24

Accepted Solution

by:
Joe Woodhouse earned 500 total points
ID: 39676471
It will launch the procedure when every threshold is crossed, yes. Based on your procedure then yes, it will attempt to launch a dump tran with truncate_only.

This still won't guarantee you logs never fill since the dump tran might not be fast enough, or might fail, etc.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now