We help IT Professionals succeed at work.

Cannot shrink log file because of min log space.

ibgadmin
ibgadmin asked
on
99 Views
Last Modified: 2017-05-21
I had this question after viewing Cannon shrink log file because of minimum log space required..

I found the above answered question.  I have a similar issue but someone initially told us to use sp_replflush.  We did that but still receive can't shrink because of min log space required.  What do we need to do so we can shrink the log file.  The database is a test db that was restored from a production db that had replication on it but don't need on the test db.  I guess we need all the steps involved when we copy a production db with replication to a test environment without it having any log transactions to fill from replication.
Comment
Watch Question

Author

Commented:
BTW - we are running SQL Server 2012 Standard
Vitor MontalvãoIT Engineer
CERTIFIED EXPERT
Distinguished Expert 2017

Commented:
The database is a test db that was restored from a production db that had replication on it but don't need on the test db
I think that's your main problem. You created the database from a restore so it will keep the Production configuration. In SQL Server, you can't shrink a file to a size lower that when it was created.
My suggestion to solve this issue is to perform a transaction log backup followed by a shrink log file on the Production database, back it up immediately and restore it in your test machine so it will restore with a smaller transaction log file.
Qlemo"Batchelor", Developer and EE Topic Advisor
CERTIFIED EXPERT
Top Expert 2015

Commented:
No clue if that works, but how about adding a log file, migrate transactions to it, and then remove​ the old one?
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION
Vitor MontalvãoIT Engineer
CERTIFIED EXPERT
Distinguished Expert 2017

Commented:
ibgadmin, if your issue is solved, please close this question.

Author

Commented:
Issue resolved - I was able to resolve this by running a log backup TWICE on the test db.  I read that somewhere in a thread about issues with shrinklog about running twice.  Thanks for your help.
Vitor MontalvãoIT Engineer
CERTIFIED EXPERT
Distinguished Expert 2017

Commented:
As per author's comment