I executed a simple SQL performance query to retrieve the sessions running currently in the database in Oracle sql developer. But accidentally my cursor clicked on the roll back icon and it got rolled back. Could you please tell me What happens to the entire database after this?
2 Answers
Rolling back a select does nothing as long as you didn't make changes to the database without committing the transaction.
In oracle clients when you run a query that modifies the database, the query is first run. Another step is then needed to commit the transaction.
MS SQL Server has a similar concept where you can do safe transactions like
begin tran
delete from table where val > 5
rollback{commit}
This allows you to look at the number of records your SQL statement have done prior to committing the transaction. If you want you can choose to rollback or commit your transaction.

- 46
- 6
What exactly did you roll back? That "simple SQL performance query", or "sessions running currently in the database in Oracle SQL Developer"?
If former, nothing happened, SELECT
didn't do any changes anyway. If it were SELECT ... FOR UPDATE
, lock would have been released.
If latter, then any changes you did in the database since previous COMMIT
were rolled back (as you didn't roll back to a savepoint), so - nothing happened either.
What happens to the entire database after this?
It returned to state it was in earlier, as if you didn't touch anything at all.

- 131,892
- 15
- 35
- 57