It will automatically initialize with the date, user ID, and process ID if no explicit initialization is performed.Из данной фразы не очевидно, какой "process id" будет использоваться для инициализации в случае параллельного выполнения, поэтому приведу наглядный пример, показывающий независимость генератора dbms_random от "process id" слейва, то есть генерацию одинаковых значений в параллели:
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
Результат:
| 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 |
| ... | ... | ... | ... | ... |
Comments
Отправить комментарий