Re: Log file size not reduce
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Tue, 5 Jul 2005 21:32:45 +0000 (UTC)
pb648174 (google@xxxxxxxxxxx) writes:
> I use the below statement. The concept of "it is just going to grow
> again" is bogus. If you don't shrink it, it will eventually take up the
> entire hard drive it is on (at least in our experience) and we have
> experienced no performance problems with shrinking it every day to one
> megabyte.
As David said, if you need to shrink it daily, you have a problem that
you should fix. If the log keeps growing, the most likely reason can be
because you are running with full or bulk-logged recovery, but are not
taking regular log backups. (Backing up the database does not truncate the
log.)
> use DBTest
> go
>
> DBCC SHRINKFILE(DBTest_log, 1)
> BACKUP LOG DBTest WITH TRUNCATE_ONLY
> DBCC SHRINKFILE(DBTest_log, 1)
Well, I know a better way: if you don't care about up-to-the-point recovery,
and are content with restoring the latest backup in case of a crash, set
the recovery mode to simple, and SQL Server will regularly truncate the
transaction log.
If your business requirements do call for up-to-the-point recovery,
you should never use WITH TRUNCATE_ONLY unless there is real emergency.
And in such case, you should take a full backup directly.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp
.
- Follow-Ups:
- Re: Log file size not reduce
- From: akej
- Re: Log file size not reduce
- From: pb648174
- Re: Log file size not reduce
- References:
- Log file size not reduce
- From: Peter CCH
- Re: Log file size not reduce
- From: Chandra
- Re: Log file size not reduce
- From: pb648174
- Log file size not reduce
- Prev by Date: Re: ?HLEP..Sql Server UPDATE INNER JOIN QUERY ?????..
- Next by Date: Updating a large table: set @@rowcount versus explicit transactions
- Previous by thread: Re: Log file size not reduce
- Next by thread: Re: Log file size not reduce
- Index(es):
Relevant Pages
|