January 3, 2008 at 9:37 am
Our developers had the .mdf and .ldf moved from the data directory to another location on our drive, so now the truncate script won't work. How do you get the truncate command to work on files in a different location?
I've tried the following and it has been throwing me an error that says it can't find the file in that location. Any suggestions?
backup log [database] with truncate_only
go
dbcc shrinkfile ("D:\Databases\[database]"_log,0)
go
January 3, 2008 at 10:06 am
It sounds like a permissions issue. Try executing the procedure from a sysadmin account that has rights to that directory.
January 3, 2008 at 10:08 am
All permissions are the same and I am logged in as the server administrator.
January 3, 2008 at 10:11 am
What is the exact error message?
January 3, 2008 at 10:15 am
Msg 8985, Level 16, State 1, Line 1
Could not locate file 'D:\Meridian\SEMA\MG\1.0\KRepository\SEMA_KR_1_0_log.ldf' for database 'SEMA_KR_1_0'.
January 3, 2008 at 10:25 am
Use the Log file's logical name, not the path
January 3, 2008 at 10:29 am
Like this:
backup log [database] with truncate_only
go
DBCC SHRINKFILE (N'LogicalName' , 0, TRUNCATEONLY)
go
January 3, 2008 at 12:00 pm
That worked. Thanks so much for your help.
Viewing 8 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply