Solved

Can not Shrink Log File.  I am getting The file either does not exist, or was dropped.

Posted on 2008-10-14
11
2,616 Views
Last Modified: 2012-05-05
I am trying to shrink a Log File but ever time I run DBCC SHRINKFILE i get this error.

"Could not locate file 'GPSOPERALog' for database 'PLAY' in sys.database_files. The file either does not exist, or was dropped. "

I have ran sp_helpfile to confirm the logical name of the file and everything is correct.  I have also check the properties to make sure of the location of the file and it is there.  I have even tried to move the file but I get an error telling me the file is in use.

I did notice that I there are two databases on this server that have different log file names but the Logical name for both log files are the same.

What do I need to do to shrink this file.  Here is how I have the code written to do this.

DBCC SHRINKFILE(GPSTWOLog, 100)

Thanks,

Gabicusc

0
Comment
Question by:GabicusC
  • 6
  • 5
11 Comments
 
LVL 60

Expert Comment

by:chapmandew
Comment Utility
have you ran this?

restore filelistonly from disk = 'c:\backup.bak'

the name field will give you the name of your log file.
0
 
LVL 60

Expert Comment

by:chapmandew
Comment Utility
whoa....that last comment was totally off..

try this:

select * from sys.database_files
0
 

Author Comment

by:GabicusC
Comment Utility
I ran the select statement and this is what I get.



database-files-results.xls
0
 
LVL 60

Expert Comment

by:chapmandew
Comment Utility
OK, try this then:

DBCC SHRINKFILE(GPSOPERALog, 100)
0
 

Author Comment

by:GabicusC
Comment Utility
chapmandew,

Thanks.  That is what I have been trying and I am still getting the same error.  I can not figure out why it does not see the file.

Gabicus
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 60

Expert Comment

by:chapmandew
Comment Utility
are you running it in the correct database?
0
 

Author Comment

by:GabicusC
Comment Utility
Yes.  I wish it was that easy.  I have just for kicks tried and run it on the other databases on the server.  The issue that I am having is that my C drive has 0 space on it right now.  The last time the trans file was written to was back in August.  I am wondering if that could be the issue.  But I can not even touch this file and try and move it.
0
 
LVL 60

Expert Comment

by:chapmandew
Comment Utility
I would say that is definetly an issue.  Are there any old backups on that drive that you can move off or delete?
0
 

Author Comment

by:GabicusC
Comment Utility
no.  I am not finding any old Back ups that I can move to free up some room. I believe that this Data base is a test Database.   Not sure.  If it is. I am thinking the best way to do this is to detach the database then move the log file and re-attach the database and rename the logical name for the log files.

Do you think that there might be an easier way to do this?
0
 
LVL 60

Accepted Solution

by:
chapmandew earned 500 total points
Comment Utility
No....I was just getting ready to suggest you detach and reattach it elsewhere...I think it is your best option at this point.
0
 

Author Comment

by:GabicusC
Comment Utility
chapmandew,


Thanks for all your help,  we are working on it right now.

Gabicus
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
SQL Server Log File Space 6 33
separate column 24 19
Calculating Business Hours 19 59
MSSQL Frequency of Years From Days Field 2 11
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now