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的复制事务。
  • 相关阅读:
    Python进程池
    Python进程间通信
    python编程中的if __name__ == 'main与windows中使用多进程
    Python进程-实现
    python进程join()函数理解
    python 进程池Pool
    python多进程打印字符,加锁(Lock加锁)
    python进程、多进程
    正则表达式统计字符串中数字的个数
    python 处理xml
  • 原文地址:https://www.cnblogs.com/starluck/p/9922262.html
Copyright © 2011-2022 走看看