Solved

Attach a database SQL from network drive??

Posted on 2013-06-28
5
737 Views
Last Modified: 2013-06-28
I have a database that mdf, ldf files that are not on the local machine but on a network drive such as X. When I try to attach the databases to the server I am only seeing the local drives C and D.

Is it possible to attach a database from another network drive or does it have to reside locally?
0
Comment
Question by:Jordan_WM
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 11

Accepted Solution

by:
Louis01 earned 300 total points
ID: 39284403
SSMS would not allow you through the normal attach menu option.
You'll need to script it. Something like:

USE master;
GO
CREATE DATABASE MyAdventureWorks 
    ON (FILENAME = 'C:\MySQLServer\AdventureWorks2012_Data.mdf'),
    (FILENAME = 'C:\MySQLServer\AdventureWorks2012_Log.ldf')
    FOR ATTACH;
GO

Open in new window


http://technet.microsoft.com/en-us/library/ms187858.aspx
http://blogs.msdn.com/b/varund/archive/2010/09/02/create-a-sql-server-database-on-a-network-shared-drive.aspx

Some say you shouldn't...
http://sqlrecoverydatabase.blogspot.com/2010/03/storing-sql-server-database-on-network.html?m=1
0
 
LVL 16

Expert Comment

by:EvilPostIt
ID: 39284405
Take a look at this article by Brent Ozar.
0
 

Author Closing Comment

by:Jordan_WM
ID: 39284426
Thanks for the post that was exactly what I am looking for, I needed to move the DB because I am limited to size where the instance of SQL server is running.
0
 
LVL 16

Expert Comment

by:EvilPostIt
ID: 39284499
0
 
LVL 70

Expert Comment

by:Qlemo
ID: 39284774
Warning! You should do that only for emergency or short-term operation! At least the transaction log should always be local, the data files might then be located on a network share - again, never in a production env!
The reason is that network I/O is unreliable, and doesn't allow for the necessary force-write commands to make write operations safe.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This collection of functions covers all the normal rounding methods of just about any numeric value.
Viewers will learn the different options available in the Backstage view in Excel 2013.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question