-5

I have 2 databases: A and B.

I want to replace B with a copy of A. To do that I followed following steps:

  1. Backup A
  2. Delete B (optional)
  3. Restore backup with destination name as B

Step 3 fails because the source db (A) is not in single user mode.

What is the purpose that the restore operation tries to take tail log backup of source database? I know that this activity can be bypassed is options->tail-log backup. But my question is - what purpose does a tail log backup of source db serve to this restore operation?

Step 3 fails because db A (source db) is not in single user mode due to which tail log backup cannot be taken. My question is why does it even bother to take a tail log backup?

Assuming I have a backup file from last month that I want to restore as a new database, then why does it try to take a tail log backup of the source db?

variable
  • 3,591
  • 3
  • 28
  • 81
  • 2
    In what way does Step 3 fail? Can you share the error message, and the SQL Statement you're using for backup? If you're using the SSMS GUI to do the restore, you can use the Script button to generate the statements based on the options you select when performing the RESTORE DATABASE – AMtwo Jun 28 '22 at 14:34
  • Step 3 fails because db A (source db) is not in single user mode due to which tail log backup cannot be taken. My question is why does it even bother to take a tail log backup? – variable Jun 29 '22 at 04:17
  • It doesn't require a tail log. I'm asking for detail in what you're doing because the results don't make any sense to me. – AMtwo Jun 29 '22 at 12:17

1 Answers1

2

The purpose of a tail log backup is to ensure that no transactions are written to the database after the backup is taken.

David Browne - Microsoft
  • 46,306
  • 3
  • 46
  • 96
  • Ex : If you wanted to migrate the DB "a" from server 1 to server 2 and make sure there will be no data loss in the process, taking a tail of the log of DB "a" on server 1 will make the database "unavailable" to accept any new data, making sure that the restored database on server 2 will be exactly the same as the DB on server 1 – Dominique Boucher Jun 28 '22 at 17:11
  • Assuming I have a backup file from 26th June 2022. Suppose I restore it today then why would it try to take a tail log backup? – variable Jun 29 '22 at 04:15