Reputation: 2044
I have a .mdf
file stored in local.
I work remotely on server through ssms. I am in need to restore the .mdf
file. Is it possible to attach such file to remotely working server?
Upvotes: 0
Views: 1816
Reputation: 155698
Yes and no. It depends on your SKU (ironically, more expensive versions are less capable).
CREATE DATABASE
with the DB path specified as a network share, which means:
CREATE DATABASE
permission on the server (e.g. be an administrator or be assigned that right).AttachDbFilename
option is not supported by SQL Server Standard or Enterprise, only Express.CREATE DATABASE
command as Standard Edition.AttachDbFilename
this only works for local files, you cannot specify a UNC share: https://social.msdn.microsoft.com/Forums/en-US/a5adeef5-93e5-409c-b476-238e2f6dfcd2/how-to-connect-database-from-shared-drive-in-c?forum=csharplanguageSo your only option for mounting an *.mdf
remotely is to use a network share and to attach it using CREATE DATABASE
, you cannot use AttachDbFilename
.
Note that performance will be poor because SQL Server can't use the magic tricks it uses to obtain low-level disk access for faster IO.
https://www.brentozar.com/archive/2012/01/sql-server-databases-on-network-shares-nas/
Upvotes: 1
Reputation: 43
No, using ssms it is not possible.Either you can generate database scripts or upload the .mdf file on the remote db using your hosting admin panel and restore from there.
Upvotes: 0