Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2008
»
SQL Server 2008 - General
»
Best way to truncate a log in simple mode ?
17 posts, Page 1 of 2
1
2
»»
Best way to truncate a log in simple mode ?
Rate Topic
Display Mode
Topic Options
Author
Message
mjwlufc
mjwlufc
Posted Thursday, August 30, 2012 2:53 AM
SSC Rookie
Group: General Forum Members
Last Login: Tuesday, January 29, 2013 4:07 AM
Points: 26,
Visits: 43
Hi,
I have a 60Gb log file i need to truncate on a DB running in simple mode - what is the easiest way to do this ?
In 2005 I used to use
backup log dbname with truncate_only and then shrink the file in Enterprise manger but i believe this method has changed in 2008
tia,
Mike.
Post #1352058
John Mitchell-245523
John Mitchell-245523
Posted Thursday, August 30, 2012 3:08 AM
SSCarpal Tunnel
Group: General Forum Members
Last Login: Tuesday, June 04, 2013 7:03 AM
Points: 4,443,
Visits: 7,249
The easiest way to do that is just to wait and the log will be automatically truncated for you. You shouldn't have to wait more than a minute for it to happen. If it doesn't happen automatically then there's some reason why log space can't be reused - this will not be resolved by truncating manually.
Why do you want to shrink the log file? Are you confident that it will never grow back to 60GB? If you're not, it's likely that you're wasting resources and causing fragmentation on your disk.
John
Post #1352063
mjwlufc
mjwlufc
Posted Thursday, August 30, 2012 3:17 AM
SSC Rookie
Group: General Forum Members
Last Login: Tuesday, January 29, 2013 4:07 AM
Points: 26,
Visits: 43
It doesn't seem to be reducing in size just growing..
The only reason i noticed it is the DB it logs for is only 2Gb in size so appears rather huge in comparison.
We are not low on disk space so if you believe it has no detrimental affect on performance i'll just leave it...
Maybe wrongly i believed it was good practice to keeps logs at a reasonable size
Post #1352066
John Mitchell-245523
John Mitchell-245523
Posted Thursday, August 30, 2012 3:24 AM
SSCarpal Tunnel
Group: General Forum Members
Last Login: Tuesday, June 04, 2013 7:03 AM
Points: 4,443,
Visits: 7,249
You certainly need to investigate why a database of that size has a log of that size. My point was only that if it won't truncate automatically, it won't truncate manually, either.
Use DBCC SQLPERF(LOGSPACE) to find out how much free space you have in your log file. This will give you an idea of whether you have a problem at this very moment. It may be that you have a long-running large transaction.
Please also read this article by Gail Shaw, which explains things better than I can:
http://www.sqlservercentral.com/articles/Transaction+Logs/72488/
John
Post #1352069
anthony.green
anthony.green
Posted Thursday, August 30, 2012 3:27 AM
SSCertifiable
Group: General Forum Members
Last Login: Wednesday, June 05, 2013 2:40 AM
Points: 5,075,
Visits: 4,833
These should provide some good reading on the topic of TX log management
Why is my transaction log full -
http://www.sqlservercentral.com/articles/Transaction+Logs/72488/
Managing Transaction Logs -
http://www.sqlservercentral.com/articles/Administration/64582/
Stairway to Transaction Log Management -
http://www.sqlservercentral.com/stairway/73776/
Accidental DBA Guide - Chapter 8 -
http://www.simple-talk.com/books/sql-books/troubleshooting-sql-server-a-guide-for-the-accidental-dba/
Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1
&
Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger
Post #1352070
mjwlufc
mjwlufc
Posted Thursday, August 30, 2012 3:32 AM
SSC Rookie
Group: General Forum Members
Last Login: Tuesday, January 29, 2013 4:07 AM
Points: 26,
Visits: 43
Interestingly the %used was pretty high @ 92.6%
virtual 64481.87 92.59304
Post #1352071
anthony.green
anthony.green
Posted Thursday, August 30, 2012 3:35 AM
SSCertifiable
Group: General Forum Members
Last Login: Wednesday, June 05, 2013 2:40 AM
Points: 5,075,
Visits: 4,833
Something is activly using the log then.
The first link on why is my transaction log full should help to find out what is using so much log space.
Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1
&
Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger
Post #1352072
Bobby Glover
Bobby Glover
Posted Thursday, August 30, 2012 3:36 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Yesterday @ 12:42 PM
Points: 171,
Visits: 694
USE database_name
GO
DBCC SHRINKFILE(2,1)
BACKUP LOG database_name WITH TRUNCATE_ONLY
DBCC SHRINKFILE(2,1)
The above assume the logfile is file 2.
SP_helpdb databasename
Right click db,TASKS,SHRINK change to log and see how much space is actually being used.
Then click cancel.
Post #1352074
Bobby Glover
Bobby Glover
Posted Thursday, August 30, 2012 3:40 AM
SSC-Enthusiastic
Group: General Forum Members
Last Login: Yesterday @ 12:42 PM
Points: 171,
Visits: 694
FOR 2008
USE 2008db;
GO
DBCC SHRINKFILE (<logical_logfilename>,5);
GO
For sql 2008
5- size you want to shrink to.
<logical_logfilename> run sp_helpdb.
Post #1352076
mjwlufc
mjwlufc
Posted Thursday, August 30, 2012 3:45 AM
SSC Rookie
Group: General Forum Members
Last Login: Tuesday, January 29, 2013 4:07 AM
Points: 26,
Visits: 43
DBCC OPENTRAN returns no clues
No active open transactions.
Post #1352079
« Prev Topic
|
Next Topic »
17 posts, Page 1 of 2
1
2
»»
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.