Technical FAQs

Ask a Question

How to backup SQL Server databases to a mapped drive

When executing a backup on a SQL Server database where the resulting backup file is directed onto a mapped drive you receive the following error message:
"The system cannot find the path specified."

Product Line
Struxureware Power Monitoring
Power Monitoring Expert
ION Enterprise

SQL Server 2005, SQL Server 2008 R2, SQL Server 2012, SQL Server 2014

A network share that is mapped using a local drive letter will not be visible to a SQL Server instance as it is running as a service.
The SQL Server service runs in the environment of the local console with the security of the startup account of SQL Server applied.
Mapped drives are specific to a session and not visible to a service started on the local console.

To backup a SQL Server database to a mapped drive using a local drive letter:

1. Run the following command from a query window  EXEC xp_cmdshell 'net use <drivename> <share name>'
Where:  <drive name>: Letter used to map the drive
               <share name>: UNC path to the share

2. You should be able to backup using the mapped drive letter, as the Management Studio Object Explorer drive window should now list the above mapped drive

A drawback of this resolution is that once the SQL Server service is restarted, the mapped drive will no longer be visible as it will become unmapped.
If you want to retain the mapped drive information then you need to create a startup procedure for executing the script in Step 1.
One simple method would be to create a backup device using the UNC path of the remote share that you would like to take the database backups on.
It is important to keep in mind that the SQL Server startup account needs to have full permissions on the remote share.

Was this helpful?
What can we do to improve the information ?