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 'SAML' for database 'SAML' in sys.database_files Expand / Collapse
Author
Message
Posted Sunday, September 02, 2012 7:14 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, December 14, 2012 11:57 AM
Points: 5, Visits: 25
Good Morning -

I know this topic has been beaten to death over the years but I can't shrink a large log file.

I have run this:
USE SAML;
GO
DBCC ShrinkFile(SAML_log, 3000)

It returned: Msg 8985, Level 16, State 1, Line 1
Could not locate file 'SAML_log' for database 'SAML' in sys.database_files. The file either does not exist, or was dropped.

I ran: select [name], type_desc, Physical_name from sys.master_files where database_id = DB_ID('SAML')
It returned: SPGSAMLLog.ldf

I ran: SELECT df.name FROM sys.database_files AS df WHERE df.type_desc = 'log'
It returned: SPGSAMLLog.ldf

Logical name is SPGSAMLLog.ldf - correct?

I ran:
I have run this:
USE SAML;
GO
DBCC ShrinkFile(SPGSAMLLog_log, 3000)

It returned: It returned: Msg 8985, Level 16, State 1, Line 1
Could not locate file 'SPGSAMLLog_log' for database 'SAML' in sys.database_files. The file either does not exist, or was dropped.

I tried many different variations of 'SPGSAMLLog' with the same results.

What am I doing wrong?

Thanks for any help.
Post #1353215
Posted Sunday, September 02, 2012 10:10 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 11:52 AM
Points: 41,530, Visits: 34,446
No, that's the physical name of the file. You need the logical name for shrink. It's the name column in sys.database_files.

p.s. Why are you shrinking the log?



Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1353238
Posted Monday, September 24, 2012 1:01 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, December 14, 2012 11:57 AM
Points: 5, Visits: 25
Thanks for responding. I'm back on this...

I ran: SELECT [name] AS logical_file FROM sys.database_files df

It returned:
logical_file
SPGSAMLDat.mdf
SPGSAMLLog.ldf

USE SAML;
GO
DBCC ShrinkFile(SPGSAMLLog_log, 3000)

Msg 8985, Level 16, State 1, Line 1
Could not locate file 'SPGSAMLLog_log' for database 'SAML' in sys.database_files. The file either does not exist, or was dropped.
Post #1363688
Posted Monday, September 24, 2012 2:01 PM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 11:52 AM
Points: 41,530, Visits: 34,446
Are you sure that query returned the logical name, not the physical? If so, then you need to use what it returned (ie 'SPGSAMLLog.ldf') in the shrink command.


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1363709
Posted Tuesday, September 25, 2012 9:20 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, December 14, 2012 11:57 AM
Points: 5, Visits: 25
ran this: SELECT name FROM sys.master_files WHERE database_id = db_id() AND type = 1

it returned: SPGSAMLLog.ldf

tried:
USE SAML;
GO
DBCC ShrinkFile(SPGSAMLLog.ldf, 3000)

it returned:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '.'.
Post #1364124
Posted Tuesday, September 25, 2012 10:22 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Today @ 11:52 AM
Points: 41,530, Visits: 34,446
Use quotes.


Gail Shaw
Microsoft Certified Master: SQL Server 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1364168
Posted Tuesday, September 25, 2012 11:00 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, December 14, 2012 11:57 AM
Points: 5, Visits: 25
tried:
USE SAML;
GO
DBCC ShrinkFile("SPGSAMLLog.ldf", 3000)

returned:
Msg 8985, Level 16, State 1, Line 1
Could not locate file 'SPGSAMLLog.ldf' for database 'SAML' in sys.database_files. The file either does not exist, or was dropped.

UGH
Post #1364184
Posted Tuesday, September 25, 2012 11:03 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, December 14, 2012 11:57 AM
Points: 5, Visits: 25
disregard previous post - use quotes worked.

THANK YOU.
Post #1364185
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse