Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sql server log file stores the every log in information.is it possible to revert the query operation which we doing through query editor or by application based on the session we are logged in?

Thanks in Advance

share|improve this question

migrated from stackoverflow.com Oct 18 '12 at 11:50

This question came from our site for professional and enthusiast programmers.

    
Why not simply rollback your transaction? –  a_horse_with_no_name Oct 18 '12 at 6:24
    
its a time consuming process. –  parthasarathy Oct 18 '12 at 6:36
    
And you think digging through binary logfiles to undo a transaction will be faster? –  a_horse_with_no_name Oct 18 '12 at 7:00

1 Answer 1

If you are using transactions, you can rollback your transaction.

If you are looking to restore your database, the answer is no. Providing that you are in Full Recovery model and have log backups, you can restore to a point in time, such as LSN, Time or Marked Transaction, but you cannot roll forward your restore on a session by session basis as this could leave the database in an inconsistent state.

Imagine your session deleted some rows from a table...What if another session had created those rows and you did not roll forward the other session? It just wouldnt work.

You could consider using Database Snapshots moving forward. This will give you a point-in-time copy of the database which you can use to "undo" data modifications. For example if your session deleted some rows, you could do an INSERT into your database, SELECT from snapshot

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.