Solved

Discover which DB .ldf belongs to?

Posted on 2008-10-07
11
319 Views
Last Modified: 2012-05-05
I have a database log file that is pretty large, but I can't see what database owns it.  I've looked at all the existing databases, and none of them seem to use it.  I can't rename it, either because it's locked.  Anyone know a good way to discover which DB this .ldf belongs to?  Thanks.
0
Comment
Question by:IntercareSupport
  • 5
  • 4
  • 2
11 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22662419
check this script results:
exec sp_msforeachdb 'select * from ?.sys.files '

Open in new window

0
 

Author Comment

by:IntercareSupport
ID: 22662521
I get this:

Msg 208, Level 16, State 1, Line 1
Invalid object name 'master.sys.files'.
Msg 208, Level 16, State 1, Line 1
Invalid object name 'tempdb.sys.files'.
Msg 208, Level 16, State 1, Line 1
Invalid object name 'model.sys.files'.
Msg 208, Level 16, State 1, Line 1
Invalid object name 'msdb.sys.files'.
Msg 208, Level 16, State 1, Line 1
Invalid object name 'CM.sys.files'.

...And so on.  I tried some different variations of the sp, but nothing.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22662562
is this then sql 2000, actually?
exec sp_msforeachdb 'select * from ?.dbo.sysfiles '

Open in new window

0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 

Author Comment

by:IntercareSupport
ID: 22662584
Oh sorry.  Yes and no.  It's 2005 that has is running in 2000 mode because of the application that uses it.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 22665828
>>I have a database log file that is pretty large, but I can't see what database owns it. <<
It should be pretty easy to find out which one:  It is the Transaction Log you have failed to backup, that is why it is so big.
0
 

Author Comment

by:IntercareSupport
ID: 22669728
Well, I've looked at all the databases and no luck.  Everything looks like it backed up.  Help.  I thought the first idea was on to something.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 22670977
maybe you have another instance of sql server running?
0
 

Author Comment

by:IntercareSupport
ID: 22671020
Nope.  I just double checked.
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 22671607
ok, use filemon to find out which process accesses that file:
technet.microsoft.com/en-us/sysinternals/bb896642.aspx
0
 

Author Comment

by:IntercareSupport
ID: 22671713
Ok, that was a brilliantly simple solution.  And guess what?  Nothing is locking that file anymore.  That is very annoying.  There was just a big fuss over disk space here and I got sloppy.  Thanks!
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 22675306
Now that you know which database it belongs to, make sure you start doing regular backups on the Transaction Log or it will continue to grow until you run out of space and then you will have to post another question here.
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

856 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