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

  • 相关阅读:
    IOS-JSON数据解析
    IOS-APP发布资料收集
    IOS-webService
    ASP.NET MVC学习之路:模板页
    io流
    线程
    事件监听
    java基础面试题
    递归调用
    三目运算: x?y:z
  • 原文地址:https://www.cnblogs.com/dll102/p/15788471.html
Copyright © 2011-2022 走看看