Solved

Sybase sp_thresholdaction

Posted on 2013-11-21
3
941 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

'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 …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

785 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