Cannot shrink transaction log file in in sql
There is an sql server running on windows 2003. The disk space is around 1 tetrabyte. There are 2 database on the system. The first is for production and the second one is used for test environment. The transaction log file is growing unexpectedly. It has grown to an extent that only some mb's are left out it. I tried to shrink to get some place but I failed. Any suggestions really appreciated.
Re: Cannot shrink transaction log file in in sql
The expansion of log file can make you database unstable. It can grow upto an un acceptable limit. Each database has one data file and log transaction file. Normally your server physically stores data in the data file. All the modifications and transaction performed for each database is store in transaction log file. The transaction log files grows in units of virtual log files. Some time they grow to extent that you can lose your disk space. To reduce the size of transaction log you will need to truncate the interactive transaction in your transaction log and shrink it.
Re: Cannot shrink transaction log file in in sql
You can prevent transaction log file to grow unexpectedly and eat up your disk space. In order to do this you will need to perform some actions listed below. To avoid automatic expansion of the transaction log file, set the size of the log file so that it cannot increase to large value. Configure the automatic expansion by using memory units.
Re: Cannot shrink transaction log file in in sql
It is necessary shrink the log file other wise it will effect your database. You shrink the transaction file in your sever to remove unused pages. Is is very important to backup your database before shrinking the transaction log file. You can shrink it manually and get more disk space. First to backup the file run Transact -SQl statement similar to below : -
- BACKUP LOG <DatabaseName> TO DISK = '<BackupFile>'
After that to shrink file run the below statement : -
- DBCC SHRINKFILE (<FileName>, <TargetSize>) WITH NO_INFOMSGS