### Windows Environment Variable Setup and Build Command
Source: https://www.hammerdb.com/docs/ch01s13.html
Example of setting database configuration and Python environment variables, followed by the Windows build command. This is crucial for the build process to find all required dependencies on Windows.
```batch
set MARIADB_CONFIG=C:\Program Files\MariaDB\MariaDB Connector C 64-bit
set MYSQL_CONFIG=C:\Program Files\MySQL\MySQL Server 8.4
set PG_CONFIG=C:\Program Files\PostgreSQL\17\bin
set IBM_DB_DIR=C:\Program Files\IBM\SQLLIB
set PYTHONHOME=C:\Users\smsha\AppData\Local\Programs\Python\Python312
Build-Windows.bat x64 vs2022+gcc Setup\HammerDB-Windows.bawt update
```
--------------------------------
### HammerDB CLI Output and Configuration Summary
Source: https://www.hammerdb.com/docs/ch04s08.html
Example output from the HammerDB CLI when starting a step workload, showing the job initialization and a summary of the configuration for the primary and replica instances. This includes details on rampup, duration, and virtual users for each step.
```text
HammerDB CLI v5.0
Copyright © HammerDB Ltd hosted by tpc.org 2019-2025
Type "help" for a list of commands
Initialized Jobs on-disk database C:/Users/smsha/AppData/Local/Temp/hammer.DB using existing tables (110,592 bytes)
hammerdb>print dict
Dictionary Settings for MSSQLServer
connection {
mssqls_server = (local)
mssqls_linux_server = localhost
mssqls_tcp = false
mssqls_port = 1433
mssqls_azure = false
mssqls_authentication = windows
mssqls_msi_object_id = null
mssqls_linux_authent = sql
mssqls_odbc_driver = ODBC Driver 18 for SQL Server
mssqls_linux_odbc = ODBC Driver 18 for SQL Server
mssqls_uid = sa
mssqls_pass = admin
mssqls_encrypt_connection = true
mssqls_trust_server_cert = true
}
tpcc {
mssqls_count_ware = 1
mssqls_num_vu = 1
mssqls_dbase = tpcc
mssqls_imdb = false
mssqls_bucket = 1
mssqls_durability = SCHEMA_AND_DATA
mssqls_use_bcp = true
mssqls_total_iterations = 10000000
mssqls_raiseerror = false
```
--------------------------------
### Linux Environment Variable Setup and Build Command
Source: https://www.hammerdb.com/docs/ch01s13.html
Example of setting database configuration environment variables and then running the Linux build script. This ensures the build process can locate necessary database client libraries.
```bash
$ export PG_CONFIG=/opt/postgresql-17.2/bin
$ export MARIADB_CONFIG=/opt/mariadb-11.4.4-linux-systemd-x86_64/bin
$ export MYSQL_CONFIG=/opt/mysql-8.4.4-linux-glibc2.28-x86_64/bin
$ echo $IBM_DB_DIR /opt/ibm/sqllib
$ ./Build-Linux.sh x64 Setup/HammerDB-Linux.bawt update
```
--------------------------------
### Linux Build Summary Output
Source: https://www.hammerdb.com/docs/ch01s13.html
Example of the summary output after a successful HammerDB build on Linux. It details the setup file, build directory, architecture, compilers used, and a list of libraries built with their versions and build times.
```text
4:51:39 > Summary
Setup file : /home/redhat/HammerDB-5.0/Build/Bawt-2.1.0/Setup/HammerDB-Linux.bawt
Build directory: /home/redhat/HammerDB-5.0/Build/BawtBuild/Linux/x64/Release/Build
Architecture : x64
Compilers : gcc
Global stages : Finalize
# : Library Name Version Build time Stages
----------------------------------------------------------------------
1: Tcl 9.0.1 1.84 minutes Clean Extract Configure Compile Distribute
2: TclS 9.0.1 2.29 minutes Clean Extract Configure Compile Distribute
3: Tk 9.0.1 0.26 minutes Clean Extract Configure Compile Distribute
4: TkS 9.0.1 0.26 minutes Clean Extract Configure Compile Distribute
5: awthemes 10.4.0 0.00 minutes Clean Extract Configure Compile Distribute
6: db2tcl 2.0.1.1 0.09 minutes Clean Extract Configure Compile Distribute
7: expect 5.45.4.1 0.13 minutes Clean Extract Configure Compile Distribute
8: mariatcl 0.1.1 0.04 minutes Clean Extract Configure Compile Distribute
9: mysqltcl 3.052.1 0.04 minutes Clean Extract Configure Compile Distribute
10: oratcl 4.6.1 0.06 minutes Clean Extract Configure Compile Distribute
11: pgtcl 2.1.1.1 0.05 minutes Clean Extract Configure Compile Distribute
12: tclpy 0.4.1 0.00 minutes Clean Extract Configure Compile Distribute
13: tclpyS 0.4.1 0.01 minutes Clean Extract Configure Compile Distribute
14: ticklecharts 3.1 0.00 minutes Clean Extract Configure Compile Distribute
15: tkblt 3.2.24 0.19 minutes Clean Extract Configure Compile Distribute
16: tkpath 0.3.3.1 0.11 minutes Clean Extract Configure Compile Distribute
----------------------------------------------------------------------
Total: 5.62 minutes
```
--------------------------------
### Start HammerDB Locally
Source: https://www.hammerdb.com/docs/ch01s08.html
Execute this command in the HammerDB directory to start the application. Ensure you have the necessary permissions to run the script.
```bash
./hammerdb
```
--------------------------------
### Start Web Service via CLI
Source: https://www.hammerdb.com/docs/ch10s01.html
Initiate the HammerDB web service using the 'wsstart' command in the CLI. This command starts the service and displays version information.
```cli
hammerdb>wsstart
HammerDB Web Service v5.0
Copyright © HammerDB Ltd hosted by tpc.org 2019-2025
Type "help" for a list of commands
Starting HammerDB Web Service on port 8080
```
--------------------------------
### HammerDB CLI giset command example
Source: https://www.hammerdb.com/docs/ch09s03.html
Example of setting a dictionary variable for generic settings. Use 'print generic' to see available variables.
```shell
hammerdb>giset commandline keepalive_margin 60
Changed commandline:keepalive_margin from 10 to 60 for generic
```
--------------------------------
### HammerDB CLI diset command example
Source: https://www.hammerdb.com/docs/ch09s03.html
Example of setting a dictionary variable for the current database. Use 'print dict' to see available variables.
```shell
hammerdb>diset tpcc count_ware 10
Changed tpcc:count_ware from 1 to 10 for Oracle.
```
--------------------------------
### PostgreSQL/Redshift: Example Table Creation DDL
Source: https://www.hammerdb.com/docs/ch13s03.html
This is an example of a CREATE TABLE statement generated by pg_dump for PostgreSQL or Redshift.
```sql
CREATE TABLE customer (
c_custkey numeric NOT NULL,
c_mktsegment character(10),
c_nationkey numeric,
c_name character varying(25),
c_address character varying(40),
c_phone character(15),
c_acctbal numeric,
c_comment character varying(118)
);
```
--------------------------------
### HammerDB CLI Output Example
Source: https://www.hammerdb.com/docs/ch04s01.html
Example output from running the CPUTEST.tcl script in the HammerDB CLI. Observe the 'Time elapsed' to verify CPU performance.
```shell
hammerdb>source CPUTEST.tcl
Res = 873729.72
Time elapsed : 2.478
hammerdb>source CPUTEST.tcl
Res = 873729.72
Time elapsed : 2.512
hammerdb>source CPUTEST.tcl
Res = 873729.72
Time elapsed : 2.458
hammerdb>source CPUTEST.tcl
Res = 873729.72
Time elapsed : 2.471
hammerdb>source CPUTEST.tcl
Res = 873729.72
Time elapsed : 2.486
```
--------------------------------
### Install HammerDB using DEB
Source: https://www.hammerdb.com/docs/ch01s08.html
Install HammerDB on Ubuntu using the 'apt-get install -f' command with the .deb package. This command also installs necessary dependencies.
```bash
ubuntu@ubuntu24:~$ sudo apt-get install -f ./hammerdb_5.0-1.ubu24.amd64.deb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'hammerdb' instead of './hammerdb_5.0-1.ubu24.amd64.deb'
The following additional packages will be installed:
libmariadb3 libpq5 mariadb-common mysql-common
The following NEW packages will be installed:
hammerdb libmariadb3 libpq5 mariadb-common mysql-common
0 upgraded, 5 newly installed, 0 to remove and 317 not upgraded.
Need to get 0 B/34.3 MB of archives.
After this operation, 45.3 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
```
--------------------------------
### Install HammerDB using RPM
Source: https://www.hammerdb.com/docs/ch01s08.html
Use this command to install the HammerDB RPM package on Red Hat-based systems. Dependencies, including an X server, are automatically installed.
```bash
[root@localhost Downloads]# rpm -ivh ./hammerdb-5.0-1.el9.x86_64.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:hammerdb-5.0-1.el9 ################################# [100%]
```
--------------------------------
### Start Web Service Directly (Wait Mode)
Source: https://www.hammerdb.com/docs/ch10s01.html
Execute the HammerDB web service executable directly from the command line. With no arguments or 'wait', it starts in listening mode.
```cmd
C:\Program Files\HammerDB-5.0>hammerdbws.exe
HammerDB Web Service v5.0
Copyright © HammerDB Ltd hosted by tpc.org 2019-2025
Type "help" for a list of commands
Starting HammerDB Web Service on port 8080
```
--------------------------------
### Troubleshoot Library Loading Errors (Linux Example)
Source: https://www.hammerdb.com/docs/ch01s10.html
Example of error messages encountered when database client libraries fail to load. This indicates missing libraries or incorrect environment variable settings (e.g., LD_LIBRARY_PATH on Linux).
```bash
Checking database library for Db2
Error: failed to load db2tcl - couldn't load file "/tmp/tcl_POJlXA": libdb2.so.1: cannot open shared object file: No such file or directory
Ensure that Db2 client libraries are installed and the location in the LD_LIBRARY_PATH environment variable
Checking database library for MySQL
Error: failed to load mysqltcl - couldn't load file "/tmp/tcl_EN8Ifg": libmysqlclient.so.24: cannot open shared object file: No such file or directory
Ensure that MySQL client libraries are installed and the location in the LD_LIBRARY_PATH environment variable
```
--------------------------------
### Execute Stepped Run with Replicas
Source: https://www.hammerdb.com/docs/ch04s08.html
Initiate a stepped benchmark run with multiple replicas. This command starts the primary instance and then coordinates the startup of replica instances.
```shell
hammerdb>steprun
primary starts immediately, runs rampup for 2 minutes then runs test for 5 minutes with 2 Active VU
replica1 starts 1 minutes after rampup completes and runs test for 4 minutes with 2 Active VU
replica2 starts 1 minutes after previous replica starts and runs test for 3 minutes with 2 Active VU
replica3 starts 1 minutes after previous replica starts and runs test for 2 minutes with 2 Active VU
replica4 starts 1 minutes after previous replica starts and runs test for 1 minutes with 2 Active VU
Switch from Local
to Primary mode?
Enter yes or no: replied yes
Setting Primary Mode at id : 29248, hostname : raven
Primary Mode active at id : 29248, hostname : raven
Starting 1 replica HammerDB instance
Starting 2 replica HammerDB instance
Starting 3 replica HammerDB instance
Starting 4 replica HammerDB instance
HammerDB CLI v5.0
Copyright © HammerDB Ltd hosted by tpc.org 2019-2025
Type "help" for a list of commands
Doing wait to connect ....
HammerDB CLI v5.0
Copyright © HammerDB Ltd hosted by tpc.org 2019-2025
Type "help" for a list of commands
Primary waiting for all replicas to connect .... 0 out of 4 are connected
HammerDB CLI v5.0
Copyright © HammerDB Ltd hosted by tpc.org 2019-2025
Type "help" for a list of commands
HammerDB CLI v5.0
Copyright © HammerDB Ltd hosted by tpc.org 2019-2025
Type "help" for a list of commands
Initialized Jobs on-disk database C:/Users/smsha/AppData/Local/Temp/hammer.DB using existing tables (110,592 bytes)
Switch from Local
to Replica mode?
Initialized Jobs on-disk database C:/Users/smsha/AppData/Local/Temp/hammer.DB using existing tables (110,592 bytes)
Initialized Jobs on-disk database C:/Users/smsha/AppData/Local/Temp/hammer.DB using existing tables (110,592 bytes)
Switch from Local
to Replica mode?
Switch from Local
to Replica mode?
Enter yes or no: replied yes
Enter yes or no: replied yes
Enter yes or no: replied yes
Setting Replica Mode at id : 25020, hostname : raven
Replica connecting to localhost 29248 : Connection succeeded
Received a new replica connection from host ::1
Setting Replica Mode at id : 15472, hostname : raven
Setting Replica Mode at id : 29212, hostname : raven
Initialized Jobs on-disk database C:/Users/smsha/AppData/Local/Temp/hammer.DB using existing tables (110,592 bytes)
Switch from Local
to Replica mode?
Replica connecting to localhost 29248 : Connection succeeded
Replica connecting to localhost 29248 : Connection succeeded
Received a new replica connection from host ::1
Enter yes or no: replied yes
Received a new replica connection from host ::1
Setting Replica Mode at id : 13640, hostname : raven
New replica joined : {25020 raven}
Replica connecting to localhost 29248 : Connection succeeded
New replica joined : {25020 raven} {29212 raven}
New replica joined : {25020 raven} {29212 raven} {15472 raven}
Received a new replica connection from host ::1
New replica joined : {25020 raven} {29212 raven} {15472 raven} {13640 raven}
```
--------------------------------
### Start HammerDB Agent on Linux
Source: https://www.hammerdb.com/docs/ch07s01.html
Execute the agent program from the agent directory on Linux to start the HammerDB Metric Agent. Press Ctrl-C to exit.
```bash
$./agent
Initializing HammerDB Metric Agent 5.0
HammerDB Metric Agent active @ id 15224 hostname ubuntu22 (Ctrl-C to Exit)
```
--------------------------------
### Check Database Library Availability (Windows Example)
Source: https://www.hammerdb.com/docs/ch01s10.html
Use the 'librarycheck' command within the HammerDB CLI to verify that all necessary database client libraries are loaded successfully. This example shows the output on a Windows system.
```bash
hammerdb>librarycheck
Checking database library for Oracle
Success ... loaded library Oratcl for Oracle
Checking database library for MSSQLServer
Success ... loaded library tdbc::odbc for MSSQLServer
Checking database library for Db2
Success ... loaded library db2tcl for Db2
Checking database library for MySQL
Success ... loaded library mysqltcl for MySQL
Checking database library for PostgreSQL
Success ... loaded library Pgtcl for PostgreSQL
Checking database library for MariaDB
Success ... loaded library mariatcl for MariaDB
```
--------------------------------
### Check Database Library Availability (Linux Example)
Source: https://www.hammerdb.com/docs/ch01s10.html
Use the 'librarycheck' command within the HammerDB CLI to verify that all necessary database client libraries are loaded successfully. This example shows the output on a Linux system.
```bash
hammerdb>librarycheck
Checking database library for Oracle
Success ... loaded library Oratcl for Oracle
Checking database library for MSSQLServer
Success ... loaded library tdbc::odbc for MSSQLServer
Checking database library for Db2
Success ... loaded library db2tcl for Db2
Checking database library for MySQL
Success ... loaded library mysqltcl for MySQL
Checking database library for PostgreSQL
Success ... loaded library Pgtcl for PostgreSQL
Checking database library for MariaDB
Success ... loaded library mariatcl for MariaDB
hammerdb>
```
--------------------------------
### Example HammerDB CLI script for job execution
Source: https://www.hammerdb.com/docs/ch09s12.html
An example Tcl script demonstrating how to configure and run a workload using the HammerDB CLI, capturing the job ID.
```tcl
dbset db mssqls
diset tpcc mssqls_driver timed
diset tpcc mssqls_rampup 2
diset tpcc mssqls_duration 5
diset tpcc mssqls_timeprofile true
loadscript
vuset vu vcpu
vucreate
tcstart
set jobid [ vurun ]
tcstop
vudestroy
puts "jobid is $jobid"
```
--------------------------------
### Execute SQL Script in SQL*Plus
Source: https://www.hammerdb.com/docs/ch13s03.html
This example shows how to connect to an Oracle database using SQL*Plus and execute a script named 'tpch_tables.sql' to create tables.
```sql
sqlplus tpch/tpch
SQL*Plus: Release 12.1.0.2.0 Production
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0
SQL> @tpch_tables.sql
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
Table created.
SQL>
```
--------------------------------
### HammerDB CLI Output Example
Source: https://www.hammerdb.com/docs/ch09s10.html
This is an example of the output generated when running a Python script via the HammerDB CLI. It shows the configuration steps, test execution for different virtual user counts, and final results.
```text
C:\Program Files\HammerDB-5.0>hammerdbcli.exe py
HammerDB CLI v5.0
Copyright © HammerDB Ltd hosted by tpc.org 2019-2025
Type "help()" for a list of commands
hammerdb>>>source('cliexample.py')
hammerdb>>>SETTING CONFIGURATION
Database set to MSSQLServer
Value timed for tpcc:mssqls_driver is the same as existing value timed, no change made
Value 0 for tpcc:mssqls_rampup is the same as existing value 0, no change made
Value 1 for tpcc:mssqls_duration is the same as existing value 1, no change made
Script loaded, Type "print script" to view
SEQUENCE STARTED
1 VU TEST
Vuser 1 created MONITOR - WAIT IDLE
Vuser 2 created - WAIT IDLE
Logging activated
to C:/temp/hammerdb.log
2 Virtual Users Created with Monitor VU
Vuser 1:RUNNING
Vuser 1:DBVersion:16.0.1135.2
Vuser 1:Beginning rampup time of 0 minutes
Vuser 1:Rampup complete, Taking start Transaction Count.
Vuser 1:Timing test period of 1 in minutes
Vuser 2:RUNNING
Vuser 2:Processing 10000000 transactions with output suppressed...
Vuser 1:1 ...,
Vuser 1:Test complete, Taking end Transaction Count.
Vuser 1:1 Active Virtual Users configured
Vuser 1:TEST RESULT : System achieved 92488 NOPM from 214855 SQL Server TPM
Vuser 1:FINISHED SUCCESS
Vuser 2:FINISHED SUCCESS
ALL VIRTUAL USERS COMPLETE
vudestroy success
2 VU TEST
Vuser 1 created MONITOR - WAIT IDLE
Vuser 2 created - WAIT IDLE
Vuser 3 created - WAIT IDLE
Logging activated
to C:/temp/hammerdb.log
3 Virtual Users Created with Monitor VU
Vuser 1:RUNNING
Vuser 1:DBVersion:16.0.1135.2
Vuser 1:Beginning rampup time of 0 minutes
Vuser 1:Rampup complete, Taking start Transaction Count.
Vuser 1:Timing test period of 1 in minutes
Vuser 2:RUNNING
Vuser 2:Processing 10000000 transactions with output suppressed...
Vuser 3:RUNNING
Vuser 3:Processing 10000000 transactions with output suppressed...
Vuser 1:1 ...,
Vuser 1:Test complete, Taking end Transaction Count.
Vuser 1:2 Active Virtual Users configured
Vuser 1:TEST RESULT : System achieved 207184 NOPM from 482159 SQL Server TPM
Vuser 1:FINISHED SUCCESS
Vuser 3:FINISHED SUCCESS
Vuser 2:FINISHED SUCCESS
ALL VIRTUAL USERS COMPLETE
vudestroy success
4 VU TEST
Vuser 1 created MONITOR - WAIT IDLE
Vuser 2 created - WAIT IDLE
Vuser 3 created - WAIT IDLE
Vuser 4 created - WAIT IDLE
Vuser 5 created - WAIT IDLE
Logging activated
to C:/temp/hammerdb.log
5 Virtual Users Created with Monitor VU
Vuser 1:RUNNING
Vuser 1:DBVersion:16.0.1135.2
Vuser 1:Beginning rampup time of 0 minutes
Vuser 1:Rampup complete, Taking start Transaction Count.
Vuser 1:Timing test period of 1 in minutes
Vuser 2:RUNNING
Vuser 2:Processing 10000000 transactions with output suppressed...
Vuser 3:RUNNING
Vuser 3:Processing 10000000 transactions with output suppressed...
Vuser 4:RUNNING
Vuser 4:Processing 10000000 transactions with output suppressed...
Vuser 5:RUNNING
Vuser 5:Processing 10000000 transactions with output suppressed...
Vuser 1:1 ...,
Vuser 1:Test complete, Taking end Transaction Count.
Vuser 1:4 Active Virtual Users configured
Vuser 1:TEST RESULT : System achieved 248089 NOPM from 577727 SQL Server TPM
Vuser 1:FINISHED SUCCESS
Vuser 4:FINISHED SUCCESS
Vuser 3:FINISHED SUCCESS
Vuser 5:FINISHED SUCCESS
Vuser 2:FINISHED SUCCESS
ALL VIRTUAL USERS COMPLETE
vudestroy success
TEST SEQUENCE COMPLETE
hammerdb>>>
```
--------------------------------
### Start Metrics Agent
Source: https://www.hammerdb.com/docs/ch09s08.html
Initiates the local metrics agent for collecting system performance data, such as CPU usage. The agent will connect and begin sending metrics.
```shell
hammerdb>metstart
Starting Local Metrics Agent on raven
after#244
hammerdb>Initializing HammerDB Metric Agent 5.0
HammerDB Metric Agent active @ id 27768 hostname raven (Ctrl-C to Exit)
Connecting to Agent to Display CPU Metrics
Metric receive port open @ 15748 on raven
Connecting to HammerDB Agent @ raven:27768
Testing Agent Connectivity...OK
Received a new display request from host fe80::a3b7:309e:a58d:3658%11
Metrics Connected
New display accepted @ 15748 raven
Prepared CPU metrics for Intel(R) Core(TM) i9-14900KS
12 MSSQLServer tpm
Started CPU Metrics for Intel(R) Core(TM) i9-14900KS:(32 CPUs)
Sending CPU metrics to 15748 raven ...connection established
```
--------------------------------
### Example Time Profile Log Output
Source: https://www.hammerdb.com/docs/ch04s08.html
This example log output demonstrates the messages generated during a HammerDB time profile run. It shows virtual user completion, test results, and warnings about incomplete timing data if not all users report.
```text
Vuser 1:Test complete, Taking end Transaction Count.
Vuser 1:5 VU * 10 AC = 50 Active Sessions configured
Vuser 1:TEST RESULT : System achieved 53 NOPM from 399 PostgreSQL TPM
Vuser 1:Gathering timing data from Active Virtual Users...
Vuser 4:All asynchronous clients complete
Vuser 5:All asynchronous clients complete
Vuser 3:All asynchronous clients complete
Vuser 2:All asynchronous clients complete
Vuser 1:WARNING:Timing Data Incomplete
Vuser 1:4 out of 5 Virtual Users reported
Vuser 1:Writing timing data to /tmp/hdbxtprofile.log
```
--------------------------------
### Install Development Tools on Red Hat Linux
Source: https://www.hammerdb.com/docs/ch01s13.html
Installs essential development tools including the GCC compiler, p7zip, and Xft font library for building HammerDB. Ensure you have the necessary RPM package for p7zip.
```bash
yum install p7zip-16.02-20.el8.x86_64.rpm
sudo yum install libXft-devel
yum group install "Development Tools"
```
--------------------------------
### TPROC-H Example Query
Source: https://www.hammerdb.com/docs/ch11s01.html
This SQL query is an example of the ad-hoc queries executed in the TPROC-H workload. It calculates aggregated values from the lineitem table based on ship date and groups the results by return flag and line status.
```sql
-- using 647655760 as a seed to the RNG
select
l_returnflag,
l_linestatus,
sum(l_quantity) as sum_qty,
sum(l_extendedprice) as sum_base_price,
sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
avg(l_quantity) as avg_qty,
avg(l_extendedprice) as avg_price,
avg(l_discount) as avg_disc,
count(*) as count_order
from
lineitem
where
l_shipdate <= date '1998-12-01' – interval '69' day (3)
group by
l_returnflag,
l_linestatus
order by
l_returnflag,
l_linestatus;
```
--------------------------------
### Start Transaction Counter
Source: https://www.hammerdb.com/docs/ch09s08.html
Activates the transaction counter to begin collecting transaction data.
```shell
hammerdb>tcstart
Transaction Counter Started
hammerdb>0 MSSQLServer tpm
```
--------------------------------
### Start HammerDB CLI (Windows)
Source: https://www.hammerdb.com/docs/ch09s01.html
On Windows, double-click the hammerdbcli.bat file to launch the command-line interface. This will open a console window with a specific color scheme.
```batch
hammerdbcli.bat
```
--------------------------------
### Change HammerDB Ownership
Source: https://www.hammerdb.com/docs/ch01s08.html
Change the ownership of the HammerDB installation directory to a specific OS user and group, for example, 'redhat'.
```bash
[root@localhost opt]# chown -R redhat:redhat HammerDB-5.0/
[root@localhost opt]# ls -l HammerDB-5.0/
total 31124
drwxr-xr-x. 2 redhat redhat 19 Apr 9 14:36 agent
drwxr-xr-x. 3 redhat redhat 4096 Apr 9 14:36 config
-rwxr-xr-x. 1 redhat redhat 12819442 Mar 24 14:18 hammerdb
-rwxr-xr-x. 1 redhat redhat 11022274 Mar 24 14:18 hammerdbcli
-rwxr-xr-x. 1 redhat redhat 7981127 Mar 24 14:18 hammerdbws
-rw-r--r--. 1 redhat redhat 35149 Mar 24 14:18 LICENSE
drwxr-xr-x. 3 redhat redhat 24 Apr 9 14:36 pylib
-rw-r--r--. 1 redhat redhat 518 Mar 24 14:18 README.md
drwxr-xr-x. 4 redhat redhat 31 Apr 9 14:36 scripts
```
--------------------------------
### Start Step Workload with steprun Command
Source: https://www.hammerdb.com/docs/ch04s08.html
Initiate a step workload by configuring a driver script and using the 'steprun' command instead of 'vurun'. This command automates the creation, configuration, and execution of replica instances at specified intervals.
```bash
dbset db mssqls
dbset bm TPC-C
diset connection mssqls_server {(local)\SQLDEVELOP}
diset tpcc mssqls_dbase tpcc
diset tpcc mssqls_total_iterations 10000000
diset tpcc mssqls_driver timed
diset tpcc mssqls_rampup 2
diset tpcc mssqls_duration 5
vuset logtotemp 1
vuset vu 2
steprun
```
--------------------------------
### Configure Replicas for Step Testing in steps.xml
Source: https://www.hammerdb.com/docs/ch04s08.html
Define replica configurations for step testing in the steps.xml file. Each replica can have a specified start delay, duration, and number of virtual users. Ensure the configuration resembles a pyramid, with replicas not overrunning the primary's base duration.
```xml
1
4
2
1
3
2
1
2
2
1
1
2
```
--------------------------------
### Print Dictionary Settings
Source: https://www.hammerdb.com/docs/ch09s06.html
Display all current configuration settings for the selected database and workload. This command confirms changes made to parameters like driver, ramp-up, and duration.
```cli
hammerdb>print dict
Dictionary Settings for MSSQLServer
connection {
mssqls_server = (local)
mssqls_linux_server = localhost
mssqls_tcp = false
mssqls_port = 1433
mssqls_azure = false
mssqls_authentication = windows
mssqls_msi_object_id = null
mssqls_linux_authent = sql
mssqls_odbc_driver = ODBC Driver 18 for SQL Server
mssqls_linux_odbc = ODBC Driver 18 for SQL Server
mssqls_uid = sa
mssqls_pass = admin
mssqls_encrypt_connection = true
mssqls_trust_server_cert = true
}
tpcc {
mssqls_count_ware = 10
mssqls_num_vu = 4
mssqls_dbase = tpcc
mssqls_imdb = false
mssqls_bucket = 1
mssqls_durability = SCHEMA_AND_DATA
mssqls_use_bcp = true
mssqls_total_iterations = 10000000
mssqls_raiseerror = false
mssqls_keyandthink = false
mssqls_checkpoint = false
mssqls_driver = timed
mssqls_rampup = 1
mssqls_duration = 3
mssqls_allwarehouse = false
mssqls_timeprofile = false
mssqls_async_scale = false
mssqls_async_client = 10
mssqls_async_verbose = false
mssqls_async_delay = 1000
mssqls_connect_pool = false
}
```
--------------------------------
### Oracle CREATE TABLE Statement Example
Source: https://www.hammerdb.com/docs/ch13s03.html
This is an example of a generated CREATE TABLE statement for the ORDERS table in Oracle.
```sql
CREATE TABLE "TPCH"."ORDERS"
("O_ORDERDATE" DATE,
"O_ORDERKEY" NUMBER NOT NULL ENABLE,
"O_CUSTKEY" NUMBER NOT NULL ENABLE,
"O_ORDERPRIORITY" CHAR(15),
"O_SHIPPRIORITY" NUMBER,
"O_CLERK" CHAR(15),
"O_ORDERSTATUS" CHAR(1),
"O_TOTALPRICE" NUMBER,
"O_COMMENT" VARCHAR2(79),
CONSTRAINT "ORDERS_PK" PRIMARY KEY ("O_ORDERKEY")
);
```
--------------------------------
### Use All Warehouses Option Example Output
Source: https://www.hammerdb.com/docs/ch04s08.html
This output demonstrates how warehouses are assigned to virtual users when the 'Use All Warehouses' option is enabled. It shows the distribution of warehouse IDs (WIDs) among virtual users for increased I/O.
```text
Vuser 1:Beginning rampup time of 2 minutes
Vuser 2:Assigned 10 WIDs = 1 4 7 10 13 16 19 22 25 28 based on VU count 3, Warehouses = 10 out of 30
Vuser 2:Processing 10000000 transactions with output suppressed...
Vuser 3:Assigned 10 WIDs = 2 5 8 11 14 17 20 23 26 29 based on VU count 3, Warehouses = 10 out of 30
Vuser 3:Processing 10000000 transactions with output suppressed...
Vuser 4:Assigned 10 WIDs = 3 6 9 12 15 18 21 24 27 30 based on VU count 3, Warehouses = 10 out of 30
Vuser 4:Processing 10000000 transactions with output suppressed...
```
--------------------------------
### Verify HammerDB Installation Directory
Source: https://www.hammerdb.com/docs/ch01s08.html
After installation, HammerDB is typically located in the /opt directory. Use 'pwd' to confirm the current working directory.
```bash
[root@localhost HammerDB-5.0]# pwd
/opt/HammerDB-5.0
```
--------------------------------
### Verify HammerDB Installation File Integrity on Linux
Source: https://www.hammerdb.com/docs/ch01s06.html
Use md5sum and sha1sum commands on Linux to verify the integrity of the HammerDB installation file.
```bash
md5sum HammerDB-5.0-Prod-Lin-RHEL8.tar.gz
```
```bash
sha1sum HammerDB-5.0-Prod-Lin-RHEL8.tar.gz
```
--------------------------------
### Install Xft Font on Ubuntu
Source: https://www.hammerdb.com/docs/ch01s01.html
Use this command to install the Xft FreeType-based font drawing library on Ubuntu systems, which is required for the HammerDB GUI.
```bash
$ sudo apt-get install libxft-dev
```
--------------------------------
### Verify MariaDB Databases and Tables
Source: https://www.hammerdb.com/docs/ch12s04.html
Use 'show databases;' to list available databases and 'use ; show tables;' to list tables within a specific database. This confirms the schema build.
```sql
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| tpch |
+--------------------+
4 rows in set (0.00 sec)
MariaDB [(none)]> use tpch;
Database changed
MariaDB [tpch]> show tables;
+----------------+
| Tables_in_tpch |
+----------------+
| CUSTOMER |
| LINEITEM |
| NATION |
| ORDERS |
| PART |
| PARTSUPP |
| REGION |
| SUPPLIER |
+----------------+
8 rows in set (0.00 sec)
```
--------------------------------
### Db2 CREATE TABLE Statement Example
Source: https://www.hammerdb.com/docs/ch13s03.html
This is an example of a generated CREATE TABLE statement for the ORDERS table in Db2, including storage and organization clauses.
```sql
CREATE TABLE "DB2INST1"."ORDERS" (
"O_ORDERKEY" INTEGER NOT NULL ,
"O_CUSTKEY" INTEGER NOT NULL ,
"O_ORDERSTATUS" CHAR(1 OCTETS) NOT NULL ,
"O_TOTALPRICE" DOUBLE NOT NULL ,
"O_ORDERDATE" DATE NOT NULL ,
"O_ORDERPRIORITY" CHAR(15 OCTETS) NOT NULL ,
"O_CLERK" CHAR(15 OCTETS) NOT NULL ,
"O_SHIPPRIORITY" INTEGER ,
"O_COMMENT" VARCHAR(79 OCTETS) NOT NULL )
IN "USERSPACE1"
ORGANIZE BY ROW;
```
--------------------------------
### Remove HammerDB Tar.gz Installation
Source: https://www.hammerdb.com/docs/ch01s08.html
To uninstall HammerDB installed from a tar.gz file, simply remove the extracted HammerDB-5.0 directory using the 'rm -rf' command.
```bash
rm -rf HammerDB-5.0
```
--------------------------------
### Use and Show MySQL Tables
Source: https://www.hammerdb.com/docs/ch04s06.html
Select a MySQL database to use and then list all tables within it. This is useful for verifying schema contents.
```sql
mysql> use tpcc;
Database changed
mysql> show tables;
+----------------+
| Tables_in_tpcc |
+----------------+
| customer |
| district |
| history |
| item |
| new_order |
| order_line |
| orders |
| stock |
| warehouse |
+----------------+
9 rows in set (0.00 sec)
```
--------------------------------
### Install Cairo Graphics on Ubuntu
Source: https://www.hammerdb.com/docs/ch01s01.html
Use this command to install Cairo Graphics on Ubuntu systems, which is required for the HammerDB GUI's graphical transaction counter.
```bash
sudo apt-get install libcairo2-dev
```
--------------------------------
### Install Xft Font on Red Hat
Source: https://www.hammerdb.com/docs/ch01s01.html
Use this command to install the Xft FreeType-based font drawing library on Red Hat systems, which is required for the HammerDB GUI.
```bash
$ yum install libXft
```
--------------------------------
### Execute Db2 SQL Script
Source: https://www.hammerdb.com/docs/ch13s03.html
This example shows how to execute a Db2 SQL script file named 'tpchcreate.sql' using the 'db2 -tvf' command, which includes CONNECT and CREATE TABLE statements.
```bash
db2 -tvf tpchcreate.sql
CONNECT TO TPCH
Database Connection Information
Database server = DB2/LINUXX8664 11.1.0
SQL authorization ID = DB2INST1
Local database alias = TPCH2
CREATE SCHEMA "DB2INST1"
DB20000I The SQL command completed successfully.
CREATE TABLE "DB2INST1"."ORDERS" ( "O_ORDERKEY" INTEGER NOT NULL , "O_CUSTKEY" INTEGER NOT NULL , "O_ORDERSTATUS" CHAR(1 OCTETS) NOT NULL , "O_TOTALPRICE" DOUBLE NOT NULL , "O_ORDERDATE" DATE NOT NULL , "O_ORDERPRIORITY" CHAR(15 OCTETS) NOT NULL , "O_CLERK" CHAR(15 OCTETS) NOT NULL , "O_SHIPPRIORITY" INTEGER , "O_COMMENT" VARCHAR(79 OCTETS) NOT NULL ) IN "USERSPACE1" ORGANIZE BY ROW
DB20000I The SQL command completed successfully.
```
--------------------------------
### Verify HammerDB Installation File Integrity on Windows
Source: https://www.hammerdb.com/docs/ch01s06.html
Use the Microsoft File Checksum Integrity Verifier (fciv) to verify the integrity of the HammerDB installation file on Windows.
```bash
fciv -both HammerDB-5.0-Prod-Win.tar.gz
```
--------------------------------
### Start and Stop Db2 Database Manager
Source: https://www.hammerdb.com/docs/ch04s02.html
Use the `db2stop` and `db2start` commands to manage the Db2 database manager service. These commands are essential for ensuring the database is available for connections.
```bash
db2stop
04/12/2015 10:12:27 0 0 SQL1064N DB2STOP processing was successful.
SQL1064N DB2STOP processing was successful.
```
```bash
db2start
12/04/2015 10:12:31 0 0 SQL1063N DB2START processing was successful.
SQL1063N DB2START processing was successful.
```
--------------------------------
### Create and Configure Db2 Database for HammerDB
Source: https://www.hammerdb.com/docs/ch04s02.html
Manually create a Db2 database and configure its parameters, such as buffer pools and transaction logs, using `db2` commands. Pay attention to `LOGFILSIZ` to avoid log full errors.
```bash
db2 create database tpcc pagesize 8 k
DB20000I The CREATE DATABASE command completed successfully.
```
```bash
db2 update db cfg for tpcc using PCKCACHESZ 1631072
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
```
```bash
db2 update db cfg for tpcc using LOGFILSIZ 1048572
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
```
```bash
db2 update db cfg for tpcc using LOGPRIMARY 25
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
```
```bash
db2 update db cfg for tpcc using LOGSECOND 5
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
```
```bash
db2 update db cfg for tpcc using LOGBUFSZ 17264
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
```
```bash
db2 update db cfg for tpcc using MINCOMMIT 1
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
```
```bash
db2 update db cfg for tpcc using NUM_IOSERVERS AUTOMATIC
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
```
```bash
db2 update db cfg for tpcc using DFT_PREFETCH_SZ AUTOMATIC
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
```
```bash
db2 update db cfg for tpcc using LOCKTIMEOUT 15
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
```
```bash
db2 update db cfg for tpcc using SOFTMAX 2500
DB20000I The UPDATE DATABASE CONFIGURATION command completed successfully.
```
--------------------------------
### List Oracle Client Libraries
Source: https://www.hammerdb.com/docs/ch01s10.html
This command lists the symbolic links and the actual library file for the Oracle client. It shows how different versions link to a specific libclntsh.so file.
```bash
ls -l libclntsh.so*
```
--------------------------------
### Install Cairo Graphics on Red Hat
Source: https://www.hammerdb.com/docs/ch01s01.html
Use this command to install Cairo Graphics on Red Hat systems, which is required for the HammerDB GUI's graphical transaction counter.
```bash
ymu install cairo-devel
```
--------------------------------
### Start and Stop Oracle Trace Session
Source: https://www.hammerdb.com/docs/ch14s01.html
Use these SQL commands to interactively start and stop an Oracle trace session with event 10046, level 4, to capture bind variables.
```sql
SQL> connect / as sysdba
Connected.
SQL> alter session set events '10046 trace name context forever, level 4';
Session altered.
...
SQL> alter session set events '10046 trace name context off';
Session altered.
SQL>
```
--------------------------------
### Initialize HammerDB CLI and Jobs Database
Source: https://www.hammerdb.com/docs/ch09s12.html
Starts the HammerDB CLI and initializes the jobs on-disk database. This message appears on startup if jobs are enabled and the database is successfully initialized.
```shell
C:\Program Files\HammerDB-5.0>hammerdbcli.exe
HammerDB CLI v5.0
Copyright © HammerDB Ltd hosted by tpc.org 2019-2025
Type "help" for a list of commands
Initialized Jobs on-disk database C:/temp/hammer.DB using existing tables (274,432 bytes)
hammerdb>
```
--------------------------------
### Example Oracle Error Output
Source: https://www.hammerdb.com/docs/ch14s04.html
This is an example of the detailed output captured when an Oracle error occurs during replay, such as 'PLS-00201: identifier 'NEWORD' must be declared', providing more context than a generic failure message.
```text
new order
{6550 {ORA-06550: line 1, column 7:
PLS-00201: identifier 'NEWORD' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored} 0 0 4 8}
```
--------------------------------
### Set Environment Variables for HammerDB Build on Windows
Source: https://www.hammerdb.com/docs/ch01s13.html
Configure environment variables for database and Python installations to facilitate the HammerDB build process on Windows. Ensure these paths point to the correct installation directories.
```batch
set MARIADB_CONFIG=C:\Program Files\MariaDB\MariaDB Connector C 64-bit
set MYSQL_CONFIG=C:\Program Files\MySQL\MySQL Server 8.4
set PG_CONFIG=C:\Program Files\PostgreSQL\17\bin
set IBM_DB_DIR=C:\Program Files\IBM\SQLLIB
set PYTHONHOME=C:\Users\smsha\AppData\Local\Programs\Python\Python312
```
--------------------------------
### Select Benchmark with dbset Command
Source: https://www.hammerdb.com/docs/ch09s04.html
Use `dbset bm` to select a benchmark. TPROC-C and TPC-C, as well as TPROC-H and TPC-H, are interchangeable for backward compatibility.
```shell
hammerdb>dbset bm TPROC-H
Benchmark set to TPROC-H for MSSQLServer
```
```shell
hammerdb>dbset bm TPC-C
Benchmark set to TPC-C for MSSQLServer
```
--------------------------------
### MySQL: Source SQL File for Table Creation
Source: https://www.hammerdb.com/docs/ch13s03.html
Execute a SQL file containing table creation statements using the 'source' command in the MySQL client.
```sql
sql> use tpch
Database changed
mysql> source /home/mysql/TPCHDATA/createtpch.sql
Query OK, 0 rows affected (0.08 sec)
Query OK, 0 rows affected (0.07 sec)
Query OK, 0 rows affected (0.05 sec)
Query OK, 0 rows affected (0.05 sec)
Query OK, 0 rows affected (0.05 sec)
Query OK, 0 rows affected (0.06 sec)
Query OK, 0 rows affected (0.05 sec)
Query OK, 0 rows affected (0.05 sec)
mysql>
```