Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Could not locate file file_name in sysfiles. But it is there? Expand / Collapse
Author
Message
Posted Wednesday, May 05, 2004 3:11 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, December 13, 2007 8:21 AM
Points: 6, 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?




Post #114592
Posted Thursday, May 06, 2004 1:13 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Thursday, September 28, 2006 7:14 AM
Points: 122, 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

Post #114637
Posted Thursday, May 06, 2004 5:13 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, December 13, 2007 8:21 AM
Points: 6, Visits: 2
Thank you, that took care of the error message.


Post #114679
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse