title: Oracle lock issue - ORA-00054: resource busy - while creating a foreign key
body: <p>Initial situation:</p>
  
  <ul>
  <li>A table PARENT_TABLE with a primary key on its column PK_COL.</li>
  <li>A table CHILD_TABLE1 with a foreign key on PARENT_TABLE(PK_COL).</li>
  </ul>
  
  <p>I insert a line into CHILD_TABLE1 in a transaction and do not commit.</p>
  
  <p>Then I try to create a table CHILD_TABLE2 symmetrical to CHILD_TABLE1 in another session.
  But an <code>ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired</code> is raised when I create the foreign key, because of the ongoing insertion in CHILD_TABLE1.</p>
  
  <p>I don't understand why Oracle is preventing the foreign key creation: there is no modification performed on PARENT_TABLE.</p>
  
  <p>Please help.</p>
  
  <p>To reproduce under sqlplus:</p>
  
  <pre><code>set autocommit off
  
  create table PARENT_TABLE(PK_COL varchar(10));
  alter table PARENT_TABLE add constraint PK_CONSTRAINT primary key (PK_COL);
  insert into PARENT_TABLE values ('foo');
  commit;
  
  create table CHILD_TABLE1(CHILD_PK_COL varchar(10), FK_COL varchar(10));
  alter table CHILD_TABLE1 add constraint CHILD_TABLE1_CONSTRAINT foreign key (FK_COL) references PARENT_TABLE(PK_COL);
  create index CHILD_TABLE1_INDEX on CHILD_TABLE1(FK_COL);
  insert into CHILD_TABLE1 values ('bar', 'foo');
  </code></pre>
  
  <p>In another console:</p>
  
  <pre><code>alter session set ddl_lock_timeout=10;
  create table CHILD_TABLE2(CHILD_PK_COL varchar(10), FK_COL varchar(10));
  alter table CHILD_TABLE2 add constraint CHILD_TABLE2_CONSTRAINT foreign key (FK_COL) references PARENT_TABLE(PK_COL);
  </code></pre>
  
  <p>Funny: with NOVALIDATE in CHILD_TABLE2_CONSTRAINT creation, the execution is hanging...</p>