Solved

Sybase sp_thresholdaction

Posted on 2013-11-21
3
998 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

In database programming, custom sort order seems to be necessary quite often, at least in my experience and time here at EE. Within the realm of custom sorting is the sorting of numbers and text independently (i.e., treating the numbers as number…
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 …
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

733 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