Cannot shrink log file because of min log space.

ibgadmin
ibgadmin used Ask the Experts™
on
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

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
BTW - we are running SQL Server 2012 Standard
Vitor MontalvãoIT Engineer
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
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?
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

Commented:
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
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
Distinguished Expert 2017

Commented:
As per author's comment

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial