Link to home
Start Free TrialLog in
Avatar of ibgadmin
ibgadminFlag for United States of America

asked on

Cannot shrink log file because of min log space.

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.
Avatar of ibgadmin
ibgadmin
Flag of United States of America image

ASKER

BTW - we are running SQL Server 2012 Standard
Avatar of Vitor Montalvão
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.
No clue if that works, but how about adding a log file, migrate transactions to it, and then remove​ the old one?
ASKER CERTIFIED SOLUTION
Avatar of ibgadmin
ibgadmin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ibgadmin, if your issue is solved, please close this question.
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.
As per author's comment