Log file size in MS SQL 2005

Hi,

I have a MS sql server 2005 database that has a 105GB big logfile. Is there anyway to shrink and limit this logfile without loosing data? It's beginning to take up my whole disk.

Thanks for help!

Peter
Peter NordbergIT ManagerAsked:
Who is Participating?
 
cluebeckConnect With a Mentor Commented:
The behaviour of a database log file depends on the recovery mode of the database. Check the recovery mode on the properties -> options tab of the database in question.

In Full mode the log file only gets flushed once the log files are backed up. This ensures that you can restore your databse to any state in the past.

In Simple mode the log file only contains open transactions, so it is usally only a few MBs in since and doesn't grow.

Set the database to simple mode if you are happy with only being able to restore the database to full backups. Then select Tasks -> Shrink -> Files

If you want to keep running in full recovery mode, you have to backup using Tasks -> Backup using the Backup type "Logfiles". Afterwards you can Shrink the files.

In any case you will not loose data, since the log only keeps track of changes, the actuall up-to-date data is always stored in the database itself.
0
 
OBonioCommented:
Obviously do a backup first then run this :

USE DatabaseName
GO
DBCC SHRINKFILE(<TransactionLogName>, 1)
BACKUP LOG <DatabaseName> WITH TRUNCATE_ONLY
DBCC SHRINKFILE(<TransactionLogName>, 1)

Open in new window

0
 
Peter NordbergIT ManagerAuthor Commented:
Hi and thanks for your answer. I followed you instructions and changed the mode to simple. Then I went to Task/Shrink/Files and executed that command, but the logfile seems to remain the same size. What can I have done wrong?
 
Peter
0
 
cluebeckCommented:
When you do Task/Shrink/Files did you select Log-Files under Filetyp?
Also choose the second option where you set the file to shrink to a certain since. (simply type in 5 MB or so)
0
 
Peter NordbergIT ManagerAuthor Commented:
Thanks for help!

Peter
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.