简单的Oracle压力测试程序

简介: 环境准备

环境准备

drop tablespace testpress1;
create tablespace testpress1 datafile '+DATA' size 10g autoextend on;
create user testpress identified by testpress default tablespace testpress1;
alter user testpress quota unlimited on testpress1;
grant resource, connect to testpress;



压力测试脚本1

set time on
set timing on
set serveroutput on;
drop table testpress.tba;
create table testpress.tba as select * from dba_objects;
declare
v_count integer;
begin
  v_count := 1;  
  for v_count in 1..2000 loop
     insert into testpress.tba select * from dba_objects; 
     insert into testpress.tba select * from dba_objects;   
     insert into testpress.tba select * from dba_objects;   
     insert into testpress.tba select * from dba_objects; 
     insert into testpress.tba select * from dba_objects;  
     dbms_output.put_line(' Insert for the '||v_count||' time.');
     commit;
     delete from testpress.tba;
   end loop;
end;
/


压力测试脚本2

COUNTER=0
while [ $COUNTER -lt 20000 ]
do
  sqlplus / as sysdba<<EOF
  create table test_a as select * from dba_objects;
  exit;
EOF
  sleep 100
  sqlplus / as sysdba<<EOF
  drop table test_a;
  exit;
EOF
let COUNTER+=1
done


监测


查看表空间物理文件的名称及大小

SELECT tablespace_name,file_id, 
file_name, 
round(bytes / (1024 * 1024), 0) total_space 
FROM dba_data_files 
where tablespace_name=testpress1;


8. 查看表空间的使用情况


数据表空间使用率:

SELECT a.tablespace_name, 
a.bytes/(1024*1024) total_M, 
b.bytes/(1024*1024) used_M, 
c.bytes/(1024*1024) free_M, 
(b.bytes * 100) / a.bytes "% USED ", 
(c.bytes * 100) / a.bytes "% FREE " 
FROM sys.sm$ts_avail a, sys.sm$ts_used b, sys.sm$ts_free c 
WHERE a.tablespace_name = b.tablespace_name 
AND a.tablespace_name = c.tablespace_name;
相关文章
|
安全 JavaScript 前端开发
AppSpider 7.5.020 发布 - Web 应用程序安全测试
AppSpider 7.5.020 for Windows - Web 应用程序安全测试
107 0
|
4月前
|
Java 测试技术 数据安全/隐私保护
通过yaml文件配置自动化测试程序
通过yaml文件可以将自动化测试环境,测试数据和测试行为分开,请看一下案例
136 4
|
8月前
|
监控 安全 测试技术
【01】卓伊凡收到冒充税务机关的诈骗程序-决定在沙盒Sandbox环境中运行测试下-广大企业同胞们注意防诈骗
【01】卓伊凡收到冒充税务机关的诈骗程序-决定在沙盒Sandbox环境中运行测试下-广大企业同胞们注意防诈骗
224 14
【01】卓伊凡收到冒充税务机关的诈骗程序-决定在沙盒Sandbox环境中运行测试下-广大企业同胞们注意防诈骗
|
9月前
|
安全 测试技术 Linux
Acunetix v25.4 发布 - Web 应用程序安全测试
Acunetix v25.4 (Linux, Windows) - Web 应用程序安全测试
277 3
Acunetix v25.4 发布 - Web 应用程序安全测试
|
8月前
|
安全 Devops 测试技术
AppSpider 7.5.018 for Windows - Web 应用程序安全测试
AppSpider 7.5.018 for Windows - Web 应用程序安全测试
170 0
AppSpider 7.5.018 for Windows - Web 应用程序安全测试
|
11月前
|
安全 JavaScript Java
AppSpider Pro 7.5.015 for Windows - Web 应用程序安全测试
AppSpider Pro 7.5.015 for Windows - Web 应用程序安全测试
191 12
AppSpider Pro 7.5.015 for Windows - Web 应用程序安全测试
|
10月前
|
Oracle 关系型数据库 MySQL
使用崖山YMP 迁移 Oracle/MySQL 至YashanDB 23.2 验证测试
这篇文章是作者尚雷关于使用崖山YMP迁移Oracle/MySQL至YashanDB 23.2的验证测试分享。介绍了YMP的产品信息,包括架构、版本支持等,还详细阐述了外置库部署、YMP部署、访问YMP、数据源管理、任务管理(创建任务、迁移配置、离线迁移、校验初始化、一致性校验)及MySQL迁移的全过程。
|
10月前
|
自然语言处理 安全 测试技术
HCL AppScan Standard 10.8.0 (Windows) - Web 应用程序安全测试
HCL AppScan Standard 10.8.0 (Windows) - Web 应用程序安全测试
653 0
HCL AppScan Standard 10.8.0 (Windows) - Web 应用程序安全测试
|
算法 Java 测试技术
Benchmark.NET:让 C# 测试程序性能变得既酷又简单
Benchmark.NET是一款专为 .NET 平台设计的性能基准测试框架,它可以帮助你测量代码的执行时间、内存使用情况等性能指标。它就像是你代码的 "健身教练",帮助你找到瓶颈,优化性能,让你的应用跑得更快、更稳!希望这个小教程能让你在追求高性能的路上越走越远,享受编程带来的无限乐趣!
655 13
|
并行计算 算法 测试技术
C语言因高效灵活被广泛应用于软件开发。本文探讨了优化C语言程序性能的策略,涵盖算法优化、代码结构优化、内存管理优化、编译器优化、数据结构优化、并行计算优化及性能测试与分析七个方面
C语言因高效灵活被广泛应用于软件开发。本文探讨了优化C语言程序性能的策略,涵盖算法优化、代码结构优化、内存管理优化、编译器优化、数据结构优化、并行计算优化及性能测试与分析七个方面,旨在通过综合策略提升程序性能,满足实际需求。
473 1

推荐镜像

更多