SQL Server log shrinking Issue Possible Duplicate:
  Why Does the Transaction Log Keep Growing or Run Out of Space?  




I have a 300 GB database log in our SQL Server. I want to shrink all the logs but it is not allowing me to do so. I tried by using query and UI in SQL Server 2008 R2 . I used

USE UserDB;
GO
DBCC SHRINKFILE (DataFile1, 7);
GO


But without any error database logs are not shrinking.

Then I want to use one more method as below :

I will detach the database from SQL Server, then after the move particular .LDF file to some other location and attach only the database file back to SQL Server. I am able to successfully move all the logs from SQL Server to some other server.

Please let me know this is good practice to move transaction log to some other drive. If not please suggest some other solution to recover from shrinking database log.
If you are shrinking a log file, you won't be able to shrink it any less than the active log portion.  In other words, if you are in Full Recovery Model, and you haven't done any transaction log backups (which is why it could have grown that large), then running a DBCC SHRINKFILE will do absolutely nothing.

BOL has an example on how to do this:

USE AdventureWorks2012;
GO
-- Truncate the log by changing the database recovery model to SIMPLE.
ALTER DATABASE AdventureWorks2012
SET RECOVERY SIMPLE;
GO
-- Shrink the truncated log file to 1 MB.
DBCC SHRINKFILE (AdventureWorks2012_Log, 1);
GO
-- Reset the database recovery model.
ALTER DATABASE AdventureWorks2012
SET RECOVERY FULL;
GO


That was taken straight from BOL on DBCC SHRINKFILE.

It is worth noting in the above example that changing the Recovery Model to simple breaks the log chain.  So once this operation is complete, you need to immediately start a new log chain by running a database backup.

It is also worth noting that if your log file is growing like this, you are not taking [enough] transaction log backups (provided you are indeed in Full Recovery Mode, as this would only happen in very rare situations in Simple Recovery).  You may need to either start taking transaction log backups, or backup your log more often so it truncates the trans log and creates a portion of the file reusable so  you don't have this file growth.