Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

SQL Server Error 1408: Remote Copy Fix Guide

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

SQL Server error 1408 ("The remote copy of database is not...") appears when you try to attach, restore, or run a database operation that references a database file on a network share or a path the SQL Server service account cannot properly reach. The full message usually reads "The remote copy of database 'name' is not the same as the local copy" or references a remote file that cannot be validated. The fix is almost always one of three things: the database files are on a UNC/network path that SQL Server cannot use reliably, the service account lacks permission to that path, or a stale database entry is pointing at a file that has moved. This guide walks through diagnosing which of those applies and correcting it, using only built-in SQL Server tools and Windows permissions.

What You'll Need

  • Administrative access to the SQL Server instance (a login in the sysadmin role) and to the Windows machine hosting it.
  • Access to SQL Server Management Studio (SSMS) or the sqlcmd command-line tool.
  • Permission to view and edit the SQL Server service account in Windows Services, or to ask whoever manages the server.
  • The physical location of the .mdf and .ldf files you are working with, and whether that location is a local drive or a network share.
  • A current backup of the database if it is still accessible, before you change any file paths.

Step-by-Step

  1. Read the full error text. Error 1408 is generic; the message after it tells you which file and which path SQL Server objects to. In SSMS, the message appears in the Messages tab of the query window. Note the exact database name and file path. If the message mentions a UNC path (\\server\share\...), that is the root of the problem in most cases.
  2. Confirm where the files actually are. On the SQL Server host, open File Explorer and check whether the path in the error exists locally. If the database was moved from another server, the files may still be on the old machine or on a share that is no longer mapped.
  3. Check the SQL Server service account. Open Windows Services (services.msc), find the SQL Server service (for example SQL Server (MSSQLSERVER) for a default instance), and look at the Log On As column. If it shows a built-in account such as NT Service\MSSQLSERVER or NT AUTHORITY\NETWORKSERVICE, that account has limited network access and cannot read files on a remote share by default. If it shows a domain account, note the name.
  4. Verify permissions on the file location. Right-click the folder holding the .mdf and .ldf files, choose Properties > Security, and confirm the service account (or a group it belongs to) has at least Read and Write. SQL Server needs write access to the folder, not just the files, because it creates and modifies log and temp files there.
  5. Move the files to a local path if they are on a share. SQL Server database files on network shares are not supported for normal user databases; the engine expects local or SAN-attached storage. Copy the .mdf and .ldf files to a local folder such as C:\SQLData, then update the database to point at the new location. The cleanest way is to detach and reattach: run sp_detach_db 'YourDatabase', then CREATE DATABASE YourDatabase ON (FILENAME = 'C:\SQLData\YourDatabase.mdf'), (FILENAME = 'C:\SQLData\YourDatabase_log.ldf') FOR ATTACH. Adjust names to match your files.
  6. If the database is already attached but pointing at a bad path, use ALTER DATABASE. Run ALTER DATABASE YourDatabase MODIFY FILE (NAME = YourDatabase, FILENAME = 'C:\SQLData\YourDatabase.mdf') and the same for the log file, then take the database offline and back online with ALTER DATABASE YourDatabase SET OFFLINE followed by ALTER DATABASE YourDatabase SET ONLINE. Moving files while the database is online will not work; the offline/online cycle makes SQL Server pick up the new path.
  7. Fix the service account if it cannot reach a legitimate local path. If the files are local but access is denied, either grant the existing service account rights to the folder or change the service account to a domain account that has them. Changing the service account requires a restart of the SQL Server service, which briefly disconnects users; plan for that.
  8. Clear stale entries. If you detached a database and the attach still fails with 1408, check sys.master_files and sys.databases for leftover rows referencing the old path. A detached database should leave no rows, but a failed attach can. Restarting the SQL Server service clears in-memory state; do this before reattempting the attach.
  9. Retry the operation and confirm. Run your original attach or restore statement again. On success, run DBCC CHECKDB ('YourDatabase') to confirm the files are consistent, and verify the database shows as online in Object Explorer.

Common Mistakes

  • Assuming the error means the database is corrupt. It almost always means a path or permission problem, not damaged pages.
  • Granting permissions on the files but not the containing folder. SQL Server needs folder-level write access.
  • Leaving the database online while editing file paths with ALTER DATABASE. The change is recorded but not applied until the database is cycled offline and online.
  • Using a mapped drive letter (Z:\...) for database files. Mapped drives are per-user and usually invisible to the service account; use a full local path or a supported volume.
  • Forgetting that the log file (.ldf) also needs moving and permissions, not just the .mdf.

Tips

  • Keep all database files for an instance under one or two well-known local folders so permission problems are easy to spot.
  • Record the service account name somewhere you can find it; it is the single most common cause of this error.
  • Test attach operations on a copy of the files first if the database matters. Attaching the wrong file version can leave you with a database you cannot open.
  • Use SELECT name, physical_name FROM sys.master_files to see exactly which paths SQL Server believes each file uses.

Troubleshooting

If the error persists after moving files locally and fixing permissions, check whether the SQL Server service is running under a different account than you expect, for example after a password change on a domain account. Look in Windows Event Viewer under Windows Logs > Application for SQL Server entries around the time of the failure; they often name the exact file and the access denial. If you are restoring rather than attaching, confirm the backup file itself is readable by the service account and is not on a network share either. If the database will not come online after a path change, check that no other instance or process holds a lock on the files, and that the file names in your ALTER DATABASE statement match the logical names in sys.master_files exactly. As a last resort, detach the database, move the files manually with File Explorer, and reattach using the new paths; this avoids any confusion about which statement applied.

Frequently Asked Questions

Does error 1408 mean my database is corrupted?

No. It is a file location or permission error. Corruption produces different messages, usually from DBCC CHECKDB.

Can I store SQL Server database files on a network share?

Not for normal user databases. SQL Server expects local or SAN-attached storage; network shares are only supported in specific configurations such as failover cluster instances with the right setup.

Why does the error mention a "remote copy" if the files are local?

The message wording is generic. It appears whenever SQL Server cannot validate the file at the path it has recorded, which includes local paths the service account cannot read.

Do I need to restart SQL Server after fixing permissions?

Usually not for folder permissions, since they apply immediately. Restarting is needed if you changed the service account or want to clear stale in-memory state after a failed attach.

Can I fix this without detaching the database?

Yes, if the database is online: use ALTER DATABASE MODIFY FILE to change the path, then cycle the database offline and online. Detaching is simpler when the database is already inaccessible.

Will fixing this lose data?

Moving files and reattaching does not change the data. Always take a backup first if the database is still accessible, because a failed attach on mismatched files can leave you unable to open it.