1.新建EMPLOYEES表 create table EMPLOYEES2 as select * from hr.EMPLOYEES
2.查看数据大小 SELECT segment_name,segment_type,SUM(bytes)—65536字节 FROM user_segments where segment_name=‘EMPLOYEES2’ GROUP BY segment_name,segment_type
3.将数据量插入到10g,记录插入次数,数据行数 declare v_1 number:=0; v_2 number:=0; v_3 timestamp:=sysdate; v_4 timestamp:=sysdate; begin
for i in 1 .. v_1 loop SELECT 10/SUM(bytes/1024/1024/1024) into v_1 FROM user_segments where segment_name=‘EMPLOYEES2’ GROUP BY segment_name,segment_type;
dbms_output.put_line(‘执行次数:‘||v_2||’ 当前时间:‘||to_char(sysdate,‘yyyy-mm-dd hh24:mi
4.更新数据表,记录更新行数,更新时间 declare
cursor cur_t1 is select SALARY, rowid row_id from EMPLOYEES2 t1 ;
v_2 number:=0; v_3 timestamp:=system; v_4 timestamp:=system; begin select for i in cur_t1 loop
dbms_output.put_line(‘执行次数:‘||v_2||’ 当前时间:‘||system||’ 上次执行sql用时:‘||v_4-v_3); v_3:=system; update EMPLOYEES2 set SALARY =SALARY+500 where t1.rowid=i.row_id commit; dbms_lock.sleep(1); v_4:=system; v_2:=v_2+1; end loop; end;
5.删除数据表,记录更新行数,更新时间 declare
cursor cur_t1 is select SALARY, rowid row_id from EMPLOYEES2 t1 ;
v_2 number:=0; v_3 timestamp:=system; v_4 timestamp:=system; begin select for i in cur_t1 loop
dbms_output.put_line(‘执行次数:‘||v_2||’ 当前时间:‘||system||’ 上次执行sql用时:‘||v_4-v_3); v_3:=system; delete from EMPLOYEES2 where t1.rowid=i.row_id commit; dbms_lock.sleep(1); v_4:=system; v_2:=v_2+1; end loop; end;