tags:

views:

1073

answers:

5

Hi I'm having a production database and its replicated report database. How to shrink the transaction log files in the production database as the log file size is increasing. I had tried DBCC SHRINKFILE and SHRINKDATABASE commands but it does not work for me. I can't detach and shrink and attach back as the db in replication. Please help me in this issue.

A: 

Do you have a regular backup schedule in place?

If not, I suggest you read this excellent article: 8 Steps to better Transaction Log throughput

Mitch Wheat
no i'm not having backup schedule.I need to remove the trancation log
The reason you have a large transaction log is because you are not backing up your database regularly.
Mitch Wheat
+1  A: 

The database won't let you remove transaction data that isn't backed up. First you have to back up the transaction log, then you can shrink it.

Guffa
That i tried,but didn't worked for me.The size is not yet decreased
If your DB is in full recovery mode you need to make sure you're doing a transaction log backup as well as a database backup.
KSimons
A: 

Shrink the logfile with dbcc shrinkfile

Then truncate the log file using

Backup databaseName with truncate_only

Then shrink the logfile again

sgmoore
A: 

Actually the replication is blocking the shrinakge.

Can you guys suggest how can I stop the replication?

Thanks

A: 

I used Red-Gate's SQL Backup tool to take care of the backing up. Then I just use the management console to issue a shrink command on the log file (telling it to rearrange the pages before releasing unused space).

Works like a charm.

Jon Dewees