Wednesday, March 21, 2012

Manually truncate a LOG file

SQL 7.0
How do I manually truncate a LOG file?
Thanks,
DonBACKUP LOG database_name
WITH TRUNCATE_ONLY
BOL describes it nicely.
--
Mike Epprecht, Microsoft SQL Server MVP
Zurich, Switzerland
IM: mike@.epprecht.net
MVP Program: http://www.microsoft.com/mvp
Blog: http://www.msmvps.com/epprecht/
"Don" <anonymous@.discussions.microsoft.com> wrote in message
news:64e601c4c903$3e4969e0$a301280a@.phx.gbl...
> SQL 7.0
> How do I manually truncate a LOG file?
> Thanks,
> Don
>|||That's the command I used on my 30GB LOG file and after
it ran without errors, all the pink turned to blue in EM
and the space remained the same.
How can I get rid of all of this space in the LOG file?
Thanks,
Don
>--Original Message--
>BACKUP LOG database_name
> WITH TRUNCATE_ONLY
>BOL describes it nicely.
>--
>Mike Epprecht, Microsoft SQL Server MVP
>Zurich, Switzerland
>
>IM: mike@.epprecht.net
>MVP Program: http://www.microsoft.com/mvp
>Blog: http://www.msmvps.com/epprecht/
>"Don" <anonymous@.discussions.microsoft.com> wrote in
message
>news:64e601c4c903$3e4969e0$a301280a@.phx.gbl...
>> SQL 7.0
>> How do I manually truncate a LOG file?
>> Thanks,
>> Don
>
>.
>|||I do that command and then go into EM and right-click on DB.
Choose SHRINK files.
Click on the FILES button - brings you to another pop-up window - choose the
LOG file from the DROPDOWN. Then click OK (the correct check box should be
already the default). This window disappears - then I cancel off the main
window, so I don't shrink the DB itself.
I wish I knew the SQL command string to do this action - EM does it in a
very cumbersome fashion.
But the LOG is 1024 K after this operation - so I know it works!!
"Don" wrote:
> That's the command I used on my 30GB LOG file and after
> it ran without errors, all the pink turned to blue in EM
> and the space remained the same.
> How can I get rid of all of this space in the LOG file?
> Thanks,
> Don
> >--Original Message--
> >BACKUP LOG database_name
> > WITH TRUNCATE_ONLY
> >
> >BOL describes it nicely.
> >
> >--
> >Mike Epprecht, Microsoft SQL Server MVP
> >Zurich, Switzerland
> >
> >
> >IM: mike@.epprecht.net
> >
> >MVP Program: http://www.microsoft.com/mvp
> >
> >Blog: http://www.msmvps.com/epprecht/
> >
> >"Don" <anonymous@.discussions.microsoft.com> wrote in
> message
> >news:64e601c4c903$3e4969e0$a301280a@.phx.gbl...
> >> SQL 7.0
> >>
> >> How do I manually truncate a LOG file?
> >>
> >> Thanks,
> >> Don
> >>
> >
> >
> >.
> >
>|||Take a look at the DBCC SHRINKFILE option in BooksOnLine. If you are only
going to truncate the log why not set the recovery mode to SIMPLE?
--
Andrew J. Kelly SQL MVP
"Don" <anonymous@.discussions.microsoft.com> wrote in message
news:546301c4c908$6a3ab450$a401280a@.phx.gbl...
> That's the command I used on my 30GB LOG file and after
> it ran without errors, all the pink turned to blue in EM
> and the space remained the same.
> How can I get rid of all of this space in the LOG file?
> Thanks,
> Don
>>--Original Message--
>>BACKUP LOG database_name
>> WITH TRUNCATE_ONLY
>>BOL describes it nicely.
>>--
>>Mike Epprecht, Microsoft SQL Server MVP
>>Zurich, Switzerland
>>
>>IM: mike@.epprecht.net
>>MVP Program: http://www.microsoft.com/mvp
>>Blog: http://www.msmvps.com/epprecht/
>>"Don" <anonymous@.discussions.microsoft.com> wrote in
> message
>>news:64e601c4c903$3e4969e0$a301280a@.phx.gbl...
>> SQL 7.0
>> How do I manually truncate a LOG file?
>> Thanks,
>> Don
>>
>>.|||Andrew,
Don is using SQL 7. So best option is that he can enable the TRUNCATE LOG
ON CHECKPOINT option using sp_dboption.
Don,
Enable the database option TRUNCATE LOG ON CHECKPOINT and execute below:-
backup log dbname with truncate_only
go
DBCC SHRINKFILE (see books online)
Thanks
Hari
SQL Server MVP
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:O$gLdzRyEHA.3844@.TK2MSFTNGP09.phx.gbl...
> Take a look at the DBCC SHRINKFILE option in BooksOnLine. If you are only
> going to truncate the log why not set the recovery mode to SIMPLE?
> --
> Andrew J. Kelly SQL MVP
>
> "Don" <anonymous@.discussions.microsoft.com> wrote in message
> news:546301c4c908$6a3ab450$a401280a@.phx.gbl...
>> That's the command I used on my 30GB LOG file and after
>> it ran without errors, all the pink turned to blue in EM
>> and the space remained the same.
>> How can I get rid of all of this space in the LOG file?
>> Thanks,
>> Don
>>--Original Message--
>>BACKUP LOG database_name
>> WITH TRUNCATE_ONLY
>>BOL describes it nicely.
>>--
>>Mike Epprecht, Microsoft SQL Server MVP
>>Zurich, Switzerland
>>
>>IM: mike@.epprecht.net
>>MVP Program: http://www.microsoft.com/mvp
>>Blog: http://www.msmvps.com/epprecht/
>>"Don" <anonymous@.discussions.microsoft.com> wrote in
>> message
>>news:64e601c4c903$3e4969e0$a301280a@.phx.gbl...
>> SQL 7.0
>> How do I manually truncate a LOG file?
>> Thanks,
>> Don
>>
>>.
>

No comments:

Post a Comment