Do DDL statements roll back, and why?

An Oracle user asks if DDL statements roll back and why they would not be written to roll back segments. Read the answer here.

I have three questions:

1. Why would DDL statements not roll back?

2. Why would DDL statements not be written to roll back segments?

3. Why can DDL statement roll back?

Question 1 and 3 are the same question. And the question is incorrect in its assumption. DDL statements do roll back. If the DDL statement hits an error before it completes, the operation will be rolled back. But if the DDL statement was successful, it will immediately be followed by an implicit COMMIT. Since the COMMIT was issued for you, you cannot issue a ROLLBACK to undo the DDL statement. By the nature of these operations, you cannot roll back past a COMMIT.

DDL statements used to not be written to rollback segments. But many DDL statements modify the Data Dictionary. And the modifications of the Data Dictionary are written to the roll back segments (or Undo tablespace). These modifications are also written to the online redo logs. If I recall correctly, more and more DDL statements are being written to the online redo logs to aid in recovery efforts.

Dig Deeper on Oracle database administration