Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Could not locate file 'SAML' for database 'SAML' in sys.database_files


Could not locate file 'SAML' for database 'SAML' in sys.database_files

Author
Message
jasons-837104
jasons-837104
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
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.
GilaMonster
GilaMonster
SSC Guru
SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)

Group: General Forum Members
Points: 54935 Visits: 44680
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, MVP, M.Sc (Comp Sci)
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


jasons-837104
jasons-837104
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
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.
GilaMonster
GilaMonster
SSC Guru
SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)

Group: General Forum Members
Points: 54935 Visits: 44680
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, MVP, M.Sc (Comp Sci)
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


jasons-837104
jasons-837104
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
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 '.'.
GilaMonster
GilaMonster
SSC Guru
SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)SSC Guru (54K reputation)

Group: General Forum Members
Points: 54935 Visits: 44680
Use quotes.

Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
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


jasons-837104
jasons-837104
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
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
jasons-837104
jasons-837104
Forum Newbie
Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)Forum Newbie (5 reputation)

Group: General Forum Members
Points: 5 Visits: 25
disregard previous post - use quotes worked.

THANK YOU.
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