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
 SQL Server Administration (2005)
 Clearing Log Files

Author  Topic 

sent_sara
Constraint Violating Yak Guru

377 Posts

Posted - 2008-09-18 : 01:44:44

Hi Friend ,I need to Clear The Log Files
on daily basis by scheduling ,can any one correct the below query
Txs in Advance
Declare @ctr int,@i int
Declare @dbname varchar(10)
set i=0
select @ctr=count(*) from sys.databases
while @i<=@ctr
begin
-->HoW to Call the Db name
@str='dump tran '+ @dbname + ' with no_log'
Exec (dbcc @str)
set @i=@i+1
end

YellowBug
Aged Yak Warrior

616 Posts

Posted - 2008-09-18 : 03:48:33
Why do you require this? In production or development/test server?
What recovery model and backup/restore strategy are you using for the databases?

Instead of doing this daily, consider setting your databases to the SIMPLE recovery model, if appropriate.

Look up the BACKUP LOG statement in BOL.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2008-09-18 : 04:12:23
Duplicate post
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=110863

--
Gail Shaw
SQL Server MVP
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-09-18 : 08:27:13
Better to backup log more frequently if you are in Full Recovery model.
Go to Top of Page
   

- Advertisement -