Question: I'm wondering if I will miss any data if I replace a trigger while my oracle database is in use. I created a toy example and it seems like I won't, but one of my coworkers claims otherwise.

```
create table test_trigger (id number);
create table test_trigger_h (id number);
create sequence test_trigger_seq;

--/
create or replace trigger test_trigger_t after insert on test_trigger for each row
begin
  insert into test_trigger_h (id) values (:new.id);
end;    
/

--/
begin
  for i in 1..100000 loop
    insert into test_trigger (id) values (test_trigger_seq.nextval);
  end loop;
end;
/

--/
begin
  for i in 1..10000 loop
    execute immediate 'create or replace trigger test_trigger_t after insert on test_trigger for each row begin insert into test_trigger_h (id) values (:new.id); end;';
  end loop;
end;
/

ran the two loops at the same time

select count(1) from test_trigger;

COUNT(1)
100000

select count(1) from test_trigger_h;

COUNT(1)
100000

```

Answer: 
`create or replace` is locking the table. So all the inserts will wait until it completes. Don't worry about missed inserts.
I think you might be going about testing this in the wrong way. Your insert statements won't take any time at all and so the replacement of the trigger can fit in through the gaps between inserts. As least this is what I infer due to the below.

If you change your test to ensure you have a long running SQL statement, e.g.

```
create table test_trigger (id number);
create table test_trigger_h (id number);
create sequence test_trigger_seq;

create or replace trigger test_trigger_t 
 after insert on test_trigger for each row
begin
  insert into test_trigger_h (id) values (:new.id);
end;    
/

insert into test_trigger
 select level
   from dual
connect by level <= 1000000;

```

If you then try to replace the trigger in a *separate* session it will not occur until after the insert has completed.

Unfortunately, I can't find anything in the documentation to back me up; this is just behavior that I'm aware of.