Friday, March 9, 2012

Log File

Ok, I am relatively new to SQL Server, so excuse my ignorance....
When does the data on the log file get flushed? I have this log file on my
database which continues to grow and grow. I am really not interested in
keeping a log file as my database is just a holder for a bunch of flat files
which are loaded into the tables weekly/monthly. If I ever experienced a
problem with the data, I would always just go to a backup of my database, I
would never use the log file to rebuild.
I am using DTS to load the data from a flat file into the database as well
as delete all of the original entries. I have change the DTS query to
truncate the rows in the table, which I believe will not log to the log file
(Is that correct?). How can I get my uploads from the flat file into the
table to not log as well?
How can I get rid of the data in the log file which now is about 3 times the
size of my database?
Thanks in advance for your assistance!!!!Jim Heavey wrote:
> Ok, I am relatively new to SQL Server, so excuse my ignorance....
> When does the data on the log file get flushed? I have this log file on my
> database which continues to grow and grow. I am really not interested in
> keeping a log file as my database is just a holder for a bunch of flat files
> which are loaded into the tables weekly/monthly. If I ever experienced a
> problem with the data, I would always just go to a backup of my database, I
> would never use the log file to rebuild.
> I am using DTS to load the data from a flat file into the database as well
> as delete all of the original entries. I have change the DTS query to
> truncate the rows in the table, which I believe will not log to the log file
> (Is that correct?). How can I get my uploads from the flat file into the
> table to not log as well?
> How can I get rid of the data in the log file which now is about 3 times the
> size of my database?
> Thanks in advance for your assistance!!!!
Under the Full Recovery model (the default) the log file is truncated
when you do a transaction log backup. If you don't require log backups
then select Simple Recovery so that the log is truncated automatically.
Use the ALTER DATABASE statement to set the recovery model (see Books
Online).
Truncation doesn't actually shrink the log file, it simply frees
portions of the log to be reused so that it won't need to grow. It's
better not to keep shrinking and growing the log because doing so hurts
performance and causes fragmentation. To shrink the log use DBCC
SHRINKFILE. Do that once then set the log file to an appropriate size
and leave it alone.
You cannot turn off logging. As far as the database is concerned DTS is
just a client app like any other. The operations performed by DTS will
be logged in just the same way as under any other application.
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--

No comments:

Post a Comment