// SQL Server error reference

SQL Server error 3013: BACKUP or RESTORE ended abnormally

A BACKUP or RESTORE failed. 3013 is the closing message; the error printed just before it says why (file access, wrong backup set, space).

Error number
3013
Severity
16
Category
Backup and restore
Error message
%hs is terminating abnormally.

What it means

SQL Server ends every failed backup or restore with 3013 (BACKUP DATABASE is terminating abnormally or RESTORE DATABASE is terminating abnormally). It is a summary, not a cause. Look at the message immediately before it, such as 3201 (can't open the backup device), 3154 (backup is of a different database), 5120 (can't open a physical file) or an operating system error.

Common causes

  • The SQL Server service account can't read or write the backup path (error 3201, operating system error 5).
  • Restoring over an existing database from a backup of a different one without REPLACE (error 3154).
  • Data or log file paths in the backup don't exist on this server and MOVE wasn't used.
  • Not enough disk space for the backup or the restored files.
  • A damaged or incomplete backup file, or a backup from a newer SQL Server version than the target.

How to fix it

  1. Read the error before 3013 and look it up; that is the real problem.

  2. Verify the backup file and see what's in it.

    RESTORE VERIFYONLY FROM DISK = N'D:\Backup\SalesDb.bak';
    RESTORE HEADERONLY FROM DISK = N'D:\Backup\SalesDb.bak';
    RESTORE FILELISTONLY FROM DISK = N'D:\Backup\SalesDb.bak';
  3. Restore with MOVE to paths that exist on this server.

    RESTORE DATABASE SalesDb FROM DISK = N'D:\Backup\SalesDb.bak'
    WITH MOVE N'SalesDb' TO N'D:\Data\SalesDb.mdf',
         MOVE N'SalesDb_log' TO N'D:\Data\SalesDb_log.ldf',
         STATS = 10;
  4. Give the SQL Server service account permission on the backup folder, not just your own Windows account.

Related errors

The code and message text are from the Microsoft Database Engine events and errors reference. Browse the full SQL Server error list or search every database error.

// fewer errors, faster fixes

Work on SQL Server in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for SQL Server and the other databases you use.