Do DDL statements roll back, and why?

Do DDL statements roll back, and why?

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?

    Requires Free Membership to View

    By submitting your registration information to SearchOracle.com you agree to receive email communications from TechTarget and TechTarget partners. We encourage you to read our Privacy Policy which contains important disclosures about how we collect and use your registration and other information. If you reside outside of the United States, by submitting this registration information you consent to having your personal data transferred to and processed in the United States. Your use of SearchOracle.com is governed by our Terms of Use. You may contact us at webmaster@TechTarget.com.

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.

This was first published in August 2008

Join the conversationComment

Share
Comments

    Results

    Contribute to the conversation

    All fields are required. Comments will appear at the bottom of the article.