Solved

Attach a database SQL from network drive??

Posted on 2013-06-28
5
626 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 68

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

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…
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
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 …

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now