Is it possible to combine a "newer version" of the LDF file with an older version of the MDF file and keep changes logged in the LDF? Lets assume there has been no log-backups in the time between as I guess that would make this truly impossible.
Steps:
- Database in full recovery mode
- Take a full backup
- Make some changes
- Detach database
- Make a filecopy of the LDF-file
- Restore from full backup in step 2
- Detach database
- Make a filecopy of the MDF-file
- Throw away the backup (important step)
- Delete the database
- Somehow make the MDF and LDF play together with the change made in step 3 still in place.
Just attaching the MDF and LDF gives an error:
The log scan number (38:195:41) passed to log scan database 'mic' is not valid.
I also tried a sequence of
- Create database
- Take database offline
- Replace the MDF and LDF files
- Bring online
- Do a log backup
- Drop database
- Create database with attach MDF-file only
- Make full backup
- Restore full backup (norecovery)
- Restore log-backup from Step 5
I have a vivid memory that this worked just fine for a while but then it did not any more.
The log in this backup set terminates at LSN 38000000021300001, which is too early to apply to the database. A more recent log backup that includes LSN 39000000006500001 can be restored.