Tuesday, April 3, 2012

How to: Shrink the SQL Server 2008 Log file (Even though in Mirroring)

How to: Shrink the SQL Server 2008 Log file Even though the database is in Mirroring


Sometimes you will not be able to shrink the SharePoint database log files, if the SQL Server 2008 database is in Mirroring option.


Solution:
At that time you need to open the "SQL Server management studio" and run the below query.



USE [WSS_Content_DBName]
Go
BACKUP LOG [WSS_Content_DBName] TO DISK='NULL'
Go
DBCC shrinkfile ('WSS_Content_LogName', 1) 
Go


Update:
If the above lines are not working, just try again the same query. Because sometimes it will take few more seconds to shrink the log files.