DISCLAIMER
Please be advised that these steps are by no way complete and do not guarantee a restore of your database and/or data. Please use them as a guideline in your specific situation and be aware that a multitude of unknown causes, could result in complete data loss.
Step 1.) and Step 2.) can be used in any situation
Further additional steps may be required to bring your data back.
Welcome to DBA.SE. Sorry to hear you're having a bad time.
Handling Your Current Situation
If FULL Recovery model is enabled for this database do the following:
Stop all transactions/connections to the database. NOW !!
Think about your next steps.
Take the database OFFLINE and make a copy of the *.MDF and *.LDF files.
Bring the database back ONLINE.
Perform a Transaction Log Backup (TLOG backup) with the option WITH ... NO_TRUNCATE ...
. This ensure the data isn't deleted from the TLOG.
This step will only work if the database has previously been backed up with a FULL backup
Restore database to point-in-time on a different database server using the initial FULL backup (before step 1.) and TLOG backup from the second step. The time should be before the accident happened.
Search for the modified data.
Extract data.
Import data into production server after confirming it is correct.
Bring production back online.
If you didn't have the database in FULL recovery model, then changing it now will have no impact. You won't be able to rescue the data, because it probably has already been committed to the database and is no longer available in the TLOG file. If no initial FULL backup has been performed, then these steps won't work.
Cleaning Up
- Talk to management about what happened.
- Implement a Change Management process.
- Implement a solid backup procedure for your database systems.
DBA Tips
Here a couple of basic tips:
- Always think about your next steps.
- Ensure you have a backup, before you modify data.
- If the data is important/productive, ensure you have
FULL
recovery model enabled and Transaction Log backup is being performed.
- Only change data in a productive environment after management has told you to do so and if you have an official Change Request that has been signed off.
- Never touch productive data manually, unless it is during a down-time and you have met the requirements for 1. and 2. and 3.
SIMPLE
recovery mode while running the badUPDATE
?FULL
recovery mode while the mistake was happened.