oracle 模拟并发插入

准备表、索引

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

参考:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

数据库人生

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值