Hi Krish,
- There is a little more to a DDL statement than simple DML against
the data dictionary. The complications are largely due to the fact
that rows from the data dictionary are cached in the SGA (rowcache).
The required modifications are made in rowcache and then flushed to
disk. Locks are held on the modification, prior to the flush. Should
the process fail, but not the instance, PMON will immediately clean up
the rowcache locks and roll backs the modifications. I think this is
driven from the session allocation structure, rather than a rollback
segment. When all the modification for a particular DDL statement have
been made in the rowcache, the affected caches are flushed. I believe
that this does generate redo and undo in the normal way, and if the
process or instance fails at this point, rollback will occur in the
normal way too.
- DDL statements need to be executed in a recursive transaction (and
session for that matter) to ensure the special semantics with respect
to the rowcache discussed above, and because the changes need to be
made as SYS. The automatic commit is a side effect of these
requirement. Incidentally, this is why you need to be very careful
when updating the data dictionary directly. Rowcache flushes and
refreshes can overwite your changes in one or other location, and so
you might leave the data dictionary in an inconsistent state with
respect to either itself or the rowcache, or both. This can be very
confusing and even jolly dangerous, so while its fun to know and
understand, think twice before you play.
Regards,
Steve Adams
steveadams_at_acslink.net.au
On Tue, 03 Feb 1998 01:11:06 -0600, tkrishna_at_baan.com wrote:
> Please help me in understanding the DDLs better :
>
> (1) Are Rollback Segments allocated to DDLs ? If not then how to
>explain the following situation :
>
> " DDLs as I understand are just DMLs on the dictionary tables. Hence
>a CREATE TABLE statement would basically insert & update many rows into
>the DD tables. Suppose a create table statement aborts in the middle ,
>what is the status of the DMLs done on the DD tables , how is
>consistency maintained ? "
>
> (2) Why are DDLs treated as ATOMIC transactions ? In other words , why
>do the DDLs ( treated as a single transaction ) get automatically
>commited ?
Received on Wed Feb 04 1998 - 00:00:00 CST