﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Administering / SQL Server 2005  / Use mapped network drive for addfile command / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sun, 19 May 2013 11:10:23 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Use mapped network drive for addfile command</title><link>http://www.sqlservercentral.com/Forums/Topic1422256-146-1.aspx</link><description>AWESOME! Thanks!I had not been using xp_cmdshell to execute the net use command. I knew I was getting hung up in permissions but just didn't know where. Well, now I guess I will just really hope that a log shipping restore session won't break and all goes smoothly (save the time of re-doing log shipping). Have been testing on testing server and it's looking clean.[code]EXEC sp_configure 'xp_cmdshell', 1GORECONFIGUREGOexec master.dbo.xp_cmdshell 'NET USE.......[/code]</description><pubDate>Wed, 20 Feb 2013 13:34:42 GMT</pubDate><dc:creator>matt.newman</dc:creator></item><item><title>RE: Use mapped network drive for addfile command</title><link>http://www.sqlservercentral.com/Forums/Topic1422256-146-1.aspx</link><description>matt this worked 100% for me as an example; the difference here is I used the username parameters for the net use as a user that has permissions on the network;from there, i got an error on adding the filegroup, until i set the trace flag:[code]exec master.dbo.xp_cmdshell 'NET USE J: \\DEV223\c$\DataFiles /user:disney\lizaguirre NotTheRealPassword /persistent:yes'ALTER DATABASE [SandBox] ADD FILE ( NAME = N'TESTING', FILENAME = N'J:\TESTING_Archive.ndf' , SIZE = 3072KB , FILEGROWTH = 10%)/*Msg 5110, Level 16, State 2, Line 1The file "J:\TESTING_Archive.ndf" is on a network path that is not supported for database files.Msg 5009, Level 16, State 8, Line 1One or more files listed in the statement could not be found or could not be initialized.*/DBCC TraceON (1807)ALTER DATABASE [SandBox] ADD FILE ( NAME = N'TESTING', FILENAME = N'J:\TESTING_Archive.ndf' , SIZE = 3072KB , FILEGROWTH = 10%)/*Command(s) completed successfully.*/[/code]</description><pubDate>Wed, 20 Feb 2013 13:24:07 GMT</pubDate><dc:creator>Lowell</dc:creator></item><item><title>RE: Use mapped network drive for addfile command</title><link>http://www.sqlservercentral.com/Forums/Topic1422256-146-1.aspx</link><description>I had been using "NET USE j: \\SAMESERVER\C$\SQL\SQL_Data\J /persistent:yes", even to the point of running through a scheduled task in a batch script, as the service account. The service account is not logged onto the machine at any time.I was hoping the trace flag would work, but appears to not. Good information to note. Maybe playing with the trace flag at levels above session may give me a better start.I had been running [code]USE [master]GODBCC TraceON (1807)GOALTER DATABASE [DATABASE] ADD FILE ( NAME = N'TESTING', FILENAME = N'J:\TESTING_Archive.ndf' , SIZE = 3072000KB , FILEGROWTH = 10%) TO FILEGROUP [TestAnother]GO[/code]I had been getting the error of [code]Msg 5133, Level 16, State 1, Line 2Directory lookup for the file "J:\LIFT_Data_Archive.ndf" failed with the operating system error 3(The system cannot find the path specified.).Msg 5009, Level 16, State 8, Line 2One or more files listed in the statement could not be found or could not be initialized.[/code]</description><pubDate>Wed, 20 Feb 2013 13:13:04 GMT</pubDate><dc:creator>matt.newman</dc:creator></item><item><title>RE: Use mapped network drive for addfile command</title><link>http://www.sqlservercentral.com/Forums/Topic1422256-146-1.aspx</link><description>the command for mapping a drive is fairly straightforward:NET USE G: \\UNCPath\d$\ShareFolder /user:domain\username passwordafter that is done, i think you might also need to add the trace flag 1807 to allow the SQL instance to use network paths?</description><pubDate>Wed, 20 Feb 2013 13:05:28 GMT</pubDate><dc:creator>Lowell</dc:creator></item><item><title>Use mapped network drive for addfile command</title><link>http://www.sqlservercentral.com/Forums/Topic1422256-146-1.aspx</link><description>I have a production server with volume a and b. DR server has volume a, not b. I was hoping to be able to map a network drive to a as b.Possible?I need to add a filegroup and file to production but the dr server (LOG SHIPPING) will not have the volume available when the command passes through log shipping.</description><pubDate>Wed, 20 Feb 2013 12:50:47 GMT</pubDate><dc:creator>matt.newman</dc:creator></item></channel></rss>