Database does not appear in list!

  • I noticed an mdf file in the mssqlserver\data folder that does not appear in list of db's in Management Studio. It's in use because I can't rename the file. How can I determine what is using this. I didn't see an MSDE installation in Add/Remove programs.

    I'm pretty sure no other IT person has set this up. I'm typically the only person to use this workstation (it is a workstation with SS2005 --don

    t ask).

    As far as I know there is only one instance installed. Any tips on how I can find out how to get rid of this? I could try shutting down the sql service and rename it and see who complains. I was hoping there is a more eloquent way.


    smv929

  • Could it be that you have two mdf files assigned to one database?


    La paz sea contigo,

    Gabriel Bribiesca

  • Remember - it's fairly easy to attach a database under an entirely different name than what the files are created. Chances are - this is attached to your production database under another "pseudonym".

    Catch is I'm just not quite sure how so easily scan for which one that might be. You could use

    select * from sys.database_files

    but you have to keep switching from one database to the next, since it will only report on the files that make up the CURRENT database....

    ----------------------------------------------------------------------------------
    Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?

  • Another alternative is to run this:

    exec sp_msforeachdb 'exec sp_helpdb ?'



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


  • or use this....

    SELECT db_name(database_id),name,physical_name ,state from sys.master_files

  • Thanks, guys. I tried each method, however, none listed that file. I'm thinking it must be an Access database. I will try to rename the file and see who screams.


    smv929

  • Did you have any luck renaming it? I thought in your initial posting that you were unable to rename it. What is the name of the mdf file? Access files typically have an mdb extension.

  • It's not mssqlsystemresource.mdf is it? You'll not want to be fiddling with that.



    Scott Duncan

    MARCUS. Why dost thou laugh? It fits not with this hour.
    TITUS. Why, I have not another tear to shed;
    --Titus Andronicus, William Shakespeare


Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply