Missing Database and Error 5123 (mdf in use by another process)

  • Ops manager reported the transaction log for database Viper was full.

    Using SSMS I connected to the server but found no database Viper.

    I then RDP'd to the server and found Viper.MDF and Viper.LDF

    Back to SSMS and ran attach database but that resulted in Error:5123

    Create file encountered an operating system error 32..the process cannot access the file b/c it is being used by another process.

    What's going on? I want to be able to backup the log and shrink it or truncate and do a full backup if I have to but I can't at this point.

  • Are you logged in the correct instance?

    Are you logging as a SA? If not, do you have permissions to access that db?

  • Ninja's_RGR'us (4/4/2011)


    Are you logged in the correct instance?

    Are you logging as a SA? If not, do you have permissions to access that db?

    Good point..checking on that now..

  • I'm SA.

  • That's the whole extent of my experience with that issue. I won't have anything else to offer other than googling for it.

  • Sounds like you've got two instances on your server. Go on to the server and run SQL Server Configuration Manager. This will list all the instances that are installed.

    John

  • Plan Z, when you are on the correct server, lookup the sql logs about that database, that should give you more info.

    Plan ZZ, is it possible to revoke Sys Admin rights to SA?

  • John Mitchell-245523 (4/4/2011)


    Sounds like you've got two instances on your server. Go on to the server and run SQL Server Configuration Manager. This will list all the instances that are installed.

    John

    Nice John! You were right. When I connect to the server via SSMS I can see all E drive databases but the VIPER database (which its mdf is located on E:) But when I checked out C:\programfiles\... I found MSSQL$VIPER!

    Now how do I connect to that?

  • Vertigo44 (4/4/2011)


    John Mitchell-245523 (4/4/2011)


    Sounds like you've got two instances on your server. Go on to the server and run SQL Server Configuration Manager. This will list all the instances that are installed.

    John

    Nice John! You were right. When I connect to the server via SSMS I can see all E drive databases but the VIPER database (which its mdf is located on E:) But when I checked out C:\programfiles\... I found MSSQL$VIPER!

    Now how do I connect to that?

    Probably as SameServerNameAsUsual\VIPER

    Leo

    Leo
    Nothing in life is ever so complicated that with a little work it can't be made more complicated.

  • I got the 5123 trying to attach the adventureworks database to SQL 2005.

    Pretty simple.

    A few months ago I had logged into Windows as the user name "SQL" and had downloaded the AdventureWorks.MSI and run it. This created the AdventureWorks.mdf file.

    But the other day I was logged in as Windows user "MSS" when trying to attach the MDF. I would get the 5123 error message.

    After about an hourof Internet research and poking around with Windows Explorer I figured out that the Window User "SQL" and SYSTEM were the only two who had full permissions to the the mdf.

    So I logged out of "MSS" and then logged in as "SQL" and did the attach. It worked!! I was able to attach the AdventureWorks database and can now use it, whatever user I am logged in as.

  • As suggested earlier, it's probably another SQL Server instance, but if this continues to by a mystery, you can try using the Process Explorer utility to identify what process has the file open.

    http://technet.microsoft.com/en-us/sysinternals/bb896653

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho

Viewing 11 posts - 1 through 10 (of 10 total)

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