Using Oracle Database 10g Enterprise Edition Release 10.2.0.1.0, the operations below have completely stumped me. The first locks up (table has DDL lock, finally killed query after 20+ minute wait). The second does not.
###This hangs:
ALTER TABLE customer ADD primary_seg varchar2(9) NOT NULL;
###This does not:
ALTER TABLE customer ADD primary_seg varchar2(9);
ALTER TABLE customer MODIFY primary_seg NOT NULL;
There are no records in the table, there are no other users than myself on the instance, and I have no other queries executing which might cause a lock. The table previously had a large number of rows that were removed via TRUNCATE TABLE. There are no foreign keys or other referential constraints.