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

  • 相关阅读:
    Oracle数据库基础
    2016-08-08二期模拟考试
    易买网-登入
    常量接口模式
    反射
    Hhibernate延迟加载
    URL和URI的区别和联系
    Socket编程
    ArrayList如何实现线程安全
    移位运算符
  • 原文地址:https://www.cnblogs.com/dll102/p/15788471.html
Copyright © 2011-2022 走看看