Solved

Discover which DB .ldf belongs to?

Posted on 2008-10-07
11
313 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 142

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 142

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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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 142

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 142

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Select2 jquery help 9 45
Query Missing Money orders... 6 70
INSERT INTO SELECT JOIN THING 2 26
SQL Server memory Issue 7 74
When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

706 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

19 Experts available now in Live!

Get 1:1 Help Now