Solved

Attach a database SQL from network drive??

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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
How to leverage one TLS certificate to encrypt Microsoft SQL traffic and Remote Desktop Services, versus creating multiple tickets for the same server.
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 …

627 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