The documentation for dbms_random states:
It will automatically initialize with the date, user ID, and process ID if no explicit initialization is performed.
This phrase does not answer the question, which “process id” is going to be used for initialization in case of parallel execution. That’s why I decided to give a vivid example that shows independence of “dbms_random” generator from “process id” of slave, that is generating identical values in parallel:
with
t as ( select/*+ materialize */ level n from dual connect by level<=4000)
,t1 as (
select--+ materialize parallel(t 4)
dbms_random.string('x',4)
||';'
||(select sid||';'||process||';'||pid
from v$session, v$process
where sid=sys_context('USERENV','SID')
and PADDR=ADDR
and n>0
) f
from t
)
,t2 as (
select
t1.f
,count(*) over(partition by regexp_substr(f,'^[^;]+')) cnt
from t1
)
select f
,regexp_substr(f,'[^;]+') rnd
,regexp_substr(f,'[^;]+',1,2) sid
,regexp_substr(f,'[^;]+',1,3) process
,regexp_substr(f,'[^;]+',1,4) pid
from t2
where cnt>1
order by f
Result:
| F | RND | SID | PROCESS | PID |
|---|---|---|---|---|
| AARV;130;5472;30 | AARV | 130 | 5472 | 30 |
| AARV;68;2228;29 | AARV | 68 | 2228 | 29 |
| AC2R;130;5472;30 | AC2R | 130 | 5472 | 30 |
| AC2R;68;2228;29 | AC2R | 68 | 2228 | 29 |
| AC8O;130;5472;30 | AC8O | 130 | 5472 | 30 |
| AC8O;68;2228;29 | AC8O | 68 | 2228 | 29 |
| AKVZ;130;5472;30 | AKVZ | 130 | 5472 | 30 |
| AKVZ;68;2228;29 | AKVZ | 68 | 2228 | 29 |
| ALTQ;130;5472;30 | ALTQ | 130 | 5472 | 30 |
| ALTQ;68;2228;29 | ALTQ | 68 | 2228 | 29 |
| … | … | … | … | … |
