May 14, 2003 at 11:45 am
Is there a workaround for this that allows me to drop my transaction log files I have 3 ldf on one database that I would like to reduce down to 1. Creating a new database and moving all the objects is not a solution as one colleague suggested is not a viable answer.
Many thanks
John Zacharkan
John Zacharkan
May 14, 2003 at 11:54 am
Use sp_attach_single_file_db only on databases that have a single log file. Do not use this stored procedure on databases that have multiple log files.
But you can use DBCC Shrinkfile with 'emptyfile' option to allow the file to be dropped using the ALTER DATABASE statement.
May 14, 2003 at 12:19 pm
Thanks for the quick reply. I tried the following
use EVMECASECU0z
go
dbcc shrinkfile (EVMECASECU010LOG71,emptyfile)
go
alter database EVMECASECU0Z remove file EVMECASECU010LOG71
I get:
DbId FileId CurrentSize MinimumSize UsedPages EstimatedPages
------ ------ ----------- ----------- ----------- --------------
12 3 31969 31969 31968 31968
(1 row(s) affected)
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
Server: Msg 5042, Level 16, State 2, Line 1
The file 'EVMECASECU010LOG71' cannot be removed because it is not empty.
Any other thoughts?
John Zacharkan
John Zacharkan
May 14, 2003 at 12:30 pm
quote:
DbId FileId CurrentSize MinimumSize UsedPages EstimatedPages------ ------ ----------- ----------- ----------- --------------
12 3 31969 31969 31968 31968
Your log file does't seem to be empty. Try to backup log with truncate_only few times and run dbcc shrinkfile again.
May 14, 2003 at 12:46 pm
I know and I can't get it to be empty either.
quote:
Your log file does't seem to be empty. Try to backup log with truncate_only few times and run dbcc shrinkfile again.
John Zacharkan
John Zacharkan
May 14, 2003 at 1:41 pm
Which version of SQL Server you run?
May 14, 2003 at 2:04 pm
Thats the right track, just keep going.
Andy
May 15, 2003 at 12:40 pm
SQL 7.0.0.1063.
I have the same problem with another database. This database was broken into 3 files the mdf id 100mb using 1.5mb, tlog1 10mb and tlog2 513mb combined using only 32mb. Since I couldn't get rid of the 2nd ldf file I created another databse and xfer every thing over. By the way it now takes up 3mb.
I can send a copy of the backup it takes less than 2mb if you want to try to play with it. I pretty much exhausted my knoweledge on making the 2nd log file disapear. I even tried the Andrew Zanevsky script to force shrink it wouldn't budge. Let me know if you want the backup.
Think its time to take up knitting or something besides database work.
quote:
Which version of SQL Server you run?
John Zacharkan
John Zacharkan
May 15, 2003 at 12:55 pm
That is the version I expectd.
See KB http://support.microsoft.com/default.aspx?scid=kb;en-us;256650 for how to shrink log file in SQL Server 7.0.
July 2, 2005 at 7:42 am
July 4, 2005 at 12:05 am
Are you also using SQL Server 7 as the original poster in this old post did? And can you post the exact steps you followed to shrink the file? Are you sure that there are no long-running transactions that have not yet committed?
July 17, 2005 at 4:43 pm
go
dbcc shrinkfile (newlog,emptyfile)
go
alter database powersuite remove file newlog
go
Server: Msg 5042, Level 16, State 2, Line 1
The file 'newlog' cannot be removed because it is not empty.
Viewing 12 posts - 1 through 11 (of 11 total)
You must be logged in to reply to this topic. Login to reply