使用sysbench对Oracle做基准测试(-) 安装篇

本文介绍了如何使用sysbench对Oracle进行基准测试。首先,详细讲述了安装sysbench的过程,包括安装bzr和添加espl源。接着,提到了在编译sysbench时需要注意引用Oracle的特定库,并在文末解析了编译参数与环境变量。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

sysbench是一款开源的多线程性能测试工具,
可以执行CPU/内存/线程/IO/数据库等方面的性能测试。
数据库目前支持MySQL/Oracle/PostgreSQL。


由于sysbench 已经托管到launchpad。 souuceforge已经不可用。

获取sysbench 需要安装bzr,为了安装bzr 需要安装一个espl源


rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

之后安装bzr

yum install bzr

获取sysbench 文件

[root@localhost ~]# bzr branch lp:sysbench
You have not informed bzr of your Launchpad ID, and you must do this to
write to Launchpad or access private data.  See "bzr help launchpad-login".
Branched 123 revision(s).                                                                                                                       
[root@localhost ~]# ll
total 180292
-rw-------. 1 root root      1181 Sep 26 18:55 anaconda-ks.cfg
drwxr-xr-x. 2 root root      4096 Sep 26 18:58 Desktop
drwxr-xr-x. 2 root root      4096 Sep 26 18:57 Documents
drwxr-xr-x. 2 root root      4096 Sep 26 18:57 Downloads
-rw-r--r--. 1 root root     35467 Sep 26 18:55 install.log
-rw-r--r--. 1 root root     10054 Sep 26 18:53 install.log.syslog
drwxr-xr-x. 2 root root      4096 Sep 26 18:57 Music
-rw-r--r--. 1 root root 184513020 Sep 11 19:35 mysql-5.5.38-linux2.6-x86_64.tar.gz
drwxr-xr-x. 2 root root      4096 Sep 26 18:57 Pictures
drwxr-xr-x. 2 root root      4096 Sep 26 18:57 Public
drwxr-xr-x. 4 root root      4096 Sep 26 19:30 rpmbuild
drwxr-xr-x. 7 root root      4096 Oct 13 12:27 sysbench
drwxr-xr-x. 2 root root      4096 Sep 26 18:57 Templates
drwxr-xr-x. 2 root root      4096 Sep 26 18:57 Videos
drwxr-xr-x. 3 root root      4096 Sep 26 20:17 zabbix
[root@localhost ~]#



配置环境变量 有一些关于编译器的东西

[root@localhost sysbench]# export CC=cc
[root@localhost sysbench]# export CXX=c++
#指定编译选项通过man make 能查到-I 后面指定--include-dir
[root@localhost sysbench]# export CFLAGS="-m64 -I /u01/app/oracle/product/11.2.0/client_1/rdbms/public"   
[root@localhost sysbench]# export CXXFLAGS="$CFLAGS"
#注意下面声明了Oracle 类库
[root@localhost sysbench]# export ORACLE_HOME=/u01/app/oracle/product/11.2.0/client_1
[root@localhost sysbench]# export LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/client_1/lib


调用autogen.sh生成configure


[root@localhost sysbench]# ./configure  --prefix=/usr/local/sysbench --with-oracle --libdir=/u01/app/oracle/product/11.2.0/client_1/lib --without-mysql
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... cc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether cc accepts -g... yes
checking for cc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of cc... gcc3
checking how to run the C preprocessor... cc -E
checking whether cc understands -c and -o together... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for a sed that does not truncate output... /bin/sed
checking for fgrep... /bin/grep -F
checking for ld used by cc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1966080
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from cc object... ok
checking for dlfcn.h... yes
checking for objdir... .libs
checking if cc supports -fno-rtti -fno-exceptions... no
checking for cc option to produce PIC... -fPIC -DPIC
checking if cc PIC flag -fPIC -DPIC works... yes
checking if cc static flag -static works... no
checking if cc supports -c -o file.o... yes
checking if cc supports -c -o file.o... (cached) yes
checking whether the cc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether __SUNPRO_C is declared... no
checking "C Compiler version"... "cc (GCC) 4.4.6 20120305 (Red Hat 4.4.6-4)"
checking whether to compile with MySQL support... (cached) no
checking whether to compile with Drizzle support... (cached) yes
checking whether to compile with Oracle support... (cached) yes
checking whether to compile with PostgreSQL support... (cached) no
checking whether to compile with Lua support... (cached) yes
checking whether SHM_HUGETLB is declared... yes
checking whether O_SYNC is declared... yes
checking for xsltproc... xsltproc
checking whether xsltproc works... no
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for sqrt in -lm... yes
checking for ld used by GCC... /usr/bin/ld -m elf_x86_64
checking if the linker (/usr/bin/ld -m elf_x86_64) is GNU ld... yes
checking for shared library run path origin... done
checking for libdrizzle... no
checking libaio.h usability... yes
checking libaio.h presence... yes
checking for libaio.h... yes
checking for io_queue_init in -laio... yes
checking if io_getevents() has an old interface... no
checking for malloc in -lumem... no
checking for malloc in -lmtmalloc... no
checking for ANSI C header files... (cached) yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking math.h usability... yes
checking math.h presence... yes
checking for math.h... yes
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking sched.h usability... yes
checking sched.h presence... yes
checking for sched.h... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/aio.h usability... no
checking sys/aio.h presence... no
checking for sys/aio.h... no
checking sys/ipc.h usability... yes
checking sys/ipc.h presence... yes
checking for sys/ipc.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking sys/shm.h usability... yes
checking sys/shm.h presence... yes
checking for sys/shm.h... yes
checking thread.h usability... no
checking thread.h presence... no
checking for thread.h... no
checking for unistd.h... (cached) yes
checking limits.h usability... yes
checking limits.h presence... yes
checking for limits.h... yes
checking for inline... inline
checking for off_t... yes
checking for size_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking size of size_t... 8
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for getpagesize... yes
checking for working mmap... yes
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char *... yes
checking whether clock_gettime is declared... yes
checking for library containing clock_gettime... -lrt
checking for alarm... yes
checking for directio... no
checking for fdatasync... yes
checking for gettimeofday... yes
checking for lrand48... yes
checking for drand48... yes
checking for memalign... yes
checking for memset... yes
checking for mkstemp... yes
checking for popen... yes
checking for posix_memalign... yes
checking for pthread_yield... yes
checking for _setjmp... yes
checking for setvbuf... yes
checking for sqrt... yes
checking for strdup... yes
checking for thr_setconcurrency... no
checking for valloc... yes
checking for pthread_once... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/xsl/Makefile
config.status: creating doc/xsl/catalog.xml
config.status: creating doc/Makefile
config.status: creating sysbench/Makefile
config.status: creating sysbench/drivers/Makefile
config.status: creating sysbench/drivers/mysql/Makefile
config.status: creating sysbench/drivers/drizzle/Makefile
config.status: creating sysbench/drivers/oracle/Makefile
config.status: creating sysbench/drivers/pgsql/Makefile
config.status: creating sysbench/tests/Makefile
config.status: creating sysbench/tests/cpu/Makefile
config.status: creating sysbench/tests/fileio/Makefile
config.status: creating sysbench/tests/memory/Makefile
config.status: creating sysbench/tests/threads/Makefile
config.status: creating sysbench/tests/mutex/Makefile
config.status: creating sysbench/tests/db/Makefile
config.status: creating sysbench/scripting/Makefile
config.status: creating sysbench/scripting/lua/Makefile
config.status: creating sysbench/scripting/lua/src/Makefile
config.status: creating config/config.h
config.status: executing depfiles commands
config.status: executing libtool commands

编译 这里要注意引用Oracle的一个库

[root@localhost sysbench]#  make ORA_LIBS=/u01/app/oracle/product/11.2.0/client_1/lib/libclntsh.so

Making all in doc
make[1]: Entering directory `/root/sysbench/doc'
Making all in xsl
make[2]: Entering directory `/root/sysbench/doc/xsl'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/root/sysbench/doc/xsl'
make[2]: Entering directory `/root/sysbench/doc'
touch manual.html
make[2]: Leaving directory `/root/sysbench/doc'
make[1]: Leaving directory `/root/sysbench/doc'
Making all in sysbench
make[1]: Entering directory `/root/sysbench/sysbench'
Making all in drivers
make[2]: Entering directory `/root/sysbench/sysbench/drivers'
Making all in oracle
make[3]: Entering directory `/root/sysbench/sysbench/drivers/oracle'
cc -DHAVE_CONFIG_H -I. -I../../../config  -Iyes/rdbms/demo -Iyes/rdbms/public -I../../../sysbench -D_XOPEN_SOURCE=500 -D_GNU_SOURCE  -W -Wall -Wextra -Wpointer-arith -Wbad-function-cast   -Wstrict-prototypes -Wnested-externs -Winline   -funroll-loops  -Wundef -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wcast-align        -pthread -O2 -ggdb3 -m64 -I /u01/app/oracle/product/11.2.0/client_1/rdbms/public -MT libsboracle_a-drv_oracle.o -MD -MP -MF .deps/libsboracle_a-drv_oracle.Tpo -c -o libsboracle_a-drv_oracle.o `test -f 'drv_oracle.c' || echo './'`drv_oracle.c
In file included from /u01/app/oracle/product/11.2.0/client_1/rdbms/public/oci.h:3024,
                 from drv_oracle.c:29:
/u01/app/oracle/product/11.2.0/client_1/rdbms/public/ociap.h:10788: warning: function declaration isn’t a prototype
/u01/app/oracle/product/11.2.0/client_1/rdbms/public/o
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值