1

I accidentally restored an SQL Server database from the wrong backup using the following statement:

RESTORE DATABASE  [" + conn.Database + "] FROM DISK='" + path_backup + "'"

This is the exact query I used. I'm not an expert, so I don't really know why this worked, but it actually did.

I did not use REPLACE. Is there any way that I can rollback to previous state of the database? I've read that REPLACE overwrites the database, does this mean that if I don't use it, there is a copy somewhere?

3

The short answer is "No".

If you have restored from backup then you have overwritten your database.

The only way to get your database back is to restore from a suitable backup.

If your database is in full recovery mode and you have the last full backup and subsequent transaction logs you may be able to do a point in time recovery to a point more acceptable than when the last full backup was taken.

The REPLACE option is just a safeguard against accidentally overwriting the existing database with a backup taken from a different database. The restore will not be allowed in that case otherwise.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.