SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 shrinking log file
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

chanduraag
Starting Member

India
14 Posts

Posted - 03/17/2013 :  02:40:25  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

3744 Posts

Posted - 03/17/2013 :  10:45:25  Show Profile  Reply with Quote
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

USA
806 Posts

Posted - 03/18/2013 :  13:05:16  Show Profile  Reply with Quote
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 - 03/21/2013 :  08:35:28  Show Profile  Reply with Quote
Use logical file name instead of <TransactionLogName>, it will work.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000