SQL 复制 - 出版物已删除,但日志文件仍在增长

发布于 2024-07-16 18:30:36 字数 603 浏览 5 评论 0原文

前言,我以前见过回答这个问题的命令,但现在我找不到它了,所以我只是在寻找可以解决我的问题的单个 SQL 语句。

我我曾经在 SQL Server 2000 数据库上发表过两篇文章,但后来我将它们删除了。 但是,我的日志文件正在增长,并且似乎包含未复制的事务,并且不断增长。 我已经尝试过:

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

我收到一条消息“数据库未发布”(因为我已经删除了该发布,所以这是有道理的)。 如果我尝试:

backup log dbname with truncate_only

我收到一条消息,表明我的日志中有未复制的事务,并且它不会截断。

我以前见过这种情况,其中不存在发布,但数据库被标记为仍在参与复制,并且我找到了一个单行脚本来取消将数据库标记为复制源,这立即解决了我的问题。 不过,当我再次需要它时,我现在找不到它了 - 希望你们中的一个人可以提供一些线索。 谢谢!

To preface, I've seen the command to answer this question before, but now I can't find it again, so I'm just looking for the single SQL statement that will solve my problem.

I had two publications on a SQL Server 2000 database at one point, but I've since deleted them. However, my log file is growing, and appears to contain unreplicated transactions, and is growing without end. I've tried this:

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

I get a message that "The database is not published" (and since I've deleted the publication, that makes sense). If I try:

backup log dbname with truncate_only

I get the message that there are unreplicated transactions in my log, and it won't truncate.

I've seen this before, where no publications existed, but the database was marked as still participating in replication, and I found a single line script to un-flag the database as a source for replication, which immediately resolved my problem. I can't find it now, though, when I need it again - hopefully one of you can shed some light. Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

面如桃花 2024-07-23 18:30:36

我无法通过任何支持的方法清除这些尚未复制的数据,因此我不得不强制重建日志文件。 它是 SQL 2000,因此有一个不受支持/未记录的 SP 可以执行此操作:

DBCC REBUILD_LOG('DBName','D:\Log folder\Logfile name.ldf')

这将为数据库创建一个新的空日志文件并放弃旧的日志文件。 请注意,这将强制截断当前事务,因此请确保您有备份。 数据库需要处于“紧急恢复”模式才能使用此命令,因为它不会回滚任何已部分应用于数据的进程内事务,从而可能损害数据完整性。

有关我使用的流程的完整详细信息,请参阅此线程的第 7 篇文章: http: //www.sqlteam.com/forums/topic.asp?TOPIC_ID=76785

I was unable to purge this not-yet-replicated data through any supported method, so I had to forcefully rebuild the log file. It's SQL 2000, so there's an unsupported/undocumented SP to do this:

DBCC REBUILD_LOG('DBName','D:\Log folder\Logfile name.ldf')

This will create a new, empty logfile for the database and abandon the old one. Note that this will forcefully truncate the current transactions, so make sure you have a backup. The database needs to be in "Emergency Recovery" mode to use this command, as it will not roll back any in-process transactions that have been partially applied to the data, potentially damaging data integrity.

For full details about the process I used, see post 7 from this thread: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=76785

若言繁花未落 2024-07-23 18:30:36
use master
go
exec sp_replicationdboption @dbname='SERVICEDESK', @optname = 'publish', @value= 'true', @ignore_distributor = 1
go
use servicedesk
go
EXEC sp_repldone @xactid = NULL, @xact_segno = NULL, @numtrans = 0,  @time = 0, @reset = 1
go
use master
go
exec sp_replicationdboption @dbname='SERVICEDESK', @optname = 'publish', @value= 'false', @ignore_distributor = 1
go
dump tran servicedesk with no_log
go
use master
go
exec sp_replicationdboption @dbname='SERVICEDESK', @optname = 'publish', @value= 'true', @ignore_distributor = 1
go
use servicedesk
go
EXEC sp_repldone @xactid = NULL, @xact_segno = NULL, @numtrans = 0,  @time = 0, @reset = 1
go
use master
go
exec sp_replicationdboption @dbname='SERVICEDESK', @optname = 'publish', @value= 'false', @ignore_distributor = 1
go
dump tran servicedesk with no_log
go
狼性发作 2024-07-23 18:30:36

您在寻找:

EXEC sp_replicationdboption 
    @dbname = @publicationDB, 
    @optname = N'merge publish', 
    @value = N'false'

?

另请参阅 sp_dropmergepublication / sp_droppublication

Are you looking for:

EXEC sp_replicationdboption 
    @dbname = @publicationDB, 
    @optname = N'merge publish', 
    @value = N'false'

?

Also see sp_dropmergepublication / sp_droppublication.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文