码迷,mamicode.com
首页 > 数据库 > 详细

oracle压力测试脚本

时间:2019-01-18 12:15:30      阅读:538      评论:0      收藏:0      [点我收藏+]

标签:ORC   div   highlight   ade   har   释放   oracle   initial   attr   

 

 

 

1.根据oracle(2-Tier)协议;

#include"lrd.h"
static LRD_INIT_INFO InitInfo={LRD_INIT_INFO_EYECAT};
static LRD_DEFAULT_DB_VERSION DBTypeVersion[]={{LRD_DBTYPE_NONE,LRD_DBVERSION_NONE}};
static void FAR * OraEnv1;
static void FAR * OraSvc1;
static void FAR * OraSrv1;
static void FAR * OraSes1;
static void FAR * OraStm1;
static void FAR * OraDef1;
unsigned long rownum;
vuser_init()
{
	lrd_init(&InitInfo, DBTypeVersion);
	lrd_initialize_db(LRD_DBTYPE_ORACLE, 2, 0);
	lrd_env_init(LRD_DBTYPE_ORACLE, &OraEnv1, 0, 0);
	lrd_ora8_handle_alloc(OraEnv1, SERVER, &OraSrv1, 0);
	lrd_ora8_handle_alloc(OraEnv1, SVCCTX, &OraSvc1, 0);
	lrd_ora8_handle_alloc(OraEnv1, SESSION, &OraSes1, 0);
	//lrd_ora8_handle_alloc(OraEnv1, SESSION, &OraSes2, 0);
	//lrd_server_attach(OraSrv1, "qa70/orcl", 9, 0, 0);
	lrd_server_attach(OraSrv1, "orcl", -1, 0, 0);//lrd_server_attach(OraSrv1, "orcl", 4, 0, 0)
	lrd_ora8_attr_set_from_handle(OraSvc1, SERVER, OraSrv1, 0, 0);
	lrd_ora8_attr_set(OraSes1, USERNAME, "system", -1, 0);//lr_decrypt("58b3e02f8ba0e4201c2c")
	//lrd_ora8_attr_set(OraSes1, PASSWORD, lr_decrypt("5487fff63e812b81"), -1, 0);
	lrd_ora8_attr_set(OraSes1, PASSWORD, "password", -1, 0);
	lrd_ora8_attr_set_from_handle(OraSvc1, SESSION, OraSes1, 0, 0);
	lrd_session_begin(OraSvc1, OraSes1, 1, 0, 0);
	lrd_ora8_handle_alloc(OraEnv1, STMT, &OraStm1, 0);
	
	return 0;
}



//Action
Action()
{
	//这里写上你的sql语句
	lrd_ora8_stmt(OraStm1,"select * from aa01 where aae140=‘sys‘;",1,0,0);
	lrd_ora8_stmt(OraStm1,"select * from ry_jbxx,dz_zzxx where dz_zzxx.zzbh=ry_jbxx.RYZZBH ", 1, 32, 0);


	//lr_rendezvous("querry");

	lr_start_transaction("querry");

	//执行定义的sql,并且将结果行数返回到rownum中
	lrd_ora8_exec(OraSvc1,OraStm1,0,0,&rownum,0,0,0,0,1);

	lr_end_transaction("querry", LR_AUTO);





return 0;

}

//vuser_end
vuser_end()
{

    //释放连接数据库
	lrd_session_end(OraSvc1, OraSes1, 0, 0); 
	lrd_server_detach(OraSrv1, 0, 0); 
	lrd_handle_free(&OraSrv1, 0);
	lrd_handle_free(&OraSvc1, 0);
	lrd_handle_free(&OraSes1, 0);
	lrd_handle_free(&OraEnv1, 0);

}

  

oracle压力测试脚本

标签:ORC   div   highlight   ade   har   释放   oracle   initial   attr   

原文地址:https://www.cnblogs.com/Alexr/p/10286692.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!