Rollback statement Oracle

36 views Asked by At

I'm new to dba in oracle. Im just learning about rollback segment. I have a few questions about it, it'll be great if i can find some help here.

1- after issuing a dml statement, does the most valid data exists in redo log files or rollback statement?

2- is the rollback statement ever used in a ddl statement?


1

There are 1 answers

0
Connor McDonald On

You can (loosely) think of redo and undo as instructions.

For example, you drove from home to the shop. That is a change in your "state", ie, 20 mins ago you were at home, now you are at the shop.

The redo information would be:

  • grab the keys
  • start the car
  • drive down Main st
  • turn left into North ave
  • turn right into parking lot
  • park car

It is a list of instructions that would let you (aka the database) repeat a task (for example, during a database recovery).

The undo information is not about remembering your previous state (you were at home), but more a set of instructions on how to return to a previous state. In this case it would be:

  • get back in the car
  • head out of the parking lot
  • turn right into North St
  • head back down Main st
  • pull into the driveway
  • get out of the car
  • chill out on the couch

This information is stored in the undo (or rollback) segments in the database.

A video walk through of the process is at

https://youtu.be/lmrWmH1vMPc?t=66