oracle压力测试之orastress!
orastress主要测试数据库的压力。它可以测试数据库的CPU或者内存的压力(以只读方式),也可以使用包括普通INSERT和直接路径INSERT两种方式测试数据库的I/O能力。 orastress只能运行在windows下,但它也可以测试远程服务器的压力。 1、下载 下载地址是 http:
orastress主要测试数据库的压力。它可以测试数据库的CPU或者内存的压力(以只读方式),也可以使用包括普通INSERT和直接路径INSERT两种方式测试数据库的I/O能力。
orastress只能运行在windows下,但它也可以测试远程服务器的压力。
1、下载
下载地址是
http://www.linxcel.co.uk/orabm/orastress.zip
2、安装
orastress!使用的用户和数据和orabm类似,它的安装方法和orabm也类似。
1) 扩充表空间
orastress!使用orabm用户作为测试用户,orabm用户默认使用tools表空间作为默认表空间,在本测试中要导入10个Warehouses的数据,数据库大概在1G左右,所以,要保证orabm所用的表空间大于1G
SQL> alter database datafile 'E:ORACLEORADATAORACLE9ITOOLS01.DBF' resize 1500m;
2) 删除orabm用户
如果你的数据库没有orabm用户,则跳过这步
DROP USER ORABM CASCADE;
3) 创建用户
sqlplus system/pwd @orabm_user
远程数据库使用:
sqlplus
system/pwd@tnsname
@orabm_user
4) 创建表
sqlplus system/pwd @orabm_tab
远程数据库使用:
sqlplus
system/pwd@tnsname
@orabm_tab
5) 装载数据
orabmload Warehouses 10
这里装载10个warehouses的数据进行测试。数据量大概在1G左右,执行时间估计在15分钟左右。
如果是远程数据库,则先
set LOCAL=tnsname
然后再执行orabmload
6) 创建索引
sqlplus system/pwd @orabm_ind
远程数据库使用:
sqlplus
system/pwd@tnsname
@orabm_ind
7) 分析表和索引
sqlplus system/pwd @orabm_analyze
远程数据库使用:
sqlplus
system/pwd@tnsname
@orabm_analyze
8) 授权
连接到目标服务器,以sys执行
GRANT EXECUTE ON DBMS_LOCK TO ORABM
9) 创建压力测试插入记录所用的表
sqlplus orabm/orabm @orastress_tab.sql
远程数据库使用:
sqlplus
orabm/orabm@tnsname
@orastress_tab.sql
10) 创建orastress!用到的包和存储过程
创建包:
sqlplus orabm/orabm @orastress.plh
创建包体:
sqlplus orabm/orabm @orastress.plb
远程数据库使用:
sqlplus
orabm/orabm@tnsname
@orastress.plh
sqlplus
orabm/orabm@tnsname
@orastress.plb
11) 申请注册码
经过以上步骤,在oracle的测试环境基本搭建完成,可以使用orastress!开始测试了。但orastress!是共享软件,没有注册只能使用1个并发测试数据库,我们可以申请一个有效期为20天的、功能无限制的试用注册码。
申请注册码的步骤是:
首先运行
D:programeroracle tools压力orastress>"orastress!.exe"
Serial: 1274-0B71
Licensed to: DEFAULT
Evaluation version: 1 session only per database
得到的1274-0B71就是序列号(不同的机器有不同的序列号)
然后登录
http://www.linxcel.co.uk/software_orastress_key.html
输入相关信息,邮件地址一定要正确填写,并在最后一个输入框中输入序列号,提交后如果审核通过的话能拿到一个注册码
拿到注册码后运行
D:programeroracle tools压力orastress>"orastress!.exe" register
在弹出的对话框中填入注册信息即可。
很可惜,到目前位置我还没有能拿到key。
3、使用
orastress!可以运行在4种模式下:
READ :只读,测试CPU和内存。如果只测试单个实例,效果和orabm一样
OLTP :模拟在线事务交易系统测试
INS :测试普通insert的I/O压力
DIO :测试直接路径insert的I/O压力
orastress!的使用方式是:
orastress! –s sess-iterations-list –t transacts-per-sess –c tns-alias-list –m mode [ -s batchsize]
其中:
sess-iterations-list:并发的个数。如果要测试多种数量的并发数,则多种数量之间用都好分割
transacts-per-sess:每个并发执行的事务数
tns-alias-list:被测试的实例列表。如果要测试多个实例,则各个实例用逗号分割。
mode:运行模式。参看上文。
batchsize:可选。在IDS和DIO模式下用到。默认值是1000。在IDS和DIO模式下,插入的记录数达到batchsize就会提交一次。
建议对单节点数据库分别采用1,2,3,5,10个Warehouses进行1,2,4,6,10个并发的50000个事务的测试.
对于多节点RAC建议采用1,2,3,5,10个Warehouses进行1,3,4,7,10个并发的50000个事务的测试.
下面的一些运行举例
Example 1:
orastress! –s 1 –t 50000 –c inst1.world –m oltp
Run one iteration - comprising 50000 transactions in 1 session - against inst1.world.
进行一组测试,通过一个session,包含50000个事务,对inst1.world数据库进行测试.
Example 2:
orastress! –s 2 –t 50000 –c inst1.world,inst2.world –m oltp
运行一组测试,对两个数据库(inst1.world,inst2.world)各发出两个并发session,每个session运行50000个事务,这两个数据库可以是:
. 同一个rac的两个实例
. 同一个服务器上不同的实例(非rac)
. 不同服务器上的不同实例(非rac)
Example 3:
orastress! –s 1,2,4 –t 50000 –c inst1,inst2,inst3,inst4 –m read
运行3组测试,分别以1,2,4个并发session对四个实例,各执行50000个事务:
Orastress!的输出结果和orabm类似。
D:programeroracle tools压力orastress>"orastress!.exe" -s 1 -t 100 -c oracle9
i -m oltp
Evaluation version: 1 session only per database
---begin mode=oltp sess=1 txn=100 TNS=oracle9i Thu Sep 21 17:59:06 2006
oracle9i#1 w=9 txn(all)=100 xn(sam)=79 t(sam)=12 tps=6.6 d=2(2.5%) n=34(43%) o=8
(10.1%) p=33(41.8%) s=2(2.5%) end=210906-17:59:22
---end - Thu Sep 21 17:59:22 2006
D:programeroracle tools压力orastress>"orastress!.exe" -s 1 -t 1000 -c oracle
9i -m oltp
Evaluation version: 1 session only per database
---begin mode=oltp sess=1 txn=1000 TNS=oracle9i Fri Sep 22 10:07:49 2006
oracle9i#1 w=2 txn(all)=1000 xn(sam)=799 t(sam)=65 tps=12.3 d=40(5%) n=304(38%)
o=39(4.9%) p=385(48.2%) s=31(3.9%) end=220906-10:09:27
---end - Fri Sep 22 10:09:27 2006
这个测试比较缓慢,大家在测试的时候要给点耐性。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Oracle View Encryption allows you to encrypt data in the view, thereby enhancing the security of sensitive information. The steps include: 1) creating the master encryption key (MEk); 2) creating an encrypted view, specifying the view and MEk to be encrypted; 3) authorizing users to access the encrypted view. How encrypted views work: When a user querys for an encrypted view, Oracle uses MEk to decrypt data, ensuring that only authorized users can access readable data.

Deleting all data in Oracle requires the following steps: 1. Establish a connection; 2. Disable foreign key constraints; 3. Delete table data; 4. Submit transactions; 5. Enable foreign key constraints (optional). Be sure to back up the database before execution to prevent data loss.

Oracle Invalid numeric errors may be caused by data type mismatch, numeric overflow, data conversion errors, or data corruption. Troubleshooting steps include checking data types, detecting digital overflows, checking data conversions, checking data corruption, and exploring other possible solutions such as configuring the NLS_NUMERIC_CHARACTERS parameter and enabling data verification logging.

Solutions to Oracle cannot be opened include: 1. Start the database service; 2. Start the listener; 3. Check port conflicts; 4. Set environment variables correctly; 5. Make sure the firewall or antivirus software does not block the connection; 6. Check whether the server is closed; 7. Use RMAN to recover corrupt files; 8. Check whether the TNS service name is correct; 9. Check network connection; 10. Reinstall Oracle software.

Oracle database paging uses ROWNUM pseudo-columns or FETCH statements to implement: ROWNUM pseudo-columns are used to filter results by row numbers and are suitable for complex queries. The FETCH statement is used to get the specified number of first rows and is suitable for simple queries.

The method to solve the Oracle cursor closure problem includes: explicitly closing the cursor using the CLOSE statement. Declare the cursor in the FOR UPDATE clause so that it automatically closes after the scope is ended. Declare the cursor in the USING clause so that it automatically closes when the associated PL/SQL variable is closed. Use exception handling to ensure that the cursor is closed in any exception situation. Use the connection pool to automatically close the cursor. Disable automatic submission and delay cursor closing.

In Oracle, the FOR LOOP loop can create cursors dynamically. The steps are: 1. Define the cursor type; 2. Create the loop; 3. Create the cursor dynamically; 4. Execute the cursor; 5. Close the cursor. Example: A cursor can be created cycle-by-circuit to display the names and salaries of the top 10 employees.

SQL statements can be created and executed based on runtime input by using Oracle's dynamic SQL. The steps include: preparing an empty string variable to store dynamically generated SQL statements. Use the EXECUTE IMMEDIATE or PREPARE statement to compile and execute dynamic SQL statements. Use bind variable to pass user input or other dynamic values to dynamic SQL. Use EXECUTE IMMEDIATE or EXECUTE to execute dynamic SQL statements.
