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
Solved

Sybase sp_thresholdaction

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
New and Previous Values in a Query 7 30
Sql server function help 15 36
SQL Error - Query 6 40
Update one table with results from another table in SQL 6 21
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

789 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