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)
 shrinking log file

Author  Topic 

chanduraag
Starting Member

14 Posts

Posted - 2013-03-17 : 02:40:25
HI SQL WORLD

I have taken the log backup and
am trying to shrink the log file by running the following command

but it's not working.
if any body from the team help me out from this situation,it would be great help for me


USE DatabaseName
GO
DBCC SHRINKFILE(<TransactionLogName>, 1)
BACKUP LOG <DatabaseName> WITH TRUNCATE_ONLY
DBCC SHRINKFILE(<TransactionLogName>, 1)
GO


IT'S GIVING THE FOLLOWING ERROR

----------------------------------
Server: Msg 8985, Level 16, State 1, Line 1
Could not locate file <TransactionLogName>, in sysfiles.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.




Thank's in advance

James K
Master Smack Fu Yak Hacker

3873 Posts

Posted - 2013-03-17 : 10:45:25
Are you using the logical filename? If not, you should be. You can find the logical name using the following:
SELECT NAME FROM sys.master_files WHERE DB_NAME(database_id) = 'DatabaseName' 
AND file_id = 2;
Go to Top of Page

jeffw8713
Aged Yak Warrior

819 Posts

Posted - 2013-03-18 : 13:05:16
BACKUP LOG {database} WITH TRUNCATE_ONLY is a deprecated feature and no longer works.

You need to either perform a regular log backup, or switch to simple recovery model and back to full (note: if doing this, you need to perform a full backup after shrinking the log to reset the log chain so subsequent log backups will work.
Go to Top of Page

srimami
Posting Yak Master

160 Posts

Posted - 2013-03-21 : 08:35:28
Use logical file name instead of <TransactionLogName>, it will work.
Go to Top of Page
   

- Advertisement -