Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 How to attached sql database file stored at networ

Author  Topic 

marlon_ric
Starting Member

4 Posts

Posted - 2008-10-08 : 23:58:46
Hi!, I am currently having problem attaching an SQL database from a network storage device and I am receiving error message 5123. The network directory where the mdf file is located is visible from my computer and that i can create or delete any file on that directory. I am using SQL authentication on my Sql Database and also local authentication on our NAS. Thank you very much for any help you will suggest.

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-09 : 08:23:14
Why don't you copy that MDf file to local server and attach?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-10-09 : 08:42:16
Or you can use mounting points with sql server 2005.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

lepeniotis
Yak Posting Veteran

75 Posts

Posted - 2008-10-09 : 11:00:09
If there is a possibility that when you try to copy the mdf file to your computer it says that this file is used by an other application stop (if this possible) the service of SQL Server by administrative tools services. But as sodeep suggested just paste it to your machine. Its the easiest way!!!

MSc Advanced Computing Science
MSc Database Professional
Sheffield Hallam University
MCP (70-229, 70-228)
Industrial IT Engineer
Go to Top of Page

marlon_ric
Starting Member

4 Posts

Posted - 2008-10-10 : 03:17:00
Thanks for your replies guys, initially that mdf file was stored in the local sql server machine and it worked well until its size grew pass 200GB, this is why we bought a 4TB network attached storage to which we are now trying to move it. I am able to map the public share directory but the SQL seem not to recognized it.
Go to Top of Page

SimpleSQL
Yak Posting Veteran

85 Posts

Posted - 2008-10-10 : 12:40:18
Does SQL startup account has full access to this network share? Also is SQL startup account has read/write permission on this MDF file?

Hope this helps.
Go to Top of Page

marlon_ric
Starting Member

4 Posts

Posted - 2008-10-10 : 18:33:16
Hi! SimpleSQL, thanks for your suggestion. I try to use windows authentication on both SQL 2005 Server and NAS, having the active directory manager of our Primary Domain Server manage the user logins. I logged on as domain administrator on the SQL server and give it a Read/Write access to the shared directory of the NAS where the mdf file is located,I thought this will eliminate the problem on access rights. After I mapped the directory, I can then read and modify any file in that location, but still it does not work with the SQL server when I tried to attached the mdf using the mapped drive, it indicate an error that said mapped drive cannot be found, when I use the UNC path the error becomes Access Denied, despite restarting the SQL service with -t 1807 parameter.
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-10 : 20:06:51
1)First of all, Did you figure out why your databases have grown huge? Is it Log file or MDF file?

2) It is not good idea to have mdf and ldf files on network drive as network problem will cause your database Unaccessible

3) Even you run on domain account, I think you can't have Database files on network drive.
Go to Top of Page

SimpleSQL
Yak Posting Veteran

85 Posts

Posted - 2008-10-11 : 02:44:12
Try this.
Instead of trying to attach the database Create it as follows

dbcc traceon (1807, -1)
GO
Create database Pubs ON
(FileName = N'\\<UNC Path>\pubs.mdf'),
(FileName = N'\\<UNC Path>\pubs_log.ldf')
for attach
GO

Agree with Sodeep, it is not good idea to have DB on network drive (can cause lot of issues, also not supported)
Go to Top of Page

sodeep
Master Smack Fu Yak Hacker

7174 Posts

Posted - 2008-10-11 : 09:50:31
quote:
Originally posted by SimpleSQL

Try this.
Instead of trying to attach the database Create it as follows

dbcc traceon (1807, -1)
GO
Create database Pubs ON
(FileName = N'\\<UNC Path>\pubs.mdf'),
(FileName = N'\\<UNC Path>\pubs_log.ldf')
for attach
GO
Agree with Sodeep, it is not good idea to have DB on network drive (can cause lot of issues, also not supported)




It will be same issue.
Go to Top of Page

SimpleSQL
Yak Posting Veteran

85 Posts

Posted - 2008-10-11 : 11:14:11
This should work.
Go to Top of Page

marlon_ric
Starting Member

4 Posts

Posted - 2008-10-12 : 19:07:48
Hi guys! Thanks again for your replies! Our database is growing fast because we are storing image files. We managed to attached it the mdf files using the script SimpleSQL had posted, but only after we used the Domain Administrator account as the login account to start the service of the SQL server. We go to the SQL Server Configuration Manager and from there we change the built in logon account with the Domain administrator account. This solves the problem. Thank you very much for the suggestions you have given me!!!
Go to Top of Page
   

- Advertisement -