[dba-SQLServer] Is it my imagination?

Francisco Tapia fhtapia at gmail.com
Sun Sep 5 10:56:41 CDT 2004


I know your rant on this one John, but the truth is that Truncating a
log is something that must be done w/ care depending on how you want
it to be done, the point to a Transaction log file is to keep an
additional redundancy to the recently added/modified data.  So you
don't want to just blindingly truncating logs.  Additionally, I think
the mentality is diffrent when dealing w/ Sql Server than it is w/
something like Access.... Now it's not impossible for them to give you
a gui tool to do this: (where DBName is your database name)

BACKUP LOG DBName WITH TRUNCATE ONLY
DBCC SHRINKFILE (DBName_Log, 10)

the 10 is the size you want your newly truncated log to be the size
of.  If you simply just backup the log you will also "Clear
checkpoints" and fully commit data from the log to the database.  But
running a point such as the above w/ TRUNCATE ONLY could be dangerous
in a production environment because you "could" potentially loose data
if some user were trying to append a series of large records at that
point in time.  I suspect that is why they don't just give you a GUI
button for it.  Because you know people, the moment you make something
easier, they take that route instead of doing things the right way...


On Sun, 05 Sep 2004 11:23:20 -0400, John W. Colby
<jwcolby at colbyconsulting.com> wrote:
> Is it my imagination or is SQL Server just not particularly friendly?  Yea,
> I know, it is a BIG database and you are supposed to know what you are doing
> but still...
> 
> For example, I need to truncate my log files.  I am doing this BCP and three
> of the 4 BCPs I had running last night failed due to the log file running
> our of room.  SIGH!
> 
> Now I can find a help page on Truncating the log file, but nowhere does it
> actually say "do this".  It seems that this would be something that needs to
> be done manually once in awhile if for no other reason than (like this case)
> to get back in operation quickly.  So you would THINK there would be a
> "truncate log file" menu item somewhere.
> 
> Ah yes, research is sooooo good for the soul.  I have a TON of real (paying)
> work waiting to be done and I'm trying to figure out how to do a simple
> thing like truncate the log file!
> 



-- 
-Francisco



More information about the dba-SQLServer mailing list