Solved

Attach a database SQL from network drive??

Posted on 2013-06-28
5
672 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
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 69

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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
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 …

809 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