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 2008 Forums
 SQL Server Administration (2008)
 Truncate log

Author  Topic 

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2012-04-30 : 15:13:18
How i trunacte the log what are steps to perform before trunate the transaction logs.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-04-30 : 15:30:27
The easiest way is to set the recovery model to Simple:

ALTER DATABASE myDB SET RECOVERY SIMPLE;

To ensure the log has been cleared, run this:

USE myDB;
CHECKPOINT;


If you cannot use Simple recovery, just make regular backups of the log:

BACKUP LOG myDB TO DISK='D:\backups\myDB_123456.bak'

Change the file name each time to maintain the log chain.
Go to Top of Page

sqlfresher2k7
Aged Yak Warrior

623 Posts

Posted - 2012-04-30 : 15:48:42
Thanks..
The database recovery model is already in simple mode.
Do you want me to run the log clear script..

USE myDB;
CHECKPOINT;

How do i check the transaction log growth..
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2012-04-30 : 16:34:16
Log growth events are recorded in the SQL Server error log. Right-click your database, choose "Reports", and "Disk Usage", you'll get a list of any auto-grow events that occurred.

You don't have to run CHECKPOINT, it's run automatically after each transaction commits in the database. It's simply a manual way to force the log to clear in Simple recovery.
Go to Top of Page
   

- Advertisement -