zoukankan      html  css  js  c++  java
  • Sybase启用增量备份时如何预防数据库日志饱满

    按照增量备份的逻辑,
    1,数据库设置了自动清除日志,则不能做增量备份。
    2,(关闭自动清除日志)手工清除日志后,需要一个新的全库备份后,才能开始新的增量备份。

    数据库日志快满时,系统会触发一次last chance threshold,这个时候,会自动执行sp_thresholdaction存储过程。
    sp_thresholdaction系统没有定义,用户可以根据自己的需求来书写sp_thresholdaction。

    对应我们的应用,可以这样:
    use HH_LC
    go
    create procedure sp_thresholdaction
    @dbname varchar(30),
    @segmentname varchar(30),
    @space_left int,
    @status int
    as
    dump transaction @dbname with truncate_only
    go

    还可以自己定义 user defined threshold,当日志剩余空间达到用户指定的值时,触发用户指定的存储过程。
    定义user defined threshold后,相当于双保险,因为有些数据库可能由于某些原因(比如数据库建库混乱),系统的last chance threshold失效。

    --user defined threshhold and action:
    use HH_LC
    go

    sp_addthreshold "HH_LC", "logsegment", 50000, user_threshold_proc --日志空间剩余50000页时执行user_threshold_proc
    go

    create procedure user_threshold_proc
    @dbname varchar(30),
    @segmentname varchar(30),
    @space_left int,
    @status int
    as
    dump transaction @dbname with truncate_only
    go

  • 相关阅读:
    网络编程
    初识正则表达式
    面向对象---内置函数,反射,内置方法
    面向对象----属性,类方法,静态方法
    面向对象--抽象类,多态,封装
    面向对象--继承
    初识面向对象
    类名称空间,查询顺序,组合
    经典例题
    ⽣成器和⽣成器表达式
  • 原文地址:https://www.cnblogs.com/dll102/p/15788471.html
Copyright © 2011-2022 走看看