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)
 Cannot shrink log file 2

Author  Topic 

imughal
Posting Yak Master

192 Posts

Posted - 2012-01-26 : 02:27:07
Hi,

i want to shrink log file, my database is in FULL recovery mode. when i run following command i got error

use MYdatabase
dbcc shrinkfile (MYdatabase_log,1)

Cannot shrink log file 2 (MYdatabase_log) because the logical log file located at the end of the file is in use.

(1 row(s) affected)
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

pls tell what is the issue and how to fix it.

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2012-01-26 : 04:37:13
Wait, try again later after some more data modification has wrapped the active portion of the log around to the beginning of the file.

p.s. Why are you shrinking the log?

--
Gail Shaw
SQL Server MVP
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2012-01-26 : 05:47:37
Needs to do a backup of the log during the "wait"? (Might be one scheduled of course (hopefully in fact!!!), but if not I think one will be needed?)
Go to Top of Page

imughal
Posting Yak Master

192 Posts

Posted - 2012-01-26 : 05:53:10
Hi,

i am working on sharepoint and sharepoint config database log file around 100 GB so i need to shrink log file.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2012-01-26 : 07:41:45
Well if there aren't any log backups scheduled that's a whole nother problem...

--
Gail Shaw
SQL Server MVP
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2012-01-26 : 07:42:41
quote:
Originally posted by imughal

i am working on sharepoint and sharepoint config database log file around 100 GB so i need to shrink log file.


Nothing about that says that a log shrink is needed. 100GB is not a limit or risky size for a log file.

Are you managing the logs correctly? If so, why do you want to shrink it?

--
Gail Shaw
SQL Server MVP
Go to Top of Page

imughal
Posting Yak Master

192 Posts

Posted - 2012-01-27 : 01:42:54
Hi,

Log file eating drive space plus effect on performance. i have not yet took log backup as well as DB back. i m just using sharepoint own backup operation.

so in order to gain space on drive and improve performance want to shrink file. Pls tell how to fix it.

thx.
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2012-01-27 : 04:26:16
If you're in full recovery and are not taking log backups, then that log will continue to grow until you sort your maintenance out.

Please read through this - [url]http://www.sqlservercentral.com/articles/64582/[/url]

--
Gail Shaw
SQL Server MVP
Go to Top of Page
   

- Advertisement -