Tags: create, database, detached, error, file, folder, microsoft, moved, mysql, oracle, server, sql, tore-attach

Error 5123

On Database » Microsoft SQL Server

3,009 words with 2 Comments; publish: Fri, 06 Jun 2008 13:38:00 GMT; (25062.50, « »)

I detached a database and moved it to another folder. I am trying to

re-attach the database and am getting 'Error 5123: CREATE FILE encountered

operating system error 32(The process cannot access the file because it is

being used by another process.) while attempting to open or create the

physical file...

Is there a file configuration setting I can change to eliminate this error

message? I've done this many times without problem and had no indication of

any process using this database when I detached it. Any helpful suggestions

to be able to attach this database will be appreciated. Thank you.

Dan

All Comments

Leave a comment...

  • 2 Comments
    • Hi,

      It can be our Backup process or Virus software accessing the file. Please

      verify.

      Thanks

      Hari

      SQL Server MVP

      "Dan Slaby" <dls.sqlserver.itags.org.newsgroup.nospam> wrote in message

      news:OKxEEK$jFHA.3960.sqlserver.itags.org.TK2MSFTNGP12.phx.gbl...

      >I detached a database and moved it to another folder. I am trying to

      >re-attach the database and am getting 'Error 5123: CREATE FILE encountered

      >operating system error 32(The process cannot access the file because it is

      >being used by another process.) while attempting to open or create the

      >physical file...

      > Is there a file configuration setting I can change to eliminate this error

      > message? I've done this many times without problem and had no indication

      > of any process using this database when I detached it. Any helpful

      > suggestions to be able to attach this database will be appreciated. Thank

      > you.

      > Dan

      >

      #1; Fri, 06 Jun 2008 13:39:00 GMT
    • Dan,

      I am having the exact same problem. I loaded a utility from

      www.sysinternals.com that told me that it is indeed the SQL Server process

      locking the .mdf file. I, however, have been unable to correct the problem.

      I'm thinking about stopping the SQL Server, renaming the .mdf files,

      restarting the server, then attaching the DBs.

      I believe I locked the DB file accidentally before I detached by issuing a

      DBCC OpenTran(<DBName>). Now I can't reattach because of the file lock.

      Leslie

      "Dan Slaby" wrote:

      > I detached a database and moved it to another folder. I am trying to

      > re-attach the database and am getting 'Error 5123: CREATE FILE encountered

      > operating system error 32(The process cannot access the file because it is

      > being used by another process.) while attempting to open or create the

      > physical file...

      > Is there a file configuration setting I can change to eliminate this error

      > message? I've done this many times without problem and had no indication of

      > any process using this database when I detached it. Any helpful suggestions

      > to be able to attach this database will be appreciated. Thank you.

      > Dan

      >

      >

      #2; Fri, 06 Jun 2008 13:40:00 GMT