SQL 2005 9.0.2153 EE English
Database has recovery model = Full
I have job which is executed at night time. It executes these main tasks (in order of execution)
1. Renames transaction log backup of previous day.
2. Executes maintenance plan (check database -> rebuild indexes -> update statistics)
3. Makes fake backup of transaction log (to remove it later).
4. Shrinks log (dbcc shrinkfile(...,0, TRUNCATEONLY).
5. Deletes fake backup from step 3.
6. Makes full backup of database.
There is another job that executes every 15 minute at work time which backups transaction log.
Step 4 finishes with message "Cannot shrink log file ... because all logical log files are in use". And log size remains unchanged.
If I try to shrink log at work time using same dbcc shrinkfile I don't get message and log becomes small.
I added 2 steps with checkpointing. Now job executes these steps:
1. Renames transaction log backup of previous day.
2. Executes maintenance plan (check database -> rebuild indexes -> update statistics)
3. Checkpoints database
4. Makes fake backup of transaction log (to remove it later).
5. Checkpoints database
6. Shrinks log (dbcc shrinkfile(...,0, TRUNCATEONLY).
7. Deletes fake backup from step 3.
8. Makes full backup of database.
But message occures yet and log is not shrinked.
What I need to do to shrink log automatically. I need to shrink it because it grows very much after maintenence plan.