Friday, February 10, 2012

clearing log

As a relative newcomer to MSSQL, I've been playing around with a database,
adding and removing tables and tons of data. Now I'm ready to get down to
business.
I notice that the log (LDF file) is now three times the size of the database
itself. I'm pretty sure there's nothing in there that is of any use. Is
there a way to clear it? Is that desirable? Am I better off starting over
with a new database? This one does have some, not a lot, data in it that I'd
like to keep.Try in Query Analyser
BACKUP LOG WITH TRUNCATE_ONLY
Then
DBCC SHRINKFILE( look in BOL for more detail)
If you don't want to do this repeatedly, you can modify the Recovery
Model of the database !
Go to your Database Property, on the last tab, you'll se the recovery
model is at Full or Bulked-Logged, change it to Simple ! Your log will
stop accumulating !
You can also change the recovery model of Model database so the next
database you create will use simple recovery !
For more information on Recovery Model, search BOL
Pollus Brodeur|||If you don't do regular transaction log backups, set the database to simple
recovery mode. Shrinking
considerations: http://www.karaszi.com/SQLServer/info_dont_shrink.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Paul Pedersen" <no-reply@.swen.com> wrote in message news:eoMfbUaXFHA.616@.TK2MSFTNGP12.phx.
gbl...
> As a relative newcomer to MSSQL, I've been playing around with a database,
adding and removing
> tables and tons of data. Now I'm ready to get down to business.
> I notice that the log (LDF file) is now three times the size of the databa
se itself. I'm pretty
> sure there's nothing in there that is of any use. Is there a way to clear
it? Is that desirable?
> Am I better off starting over with a new database? This one does have some
, not a lot, data in it
> that I'd like to keep.
>
>
>
>|||Thanks to all.
"Paul Pedersen" <no-reply@.swen.com> wrote in message
news:eoMfbUaXFHA.616@.TK2MSFTNGP12.phx.gbl...
> As a relative newcomer to MSSQL, I've been playing around with a database,
> adding and removing tables and tons of data. Now I'm ready to get down to
> business.
> I notice that the log (LDF file) is now three times the size of the
> database itself. I'm pretty sure there's nothing in there that is of any
> use. Is there a way to clear it? Is that desirable? Am I better off
> starting over with a new database? This one does have some, not a lot,
> data in it that I'd like to keep.
>
>
>
>

No comments:

Post a Comment