Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Truncate Log

Author  Topic 

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2008-05-13 : 06:43:30
Hi

I have a Log which is 15 gb. Recovery mode is simple.

What command can I use to truncate this log? Or is it best to shrink it?

Thanks

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-05-13 : 06:44:45
BACKUP LOG db WITH TRUNCATE_ONLY



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

dnf999
Constraint Violating Yak Guru

253 Posts

Posted - 2008-05-13 : 06:46:38
Will this actually back up the log?

As all I want to do is truncate or shrink the log, in the fastest possible way, so I can continue to use the database.

Thanks!
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2008-05-13 : 07:01:09
The log will be truncated at checkpoint without you doing anything.
If the problem is that you have a large empty file then you can use dbcc shrinkfile to shrink it.

see
http://www.nigelrivett.net/SQLAdmin/TransactionLogFileGrows_1.html


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-05-13 : 11:52:54
IF you care about Point-in -time recovery you shouldn't truncating log and you need full -recovery model.
Go to Top of Page
   

- Advertisement -