SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Could not locate file file_name in sysfiles. But it is there?


Could not locate file file_name in sysfiles. But it is there?

Author
Message
Jcanada33
Jcanada33
Valued Member
Valued Member (54 reputation)Valued Member (54 reputation)Valued Member (54 reputation)Valued Member (54 reputation)Valued Member (54 reputation)Valued Member (54 reputation)Valued Member (54 reputation)Valued Member (54 reputation)

Group: General Forum Members
Points: 54 Visits: 2

I get the following error message when I try to Shrink the database file in my SQL 2000 database:

DBCC SHRINKFILE ('workplace_onsite_1033_Data', 2000)

Could not locate file 'workplace_onsite_1033_Data' in sysfiles.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

But when I check the sysfiles table this is what I get:

SELECT NAME FROM SYSFILES WHERE fileid = 1

workplace_onsite_1033_Data

Even when I try the following statement it gives me the same error message:

DECLARE @FILENAME varchar (255)
SET @FILENAME = (SELECT NAME FROM SYSFILES WHERE fileid = 1)
EXECUTE ('DBCC SHRINKFILE ('+@FILENAME+', 2000, TRUNCATEONLY)')

Could not locate file 'workplace_onsite_1033_Data' in sysfiles.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

Any Ideas how to fix this problem?





Chris Luscik
Chris Luscik
SSC-Enthusiastic
SSC-Enthusiastic (146 reputation)SSC-Enthusiastic (146 reputation)SSC-Enthusiastic (146 reputation)SSC-Enthusiastic (146 reputation)SSC-Enthusiastic (146 reputation)SSC-Enthusiastic (146 reputation)SSC-Enthusiastic (146 reputation)SSC-Enthusiastic (146 reputation)

Group: General Forum Members
Points: 146 Visits: 1

According to SQL Server Books Online you can either specify the file name or file id, so can't you then use DBCC SHRINKFILE (1, 2000)?

In their example they don't have any quotes around the file name, so maybe it will work if you omit them, e.g.

USE UserDB
GO
DBCC SHRINKFILE (DataFil1, 7)
GO


Jcanada33
Jcanada33
Valued Member
Valued Member (54 reputation)Valued Member (54 reputation)Valued Member (54 reputation)Valued Member (54 reputation)Valued Member (54 reputation)Valued Member (54 reputation)Valued Member (54 reputation)Valued Member (54 reputation)

Group: General Forum Members
Points: 54 Visits: 2
Thank you, that took care of the error message.



Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search