Advertisement

05.01.2008 at 01:40PM PDT, ID: 23370017
[x]
Attachment Details

Can't truncate log file due to pending replication.  Server is not a replicated server

Asked by tkoehn in SQL Server 2005

Tags: Microsoft, MSSQL, 2005, The log was not truncated because records at the beginning of the log are pending replication.

I have a Clustered MS SQL 2005 server that has a database that was migrated several years ago.

Made a lot of record changes in the database today and our log file grew to 3.8 GB.  So I was trying to backup the database and shrink the log file:
print 'Backing up Database'
backup database plat to PLATBACKUP WITH NOFORMAT, INIT, REWIND

print 'backup log plat with no_log'
backup log plat to Platlog with NOFORMAT, INIT, REWIND

print 'shrink log file'
dbcc shrinkfile(plat_log,1)
backup log plat with no_log

I got this errors:  

1. 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.
2. Cannot shrink log file 2 (plat_Log) because all logical log files are in use.

A look on EE suggested seting recovery mode to simple so I ran this script:

/* Compress plat Database */
ALTER DATABASE [plat]
SET RECOVERY SIMPLE;
GO

/* Database File */
use [plat] DBCC SHRINKFILE (N'plat')
GO

/* Log File */
use [plat] DBCC SHRINKFILE (N'plat_log')
GO

ALTER DATABASE [plat]
SET RECOVERY FULL;
GO

I ended up getting these errors:  Cannot shrink log file 2 (plat_Log) because all logical log files are in use.

So after more research I ran this script

When trying work arounds
use plat
EXEC sp_dboption 'plat', 'published', 'true'
GO
sp_dboption 'plat'
GO
EXEC sp_repldone @xactid = NULL, @xact_segno = NULL, @numtrans = 0,    @time= 0, @reset = 1
GO
EXEC sp_dboption 'plat', 'published', 'false'
GO

I got these errors:
The Distributor has not been installed correctly. Could not enable database for publishing.
Unable to execute procedure. The database is not published. Execute the procedure in a database that is published for replication


The database is not setup to replicate logs.  I am not sur what I need to do get past this.

Any help will be greatly appreciated.Start Free Trial
[+][-]05.01.2008 at 01:43PM PDT, ID: 21482568

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.01.2008 at 01:58PM PDT, ID: 21482697

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.02.2008 at 11:11AM PDT, ID: 21488778

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.02.2008 at 11:13AM PDT, ID: 21488799

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.02.2008 at 11:29AM PDT, ID: 21488941

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.02.2008 at 11:31AM PDT, ID: 21488959

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.02.2008 at 11:33AM PDT, ID: 21488970

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.02.2008 at 11:37AM PDT, ID: 21489010

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.02.2008 at 11:42AM PDT, ID: 21489049

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]05.03.2008 at 05:49AM PDT, ID: 21492135

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: SQL Server 2005
Tags: Microsoft, MSSQL, 2005, The log was not truncated because records at the beginning of the log are pending replication.
Sign Up Now!
Solution Provided By: tkoehn
Participating Experts: 1
Solution Grade: A
 
 
[+][-]05.04.2008 at 06:24PM PDT, ID: 21497645

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628