?
Solved

Discover which DB .ldf belongs to?

Posted on 2008-10-07
11
Medium Priority
?
326 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 2000 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
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.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Suggested Courses

809 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