Friday, February 24, 2012

Cannot shrink log file 2 (emptydb_Log) because all logical log files are in use.

I am getting the following error message that is
preventing me from shrinking the log file for a
database. The database was created by doing a restore
from a backup of a database named emptydb. Prior to the
backup of emptydb, its transaction log had been backed up
and truncated, then a complete database backup of emptydb
had been done using the overwrite option in Enterprise
Manager | Tools | Backup Database.
After the restore of emptydb into a new database, the new
database was loaded and a large transaction file was
created. I did a backup of the complete new database,
then a backup of the transaction log, then attempted to
shrink the new database.
Why is there still an emptydb log file in this database?
How do I get the shrinkfile or shrinkdatase to truncate
the log file?
Thanks in advance for your help.
Jim DurbinIt sounds like the database was created with a "large" log file. If the
file size was set explicitly, as opposed to growing, you will need to use
the dbcc shrinkfile command to resize it. The dbcc shrink database will
only shrink the file to it's initial size at best.
If the dbcc shrinkfile does not actually shrink the file, this basically
means that you have active transactions in the trailing virtual log files so
it can't be truncated and dropped. You can take a look at your VLF's by
issuing a dbcc loginfo command, this shows how many VLFs you have and which
one(s) are active. You may have to issue several backup log commands before
the active log circles around to some of the first VLFs and then you can
drop the trailing ones, etc...
See "Truncating the Transaction Log" and "Shrinking the Transaction Log" in
Books Online for full details.
"Jim Durbin" <anonymous@.discussions.microsoft.com> wrote in message
news:22cd01c3d160$228ae760$3101280a@.phx.gbl...
> I am getting the following error message that is
> preventing me from shrinking the log file for a
> database. The database was created by doing a restore
> from a backup of a database named emptydb. Prior to the
> backup of emptydb, its transaction log had been backed up
> and truncated, then a complete database backup of emptydb
> had been done using the overwrite option in Enterprise
> Manager | Tools | Backup Database.
> After the restore of emptydb into a new database, the new
> database was loaded and a large transaction file was
> created. I did a backup of the complete new database,
> then a backup of the transaction log, then attempted to
> shrink the new database.
> Why is there still an emptydb log file in this database?
> How do I get the shrinkfile or shrinkdatase to truncate
> the log file?
> Thanks in advance for your help.
> Jim Durbin
>

No comments:

Post a Comment