Author |
Topic |
amolbawake777
Starting Member
3 Posts |
Posted - 2014-04-24 : 05:53:32
|
Hello,I have a database in which the size of ldf file has increased to 460GBHow can i reduce it?Or is there any way to attach new ldf file without downtime.Also let my mdf and ldf file are on different drives.can i change the path of ldf file.Regards,Amol B |
|
James K
Master Smack Fu Yak Hacker
3873 Posts |
Posted - 2014-04-24 : 08:18:18
|
More likely than not, your recovery model is full or bulk-logged, and you do not have scheduled transaction log backups. In full or bulk-logged recovery models, the only way transaction log will be prevented from monotonically growing is by taking backups of the log. So you can do one of two things:a) change the recover model to simple. I don't recommend this, in most cases, but may be appropriate in some.b) Take a backup of the log, shrink the log file, and then schedule regular backups.Gail Shaw's article on this topic is very good. Before you do anything, go through that article: http://www.sqlservercentral.com/articles/Administration/64582/ |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
|
amolbawake777
Starting Member
3 Posts |
Posted - 2014-04-29 : 00:04:47
|
Hello,How can i decrease the size of LDF file without any downtime.AmolB |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
|
amolbawake777
Starting Member
3 Posts |
Posted - 2014-04-29 : 04:12:16
|
Hello Jack,Thank you for your help.Can you please elaborate how can i run the below query to decrease the size.==========01.-- check there are no active transactions02.USE sizetest03.GO04.dbcc shrinkfile(sizetest_log,TRUNCATEONLY)05.GO06.ALTER DATABASE sizetest07.MODIFY FILE08.(NAME = sizetest_log,09.SIZE = 1MB);10.GO==========I am bit new to SQL database.please help me to this task |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2014-04-30 : 01:28:47
|
Hi, You can use SQL Server Management Studio. Just to mention , you shouldn't include the numbers at the start, so it should be :-- check there are no active transactionsUSE sizetestGOdbcc shrinkfile(sizetest_log,TRUNCATEONLY)GOALTER DATABASE sizetestMODIFY FILE (NAME = sizetest_log, SIZE = 1MB);GOOf course , you must also replace "sizetest" with relevant name of files you are attempting to modifyJack Vamvas--------------------http://www.sqlserver-dba.com |
|
|
jackv
Master Smack Fu Yak Hacker
2179 Posts |
Posted - 2014-04-30 : 01:28:52
|
Hi, You can use SQL Server Management Studio. Just to mention , you shouldn't include the numbers at the start, so it should be :-- check there are no active transactionsUSE sizetestGOdbcc shrinkfile(sizetest_log,TRUNCATEONLY)GOALTER DATABASE sizetestMODIFY FILE (NAME = sizetest_log, SIZE = 1MB);GOOf course , you must also replace "sizetest" with relevant name of files you are attempting to modifyJack Vamvas--------------------http://www.sqlserver-dba.com |
|
|
|