<p>How do you restore a database backup using SQL Server 2005 over the network? I recall doing this before but there was something odd about the way you had to do it.</p>

[{'answer_id': 16502, 'author': 'Curt Hagenlocher', 'author_id': 533, 'author_profile': 'https://Stackoverflow.com/users/533', 'pm_score': 6, 'selected': True, 'text': "<p>The database is often running as a service under an account with no network access.  If this is the case, then you wouldn't be able to restore directly over the network.  Either the backup needs to be copied to the local machine or the database service needs to run as a user with the proper network access.</p>\n"}, {'answer_id': 16670, 'author': 'Brian G Swanson', 'author_id': 1795, 'author_profile': 'https://Stackoverflow.com/users/1795', 'pm_score': 0, 'selected': False, 'text': "<p>I've had to do this a few times, and there are only two options that I know of.  Copy the file locally to the SQL Server, or on the SQL server create a mapped network drive to the share that contains the backup file.</p>\n"}, {'answer_id': 39470, 'author': 'baldy', 'author_id': 2012, 'author_profile': 'https://Stackoverflow.com/users/2012', 'pm_score': 3, 'selected': False, 'text': "<p>You cannot do this through the SSMS GUI, but you can do it using a script.  RESTORE DATABASE  from DISK='\\unc\\path\\filename'  If you need this process automated, the best way is to setup a SQL Server Job and run it as a user with access to the file location.</p>\n"}, {'answer_id': 50985, 'author': 'Daniel O', 'author_id': 697, 'author_profile': 'https://Stackoverflow.com/users/697', 'pm_score': 0, 'selected': False, 'text': "<p>Also, you need to make sure that the SQL Server Service is running as a user that has network access - and permissions to the share where the backup file lives. 'Local System' won't have permissions to access the network.</p>\n"}, {'answer_id': 10236311, 'author': 'RSOLY777', 'author_id': 1345056, 'author_profile': 'https://Stackoverflow.com/users/1345056', 'pm_score': 3, 'selected': False, 'text': '<p>Make sure that the user running your <code>SQL services</code> in <code>"Services.msc"</code> is an active directory <code>"Domain User"</code> this will fix the issue.</p>\n'}, {'answer_id': 14388111, 'author': 'Brian Miller', 'author_id': 1988552, 'author_profile': 'https://Stackoverflow.com/users/1988552', 'pm_score': 0, 'selected': False, 'text': "<p>As a side note, if you happen to be running SQL on a Virtual Machine it's often less hassle to just temporarily set up a new drive on the VM with enough space to copy your backup files to, do the restore from that new local copy, and then delete the temp drive.</p>\n\n<p>This can be useful if stopping/starting the SQL service to change it's account is an issue.</p>\n"}, {'answer_id': 14894743, 'author': 'coussej', 'author_id': 1682515, 'author_profile': 'https://Stackoverflow.com/users/1682515', 'pm_score': 3, 'selected': False, 'text': '<p>You can use the SP xp_cmdshell to map the networkdrive for sql server, after that it will show up in the file browsing window.</p>\n\n<pre><code>EXEC xp_cmdshell \'NET USE Z: SERVERLOCATION PASSWORD /USER:DOMAIN\\USERNAME\'\n</code></pre>\n\n<p>more info here: <a href="http://sqlservernet.blogspot.de/2012/03/db-restore-from-network-drive.html" rel="noreferrer">DB Restore from Network Drive</a></p>\n\n<p>Worked for me!</p>\n'}, {'answer_id': 20465401, 'author': 'TPAKTOPA', 'author_id': 3081808, 'author_profile': 'https://Stackoverflow.com/users/3081808', 'pm_score': 6, 'selected': False, 'text': '<p>You have few options to use a network file as a backup source</p>\n\n<ol>\n<li>Map network drive/path, hosting file, under SAME user as MS-SQL Server.</li>\n<li>Use xp_cmdshell extended stored procedure to map network drive from inside of MS SQL (such way, command shell will have the same privilegies as the user account running SSMS)</li>\n</ol>\n\n<pre class="lang-sql prettyprint-override"><code>-- allow changes to advanced options \nEXEC sp_configure \'show advanced options\', 1\nGO\n-- Update currently configured values for advanced options.\nRECONFIGURE\nGO\n-- To enable xp_cmdshell\nEXEC sp_configure \'xp_cmdshell\', 1\nGO\n-- Update currently configured values for advanced options.\nRECONFIGURE\nGO\nEXEC xp_cmdshell \'NET USE Z: \\\\Srv\\Path password1 /USER:Domain\\UserName\'\n</code></pre>\n\n<p>Afterwards drive Z: will be visible in Server Managment studio, or just\n</p>\n\n<pre><code>RESTORE DATABASE DataBaseNameHere FROM DISK = \'Z:\\BackNameHere.BAK\'\nGO\n</code></pre>\n'}, {'answer_id': 29854778, 'author': 'Kelly', 'author_id': 4829838, 'author_profile': 'https://Stackoverflow.com/users/4829838', 'pm_score': 0, 'selected': False, 'text': '<p>Create a shared drive on machine that has the backups, say server1 has the backups in folder "Backups". Grant full control to the account running the SQL Server. On the Server that you want to restore to launch SSMS go restore database and select "From Device". In the "Locate Backup file-"Server"" dialog box and remove anything in the "Selected Path" field and in the "File Name" field supply full path so "\\server\\backups\\db.bak". At least it worked for me when migrating from 05 to 08. Not the preferred method because any network hiccup can cause an issue with the restore.</p>\n'}, {'answer_id': 54476762, 'author': 'Muhammad Adil Jamil', 'author_id': 2384589, 'author_profile': 'https://Stackoverflow.com/users/2384589', 'pm_score': -1, 'selected': False, 'text': "<pre><code>EXEC sp_configure 'show advanced options', 1\nGO\n</code></pre>\n\n<p>-- Update currently configured values for advanced options.</p>\n\n<pre><code>RECONFIGURE\nGO\n-- To enable xp_cmdshell\nEXEC sp_configure 'xp_cmdshell', 1\nGO\n</code></pre>\n\n<p>-- Update currently configured values for advanced options.</p>\n\n<pre><code>RECONFIGURE\nGO\n</code></pre>\n\n<p>--This should be run on command prompt (cmd)</p>\n\n<pre><code>NET USE Z: \\\\172.100.1.100\\Shared Password /USER:administrator /Persistent:no\n</code></pre>\n\n<p>then on SQL Server</p>\n\n<pre><code>EXEC xp_cmdshell 'NET USE Z: \\\\172.100.1.100\\Shared Password /USER:administrator /Persistent:no'\n</code></pre>\n\n<p>--Afterwards drive Z: will be visible in Server Management studio, or just</p>\n\n<pre><code>RESTORE DATABASE DB FROM DISK = 'Z:\\DB.BAK'\nWITH REPLACE\n</code></pre>\n"}]
['https://Stackoverflow.com/questions/16491', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1545/']