zoukankan      html  css  js  c++  java
  • Sql2008R2 日志无法收缩解决方案

        在网上查了二天资料,终于找到个解决了这个问题的方案,记录下来.方便下次处理.
        解决方案转贴自:  https://blog.csdn.net/kk185800961/article/details/41865073

        

    use DBName
    go
    dbcc opentran
    --结果如下
    /*
    已复制的事务信息:
            最早的分布式 LSN     : (0:0:0)
            最早的非分布式 LSN : (5067131:1370:2)
    DBCC 执行完毕。如果 DBCC 输出了错误信息,请与系统管理员联系。
    */
     
    DBCC loginfo()  --全是2 木有 0 都是活动事务,断不了,更收缩不了。
     
    -- 一个没有spid的东西。怎么杀啊? 查事务,
    select transaction_begin_time,  
    case transaction_type   
    when 1 then 'Read/Write transaction'  
    when 2 then 'Read-Only transaction'  
    when 3 then 'System transaction'  
    when 4 then 'Distributed transaction'  
    end tran_Type,  
    case transaction_state  
    when 0 then 'not been comoletely initaialiaed yet'  
    when 1 then 'initaialiaed but ha notstarted'  
    when 2 then 'active'  
    when 3 then 'ended (read-only transaction)'  
    when 4 then 'commit initiated for distributed transaction'  
    when 5 then 'transaction prepared and waiting resolution'  
    when 6 then 'commited'  
    when 7 then 'being rolled back'  
    when 0 then 'been rolled back'  
    end transaction_state  
    from   
    sys.dm_tran_active_transactions
    --没有发现异常的事务。没有做过复制,没有做过镜像。
     
    --查看log状态
    SELECT log_reuse_wait_desc  FROM sys.databases WHERE NAME='DBName' 
    --REPLICATION  某做过复制,竟然出来个这。
     
    use DBName
    checkpoint
    go
    sp_removedbreplication 'DBName'
    DBCC SHRINKFILE(DBName_Log,100);
     
    DBCC loginfo()  --还是全是活动的。
    dbcc opentran 还有的那个没有spid的复制事务。
  • 相关阅读:
    spark-submit配置说明
    spark dataset join 使用方法java
    关于join算法的四篇文章
    IO负载高的来源定位
    MySQL执行SHOW STATUS查询服务器状态状态之Handler_read_* 详解
    5.6中使用字符串存放时间,导致隐式转换发生的记录
    Linux User's Manual IOSTAT
    【转】MegaSAS RAID卡 BBU Learn Cycle周期的影响
    mac下SSH很快被断开
    Java的正则表达式
  • 原文地址:https://www.cnblogs.com/starluck/p/9922262.html
Copyright © 2011-2022 走看看