4215 The log was not truncated because records at the beginning of the log

备份时报错 

The log was not truncated because records at the beginning of the log are pending replication. Ensure the Log Reader Agent is running or use sp_repldone to mark transactions as distributed.
查找了下问题
用了以下脚本解决


--run 
sp_replicationdboption 'datayesdb','publish','true'


--then run sp_repldone with the following parameters


EXEC sp_repldone @xactid = NULL, @xact_segno = NULL, @numtrans = 0,    @time = 0, @reset = 1


--then unpublish the database


sp_replicationdboption 'datayesdb','publish','false'


 


--Run


dbcc traceon(3604)


dbcc opentran --- against the database to ensure there are no replicated transactions.
--the following scripts will show the detail sql script for the session
use master
declare @spid int;
declare @sql_handle binary(20);
set @spid = 601
SELECT @sql_handle = sql_handle
FROM sysprocesses As A with (nolock)
where spid = @spid
select text
from ::fn_get_sql(@sql_handle)


 USE [datayesdb]
GO
DBCC SHRINKFILE (N'datayesdb_log' , 0)
GO



参考
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/c96f3cb4-5f4e-49a4-a84a-6e2cd46915a3/the-log-was-not-truncated-because-records-at-the-beginning-of-the-log-are-pending-replication?forum=sqlreplication

please notice the following related issue 

Another connection is already running 'sp_replcmds' for Change Data Capture in the current database.
will be occure if you not run the sp_replflush after you cleanup the log file and you need to enable the cdc captupre

for detail info you can refer the following website
http://www.midnightdba.com/DBARant/another-connection-is-already-running-sp_replcmds-for-change-data-capture-in-the-current-database/

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16131092/viewspace-2137819/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/16131092/viewspace-2137819/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值