Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6112527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:45:19+00:00 2026-05-23T14:45:19+00:00

DBCC SHRINKFILE always works when I run it manually on a log file, even

  • 0

DBCC SHRINKFILE always works when I run it manually on a log file, even when I get the following message:

'Cannot shrink log file 2 (Claim_Log) because all logical log files are in use.'

When I run it from a job, however, it only shrinks the log about one third of the time. The other times, it just remains large (about 150Gb). There is never any error other than the one listed above. This is the statement that I use:

DBCC SHRINKFILE (N'Claim_log' , 0, TRUNCATEONLY)

I have “Include step output in history” enabled on the job step. Is there something else I can do to get more information on why this isn’t working?

Edit:
Here is the full message from the log:

'Executed as user: *. Cannot shrink log file 2 (Claim_Log) because all logical
log files are in use. [SQLSTATE 01000] (Message 9008)  DBCC execution completed. 
If DBCC printed error messages, contact your system administrator. [SQLSTATE 01000]
(Message 2528).  The step succeeded.'

I have already tried kicking users out of the db and setting it to single user mode.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:45:19+00:00Added an answer on May 23, 2026 at 2:45 pm

    I recently solved a similar issue, I found that in sys.databases, log_reuse_wait_desc was equal to ‘replication’. Apparently this means something to the effect of SQL Server waiting for a replication task to finish before it can reuse the log space.

    However replication had never been used on our DB nor on our server. You should be able to clear the state by running ‘sp_removedbreplication’; however for me ‘sp_removedbreplication’ didn’t solve the issue. Instead SQL just returned saying that the Database wasn’t part of a replication…

    I found my answer here:

    • http://www.sql-server-performance.com/forum/threads/log-file-fails-to-truncate.25410/
    • http://blogs.msdn.com/b/sqlserverfaq/archive/2009/06/01/size-of-the-transaction-log-increasing-and-cannot-be-truncated-or-shrinked-due-to-snapshot-replication.aspx

    Basically I had to create a replication, reset all of the replication pointers to Zero; then delete the replication I had just made.
    i.e.

    Execute SP_ReplicationDbOption {DBName},Publish,true,1
    GO
    Execute sp_repldone @xactid = NULL, @xact_segno = NULL, @numtrans = 0, @time = 0, @reset = 1
    GO
    DBCC ShrinkFile({LogFileName},0)
    GO
    Execute SP_ReplicationDbOption {DBName},Publish,false,1
    GO
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to shrink my log file using DBCC SHRINKFILE(db_2.ldf) , which is
I am trying to shrink my database log file. I have tried to run:
I am trying to write a T-SQL routine that shrink the transaction log file
I get the following error message in SQL Server 2005: User '<username>' does not
I'm trying to shrink the log of a database AND set the recovery to
Using Tsql, how can i know when DBCC checkdb was last run on SQL
I know that the transaction log/ldf file fills up and grows and that I
I have a database that has a 28gig transaction log file. Recovery mode is
I'm executing these commands from a Console Application DBCC SHRINKFILE (@FILE_NAME_MDF, 0) WITH NO_INFOMSGS
I want to run DBCC CHECKIDENT on a SqlCe4 database but it wont let

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.