Log file will not shrink

Posted on 2006-05-31
Medium Priority
Last Modified: 2012-05-05

I have a log file that has grown huge (someone set it to grow automatically, I know, bad).  Anyway, I'm trying to shrink it using the DBCC SHRINKFILE command in conjunction with the BACKUP LOG command.  When I run the shrinkfile it completes fine but doesn't shrink the file at all.  I ran DBCC LOGINFO and it's returning over 350 rows all with status 2.  The other thing is this DB is being replicated to (it's a subscriber).  Any help would be appreciated.

The results of the DBCC SHRINKFILE is below:

Cannot shrink log file 2 (LiveDW_Log) because all logical log files are in use.
DbId   FileId CurrentSize MinimumSize UsedPages   EstimatedPages
------ ------ ----------- ----------- ----------- --------------
21     2      17810560    128         17810560    128

And when I run the BACKUP 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.

(1 row(s) affected)


Question by:mrbass78
LVL 32

Expert Comment

ID: 16801008
Someone answered this for me a while back and it worked perfectly:


Accepted Solution

Titan522 earned 2000 total points
ID: 16801865
Had the same problem. Transactions in the begining of the file are preventing you from truncating the log. Never has time to verify but I think it is due to the fact that alter/new published objects were in the publisher but not in the subscriber. Once I dropped the subscriber the log shrank right away since replication wasn't be done anymore. I will recreate the subscriber if possible. If not use the sp_repldone stored proc to mark the transactions has no longer needed for replication.

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Your data is at risk. Probably more today that at any other time in history. There are simply more people with more access to the Web with bad intentions.
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question