1
votes

SQL Server 2012 instance is running on MyDatabaseServer. I failed to attach database when I attach database on another machine on the network.

  • If I login to MyMachine, open SSMS, connect to MyDatabaseServer\MyDB and run the following code, it FAILS.

  • If I login to MyDatabaseServer, open SSMS, connect to MyDatabaseServer\MyDB and run the following code, it WORKS.

I need it to run on another machine other than the DB server itself. What should I do???

Note 1: The code I ran:

CREATE DATABASE MyDatabase ON 
    ( FILENAME = N'\\MyFileserver\MyFolder\MyDatabase.MDF'),
    ( FILENAME = N'\\MyFileserver\MyFolder\MyDatabase_Log.LDF')
     FOR ATTACH 

It returns:

Unable to open the physical file "\MyFileserver\MyFolder\MyDatabase.MDF". Operating system error 5: "5(Access is denied.)".

Note 2: The account to run SSMS and the service account to run SQL Server both have full control permission to \\\\MyFileserver\\MyFolder\\ as well as MyDatabase.MDF

Note 3: I am able to connect to the DB MyDatabaseServer\MyDB on both machines SSMS.

Note 4: It is SQL Server 2012. MyDatabaseServer is a Windows Server 2012. MyMachine is Windows 7.

1
you can't attached the same set of files to 2 diff database server - Squirrel
There is only one sql server here. The difference is the machine I use to connect to the DB using ssms. May be I edit the question a bit. - Lai
it doesn't matter what machine you are running SSMS. Are you login to MyDatabaseServer\MyDB using the same login credential on both machine ? - Squirrel
It feels weird to me as well. I have logged in with the same credential. But it only works when runs on the DB server itself, failed when runs on any other machines. - Lai
Are you sure you have set the trace flag? - FLICKER

1 Answers

1
votes

SQL server database must be on the same machine as the server is installed