SQL SERVER 2005

Merie jourie 1 Reputation point
2022-04-21T11:56:36.077+00:00

Salam alaikom

I copied the two files of a database sql server 2005 .ldf and .mdf from a server and paste in another server and after I attached to the database and here is the error which is displayed:

TITLE: Microsoft SQL Server Management Studio


Failed to retrieve data for this request. (Microsoft.SqlServer.SmoEnum)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&LinkId=20476


ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)


CREATE FILE encountered operating system error 32(error not found) while attempting to open or create the physical file 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data\syngeb.mdf'. (Microsoft SQL Server, Error: 5123)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=5123&LinkId=20476


BUTTONS:

OK


Thanks for your help

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,361 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Erland Sommarskog 107.1K Reputation points
    2022-04-21T21:49:13.587+00:00

    NET HELPMSG 32 tells us: The process cannot access the file because it is being used by another process.

    I'm not sure that I follow your description entirely, but it seems likely are trying to have the database attached to two different instances at the same time, which of course is not possible.

    1 person found this answer helpful.

  2. Ronen Ariely 15,186 Reputation points
    2022-04-21T12:29:08.397+00:00

    Hi,

    I copied the two files of a database sql server 2005

    (1) Do you mean that the source server was version 2005 or the destination server or both?

    Make sure that you use the same version of source and destination servers.

    CREATE FILE encountered operating system error 32(error not found) while attempting to open or create the physical file 'C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data\syngeb.mdf'. (Microsoft SQL Server, Error: 5123)

    (2) Make sure that you do the task using the administrator of the OS to open the SSMS (so you will have permissions to the files) and confirm that you put the files in the Data folder of the new server and not the for example a Data folder of a different instance (This will confirm that the SQL Server service account has the permission on folders where mdf and ldf files reside).

    You can check where the data files of the system databases for example and try to put your files in the same location.

    (3) If this did not solve your issue then please provide the exact query which you use for the action

    0 comments No comments

  3. YufeiShao-msft 7,091 Reputation points
    2022-04-22T06:49:20.95+00:00

    Hi @Merie jourie ,

    What is the version of the SQL Server in your another server?
    You need to make sure the version of SQL Server instance that you want to attach the database to
    Make sure that the database files that you are trying to attach(restore) to your SQL Server instance is not being used by another SQL Server instance

    Try to:
    go to start->run->Services.msc
    look for SQL Server(SQLEXPRESS) service and stop it
    start it again
    try connecting your database

    Check out this similar thread:
    https://social.msdn.microsoft.com/Forums/office/en-US/5b245db8-51f6-4dba-9bec-95160df1f102/unable-to-open-the-physical-file-mdf-operating-system-error-32-error-not-found
    https://itectec.com/database/sql-server-create-file-encountered-operating-system-error-32-when-attempting-to-attach-database/

    -------------

    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.