Remove large (old) log file from SIMPLE model database?
  Home FAQ Contact Sign in
microsoft.public.sqlserver.setup only
 
Advanced search
POPULAR GROUPS

more...

microsoft ... sqlserver.setup Profile…
 Up
Remove large (old) log file from SIMPLE model database?         


Author: £Jim
Date: Sep 16, 2008 10:01

Hi,
I have a database where the recovery model was changed to SIMPLE a
while back. There is still a 300GB log file attached to it although it
is not being updated. How can I detach and delete the file? (SQL2005)
Thanks
--
4 Comments
Re: Remove large (old) log file from SIMPLE model database?         


Author: Aaron Bertrand [SQL Server MVP]
Date: Sep 16, 2008 10:18

You can't just delete the log file, even in simple recovery the log is
required. Did you try DBCC SHRINKFILE? Please read the following article:

http://www.karaszi.com/SQLServer/info_dont_shrink.asp

On 9/16/08 1:01 PM, in article O0ZfV3BGJHA.2252@TK2MSFTNGP02.phx.gbl, "£Jim"
wrote:
> Hi,
> I have a database where the recovery model was changed to SIMPLE a
> while back. There is still a 300GB log file attached to it although it
> is not being updated. How can I detach and delete the file? (SQL2005)
> Thanks
no comments
RE: Remove large (old) log file from SIMPLE model database?         


Author: Linchi Shea
Date: Sep 16, 2008 10:22

You don't have to detach it. You can just shrink it. First, run sp_helpdb to
find the file number for the log file (say the file number is 2). Then, run
the following to shrink it:

use
go
DBCC SHRINKFILE(2, )

Linchi

"£Jim" wrote:
> Hi,
> I have a database where the recovery model was changed to SIMPLE a
> while back. There is still a 300GB log file attached to it although it
> is not being updated. How can I detach and delete the file? (SQL2005)
> Thanks
> --
>
>
no comments
Re: Remove large (old) log file from SIMPLE model database?         


Author: Roy Harvey (SQL Server MVP)
Date: Sep 16, 2008 10:28

On Tue, 16 Sep 2008 10:01:15 -0700, £Jim wrote:
>I have a database where the recovery model was changed to SIMPLE a
>while back. There is still a 300GB log file attached to it although it
>is not being updated. How can I detach and delete the file? (SQL2005)

Just because the database is in SIMPLE mode does not mean the log file
is not being used. Even then everything is written to the log. That
is required the way SQL Server manages the log and data pages, and
handles COMMIT and ROLLBACK.

So you still need a log file, just not one quite so large. Look up
DBCC SHRINKFILE for instructions on making it smaller.

Roy Harvey
Beacon Falls, CT
no comments
Re: Remove large (old) log file from SIMPLE model database?         


Author: £Jim
Date: Sep 16, 2008 11:05

Thank you for all the input and rapid replies. I understand that you
would still need a log file, but 300GB for a 30GB database seems like a
lot to a new user! The article is very informative.

I have been able to shrink the log file significantly (following a full
database backup) using the DBCC SHRINKFILE command.
--

£Jim wrote:
> Hi,
> I have a database where the recovery model was changed to SIMPLE a
> while back. There is still a 300GB log file attached to it although it
> is not being updated. How can I detach and delete the file? (SQL2005)
> Thanks
no comments

RELATED THREADS
SubjectArticles qty Group
Postfix has stopped logging in var/log/maillist.postfix.users ·