Friday, March 9, 2012

Log file

How can I get the names of Log Files for a particular database?And how can I truncate or shrink the log files in SQL SERVER?Right click on DB & look @. Properties 2 get LogFile Name
& Run
Backup Log 'DBName' WITH Truncate_Only

GW|||To see the log file name do as GWilliy wrote.
To truncate teh log you can force a maximum value for the log file but that it's not the best way to keep it small. It better to implement some mantainence plans that backup and shrink the database log file.

Originally posted by subhasishray
How can I get the names of Log Files for a particular database?And how can I truncate or shrink the log files in SQL SERVER?|||To see the files (including MDF and LDF) you can run

sp_helpfile

If you do not require transactional recovery you can run

backup log dbname with truncate_only

And you can set the recovery mode to simple to keep the log small.

If you do require transactional recovery, schedule regular T-log backups. If you want transactional recovery, be careful with shrinking the log file as it is a performance hit when SQL has to allocate more space to grow the log when it is too small.

HTH

No comments:

Post a Comment