创建一个阈值以监控数据库段上的空间。当段中的可用空间低于指定水平时,SAP ASE 服务器执行关联的存储过程。
sp_addthreshold <dbname>, <segname>, <free_space>, <proc_name>
是为其添加阈值的数据库。它必须是当前数据库的名称。
是监控其可用空间的段。指定“default”段时要使用引号。
是达到阈值时的可用页数。当段中的可用空间低于此水平时,SAP ASE 服务器执行关联的存储过程。
是当 <free_space> 之下时执行的存储过程。该过程可以位于当前 SAP ASE 服务器或某个 Open Server 上的任何数据库中。阈值不能在远程 SAP ASE 服务器上执行过程。
为 segment1 创建一个阈值。当 segment1 上的可用空间降到 200 页以下时,SAP ASE 服务器执行过程 pr_warning:
sp_addthreshold mydb, segment1, 200, pr_warning
为 user_data 段创建一个阈值。当 user_data 上的可用空间降到 100 页以下时,SAP ASE 服务器对 Open Server mail_me 过程执行远程过程调用:
sp_addthreshold userdb, user_data, 100, "o_server...mail_me"
在 pubs2 数据库的 indexes 段上创建一个阈值。您可以从任何数据库发出此命令:
pubs2..sp_addthreshold pubs2, indexes, 100, pr_warning
达到阈值时,SAP ASE 服务器执行关联的存储过程。SAP ASE 服务器对阈值过程使用以下搜索路径:
如果在两个数据库中都没有找到该过程,则 SAP ASE 服务器向错误日志发送一条错误消息。
SAP ASE 服务器使用一个停滞值(即全局变量 @@thresh_hysteresis)来确定阈值对可用空间变化的敏感程度。一旦阈值执行其过程,阈值将失效。在段中的可用空间量超过阈值的页数达到 @@thresh_hysteresis 之前,该阈值保持不活动状态。这样可防止因响应可用空间的微小波动而使阈值重复执行其过程。