准备表、索引
drop table tmp_t0 purge;
create table tmp_t0 (
c0 varchar2(50),
c1 varchar2(20),
c2 varchar2(20),
c3 date
)
-- pctfree 20 initrans 32
partition by hash(c0)
partitions 64
tablespace users
;
alter table TMP_T0
add constraint PK_TMP_T0 primary key (C0)
using index
tablespace users
pctfree 10
initrans 2
maxtrans 255
;
create index idx_tmp_t0_c3 on tmp_t0(c3) local
tablespace users
;
准备并发插入脚本
模拟 30个客户端
[oracle@node1 ~]$ cat insert_into.sh
#!/bin/bash
for((i=1;i<=30;i++));
do
(
sqlplus -S /nolog <<EOF
conn scott2/oracle
begin
for c_f in (
select level as id
from dual
connect by level <=500000
)
loop
insert into tmp_t0
values(sys_guid(),c_f.id,c_f.id,sysdate)
;
commit;
end loop;
end;
/
exit
EOF
)&
done
wait
参考: