模拟IO 读写压力测试

#### 本实验室通过创建一个测试表myTestTable ,分配在一个足够大小的表空间。

###然后通过 insert select 方式,创建100个后台进程进行读写操作,每个后台进程预计时间20分钟以上。

0.create table

create table myTestTable as
select rownum as id,
to_char(sysdate + rownum/24/3600, 'yyyy-mm-dd hh24:mi:ss') as inc_datetime,
trunc(dbms_random.value(0, 100)) as random_id,
dbms_random.string('x', 20) random_string
from dual
connect by level <= 10;


1./tmp/dba/select.sql

select rownum as id,
to_char(sysdate + rownum/24/3600, 'yyyy-mm-dd hh24:mi:ss') as inc_datetime,
trunc(dbms_random.value(0, 100)) as random_id,
dbms_random.string('x', 20) random_string
from dual
connect by level <= 100000;

2./tmp/dba/insert.sql

insert myTestTable as

select rownum as id,
to_char(sysdate + rownum/24/3600, 'yyyy-mm-dd hh24:mi:ss') as inc_datetime,
trunc(dbms_random.value(0, 100)) as random_id,
dbms_random.string('x', 20) random_string
from dual
connect by level <= 100000;

(test shell)

#!/bin/bash

sum=0

i=1

while(( i <= 100 ))
do
let "sum+=i"
let "i += 1"
done

echo "sum=$sum"


4.
more main.sh
#!/bin/bash
sum=0
i=1
while ((i <=100))
do
##let "sum+=i"
nohup sh /tmp/dba1/insert.sh &
let "i +=1"
done
echo "sum=$sum"

$ more insert.sh

#!/bin/bash
sqlplus / as sysdba << eof1
insert into myTestTable
select rownum as id,
to_char(sysdate + rownum/24/3600, 'yyyy-mm-dd hh24:mi:ss') as inc_datetime,
trunc(dbms_random.value(0, 100)) as random_id,
dbms_random.string('x', 20) random_string
from dual
connect by level <= 10000000;
commit;
spool off
eof1

6.
ORACLE_CRS_HOME=/db/core/oracleapp/crs
HOME=/home/db
ORACLE_HOME=/db/core/oracleapp/10.2.0

原文地址:https://www.cnblogs.com/feiyun8616/p/8023863.html