Setting Up Swingbench on Oracle AI Database 26ai Free

Categories: Oracle Database · Performance · Installation and upgrades · Swingbench

Swingbench is one of the tools I use the most in my trainings. When I want to show what a wait event looks like, how an AWR report changes under load, or what happens when more users hit the database, I need a workload that I can start and stop whenever I want. Swingbench gives me that in a few minutes. It’s a free load generator for Oracle written by Dominic Giles, and it comes with several benchmarks and the wizards that build their schemas.

This is the first post of a short series. Here I set up Swingbench on Oracle and build the Order Entry schema, called SOE. In the next posts I’ll move the same data to PostgreSQL and MySQL, so the three databases in my lab have the same rows to play with.

My lab is a VM with Oracle Linux 9.8, 4 vCPUs and 9 GB of RAM, running Oracle AI Database 26ai Free (23.26.4). Everything goes into a PDB called BLOG. Keep in mind that the Free edition uses at most 2 CPUs, 2 GB of RAM and 12 GB of user data, so this is a small box. All the output below is copied from my lab. The only change I made was to remove the color codes that sbutil prints.

Step 1: Install Java

Swingbench needs Java 17 or later. Oracle Linux 9 has OpenJDK 21 in the AppStream repository. The headless package is enough because I only use the command line tools.

[root@dblab ~]# dnf install -y -q java-21-openjdk-headless unzip

Installed:
  copy-jdk-configs-4.0-3.el9.noarch                                             
  java-21-openjdk-headless-1:21.0.13.1.2-1.2.0.1.el9.x86_64                     
  javapackages-filesystem-6.4.0-1.el9.noarch                                    
  lksctp-tools-1.0.19-3.el9_4.x86_64                                            
  lua-5.4.4-4.el9.x86_64                                                        
  lua-posix-35.0-8.el9.x86_64                                                   
  tzdata-java-2026f-1.el9_9.noarch                                              

[root@dblab ~]# java -version
openjdk version "21.0.13.1" 2026-11-17 LTS
OpenJDK Runtime Environment (Red_Hat-21.0.13.1.2-1.1) (build 21.0.13.1+2-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-21.0.13.1.2-1.1) (build 21.0.13.1+2-LTS, mixed mode, sharing)

Step 2: Download Swingbench

The latest build is on Dominic’s site, in a single zip file. I download it as the oracle user and unzip it in the home directory.

[oracle@dblab ~]$ curl -sSLO https://downloads.dominicgiles.com/swingbenchlatest.zip
[oracle@dblab ~]$ ls -lh swingbenchlatest.zip
-rw-r--r--. 1 oracle oinstall 49M Dec  5 21:07 swingbenchlatest.zip
[oracle@dblab ~]$ unzip -q swingbenchlatest.zip
[oracle@dblab ~]$ ls swingbench
bin
configs
launcher
lib
log
README.md
resources
source
sql
utils
winbin
wizardconfigs
[oracle@dblab ~]$ ls swingbench/bin
charbench
compareresults2pdf
coordinator
data
jsonsocialwizard
jsonwizard
mergeremoteresults
minibench
moviewizard
oewizard
results2pdf
results2text
sbutil
sbweb
shwizard
sqlbuilder
swingbench
tpccwizard
tpcdswizard
tpchwizard

The bin directory has the wizards (oewizard, shwizard, tpccwizard and others), the load generators (swingbench, minibench and charbench) and sbutil, a helper to check and change a schema after it’s built.

Step 3: Create a tablespace for SOE

The wizard can create the tablespace for you, but I like to create it myself, so I decide where the datafile goes and how much it can grow. This is the script, 03_tablespace.sql:

set echo on
alter session set container = BLOG;
create tablespace soe
  datafile '/opt/oracle/oradata/FREE/BLOG/soe01.dbf' size 1g
  autoextend on next 256m maxsize 10g;
select tablespace_name, bigfile, status from dba_tablespaces where tablespace_name = 'SOE';
exit

I run it as oracle with OS authentication, so no password is needed here:

[oracle@dblab ~]$ cd swingbench_blog; sqlplus -s / as sysdba @03_tablespace.sql

Session altered.


Tablespace created.


TABLESPACE_NAME 	       BIG STATUS
------------------------------ --- ---------
SOE			       YES ONLINE

The tablespace is a bigfile tablespace. I didn’t ask for it: bigfile is the default for new tablespaces since 23ai.

Step 4: Build the SOE schema with oewizard

The wizard needs two passwords: the one for the DBA account that creates the schema, and the one for the new SOE user. I keep them in two shell variables, so they don’t show up in the commands:

[oracle@dblab ~]$ export SYS_PWD='<the SYS password>'
[oracle@dblab ~]$ export SOE_PWD='<the password for the new SOE user>'
[oracle@dblab ~]$ cd ~/swingbench/bin

These are the options I use:

  • -cl -create: run in character mode and create the schema
  • -cs //localhost:1521/blog: connect to the service of the BLOG PDB
  • -u soe -p "$SOE_PWD": the user the wizard creates, and its password
  • -dba "sys as sysdba" -dbap "$SYS_PWD": the account that creates the user and grants its privileges
  • -ts soe: the tablespace from step 3
  • -scale 1: how much data to generate; scale 1 gives 1 million customers
  • -tc 4: four threads to generate the data
  • -nc: no colors in the output
[oracle@dblab bin]$ ./oewizard -cl -create -cs //localhost:1521/blog -u soe -p "$SOE_PWD" -dba "sys as sysdba" -dbap "$SYS_PWD" -ts soe -scale 1 -tc 4 -nc
SwingBench Wizard
Author  :	Dominic Giles
Version :	2.8.0.1630

Running in Lights Out Mode using config file : ../wizardconfigs/oewizard.xml

Data Generation Runtime Metrics
+-------------------------+-------------+
| Description             | Value       |
+-------------------------+-------------+
| Connection Time         | 0:00:00.004 |
| Data Generation Time    | 0:02:23.176 |
| DDL Creation Time       | 0:02:02.437 |
| Total Run Time          | 0:04:25.620 |
| Rows Inserted per sec   | 110,806     |
| Actual Rows Generated   | 15,867,557  |
| Commits Completed       | 827         |
| Batch Updates Completed | 79,373      |
+-------------------------+-------------+

Validation Report 
The schema appears to have been created successfully.

Valid Objects
Valid Tables : 'ORDERS','ORDER_ITEMS','CUSTOMERS','WAREHOUSES','ORDERENTRY_METADATA','INVENTORIES','PRODUCT_INFORMATION','PRODUCT_DESCRIPTIONS','ADDRESSES','CARD_DETAILS'
Valid Indexes : 'PRD_DESC_PK','PROD_NAME_IX','PRODUCT_INFORMATION_PK','PROD_SUPPLIER_IX','PROD_CATEGORY_IX','INVENTORY_PK','INV_PRODUCT_IX','INV_WAREHOUSE_IX','ORDER_PK','ORD_SALES_REP_IX','ORD_CUSTOMER_IX','ORD_ORDER_DATE_IX','ORD_WAREHOUSE_IX','ORDER_ITEMS_PK','ITEM_ORDER_IX','ITEM_PRODUCT_IX','WAREHOUSES_PK','WHS_LOCATION_IX','CUSTOMERS_PK','CUST_EMAIL_IX','CUST_ACCOUNT_MANAGER_IX','CUST_FUNC_LOWER_NAME_IX','ADDRESS_PK','ADDRESS_CUST_IX','CARD_DETAILS_PK','CARDDETAILS_CUST_IX'
Valid Views : 'PRODUCTS','PRODUCT_PRICES'
Valid Sequences : 'CUSTOMER_SEQ','ORDERS_SEQ','ADDRESS_SEQ','LOGON_SEQ','CARD_DETAILS_SEQ'
Valid Code : 'ORDERENTRY'
Schema Created

Four and a half minutes for almost 16 million rows. Generating the data took 2:23 and the DDL part (indexes, constraints and the rest) took 2:02. At the end the wizard validates the schema: 10 tables, 26 indexes, 2 views, 5 sequences and the ORDERENTRY PL/SQL package.

Step 5: Check the schema with sbutil

sbutil checks the schema again and shows the tables. It’s the tool to use if a build fails halfway: it can rebuild the indexes, the sequences or the PL/SQL package without running the whole wizard again.

[oracle@dblab bin]$ ./sbutil -soe -cs //localhost:1521/blog -u soe -p "$SOE_PWD" -val
The Order Entry Schema appears to be valid.
--------------------------------------------------
|Object Type    |     Valid|   Invalid|   Missing|
--------------------------------------------------
|Table          |        10|         0|         0|
|Index          |        26|         0|         0|
|Sequence       |         5|         0|         0|
|View           |         2|         0|         0|
|Code           |         1|         0|         0|
--------------------------------------------------
[oracle@dblab bin]$ ./sbutil -soe -cs //localhost:1521/blog -u soe -p "$SOE_PWD" -tables
Order Entry Schemas Tables
+----------------------+-----------+--------+---------+-------------+--------------+
| Table Name           | Rows      | Blocks | Size    | Compressed? | Partitioned? |
+----------------------+-----------+--------+---------+-------------+--------------+
| ORDER_ITEMS          | 7,149,285 | 66,724 | 524.0MB | Disabled    | No           |
| ORDERS               | 1,429,790 | 25,414 | 200.0MB | Disabled    | No           |
| INVENTORIES          | 902,498   | 23,229 | 183.0MB | Disabled    | No           |
| CUSTOMERS            | 1,000,000 | 20,314 | 160.0MB | Disabled    | No           |
| ADDRESSES            | 1,500,000 | 17,254 | 136.0MB | Disabled    | No           |
| CARD_DETAILS         | 1,500,000 | 12,154 | 96.0MB  | Disabled    | No           |
| LOGON                | 2,382,984 | 8,074  | 64.0MB  | Disabled    | No           |
| PRODUCT_DESCRIPTIONS | 1,000     | 35     | 320KB   | Disabled    | No           |
| PRODUCT_INFORMATION  | 1,000     | 28     | 256KB   | Disabled    | No           |
| WAREHOUSES           | 1,000     | 5      | 64KB    | Disabled    | No           |
| ORDERENTRY_METADATA  | 0         | 0      | 64KB    | Disabled    | No           |
+----------------------+-----------+--------+---------+-------------+--------------+
                                Total Space     1.3GB

-tables also lists LOGON, a table that the wizard’s validation doesn’t check. It only shows the tables, though. With the indexes, the schema takes 2.2 GB. I checked that as SYSDBA, again with OS authentication:

alter session set container = BLOG;

select segment_type, round(sum(bytes)/1024/1024) mb
from   dba_segments
where  owner = 'SOE'
group  by rollup(segment_type)
order  by 2;
Session altered.


SEGMENT_TYPE                 MB
-------------------- ----------
LOBINDEX                      0
LOBSEGMENT                    0
INDEX                       842
TABLE                      1388
                           2230

What the data looks like

Before I run anything, I like to look at the rows. These queries run as SOE:

[oracle@dblab ~]$ sqlplus soe/"$SOE_PWD"@//localhost:1521/blog

I use these settings so the rows fit on the screen:

set lines 180 pages 100 trimout on tab off feedback off
alter session set nls_date_format = 'YYYY-MM-DD';
set feedback on
col cust_first_name head FIRST_NAME for a10
col cust_last_name  head LAST_NAME  for a10
col nls_territory   head TERRITORY  for a12
col cust_email      for a28
col order_mode      for a8
col order_date      for a19
col product_name    for a32
col product_status  for a20
col customer_class  for a42
select customer_id, cust_first_name, cust_last_name, nls_territory,
       credit_limit, cust_email, customer_since, dob
from   customers
where  customer_id <= 5
order  by customer_id;
CUSTOMER_ID FIRST_NAME LAST_NAME  TERRITORY    CREDIT_LIMIT CUST_EMAIL                   CUSTOMER_S DOB
----------- ---------- ---------- ------------ ------------ ---------------------------- ---------- ----------
          1 frank      walsh      Finland              5500 kelly.duncan@bt.com          2009-11-22 1956-12-19
          2 chad       rivera     Illinois             5500 andre.long@yahoo.com         2007-06-13 1967-08-20
          3 clyde      erickson   Maryland             6500 frank.willis@comcast.com     2005-12-22 1995-04-06
          4 brent      santos     Florida              6000 marvin.obrien@verizon.com    2000-07-09 1991-02-11
          5 craig      george     Thailand             6500 claude.weaver@               2000-01-27 1968-07-07

                                                                gmail.com


5 rows selected.

The first and last names come from lists of real names, so the customers look like people. The emails are real-looking too, but they don’t match the names. Look at customer 5: the email has a line break in the middle. More on that below.

select order_id, to_char(order_date, 'YYYY-MM-DD HH24:MI:SS') order_date,
       order_mode, customer_id, order_status, order_total, warehouse_id
from   orders
where  order_id <= 5
order  by order_id;
  ORDER_ID ORDER_DATE          ORDER_MO CUSTOMER_ID ORDER_STATUS ORDER_TOTAL WAREHOUSE_ID
---------- ------------------- -------- ----------- ------------ ----------- ------------
         1 2011-01-09 15:40:15 direct        200102            4        3826          444
         2 2007-03-02 17:08:59               177811            4        3950          209
         3 2008-10-06 00:21:20               858716            5        5117          377
         4 2008-06-16 08:20:40 online        631461            5        4452          593
         5 2009-08-27 14:41:57               318336            6        6306          157

5 rows selected.
select order_id, line_item_id, product_id, unit_price, quantity, dispatch_date
from   order_items
where  order_id = 1
order  by line_item_id;
  ORDER_ID LINE_ITEM_ID PRODUCT_ID UNIT_PRICE   QUANTITY DISPATCH_D
---------- ------------ ---------- ---------- ---------- ----------
         1            1        501       1039          5 2012-02-08
         1            2        400       1010          5 2012-04-20
         1            3        278       1576          7 2012-03-30

3 rows selected.
select product_id, product_name, category_id, list_price, product_status
from   product_information
where  product_id <= 5
order  by product_id;
PRODUCT_ID PRODUCT_NAME                     CATEGORY_ID LIST_PRICE PRODUCT_STATUS
---------- -------------------------------- ----------- ---------- --------------------
         1 XUbzD6EEhBvsd4rDKeEQu1ATRyAw2             57       2792 under development
         2 9hFWA 3fJ KOEfJ YqvQ                     104       4166 planned
         3 dZqc43LwweOC1Ox                          156        955 under development
         4 IfEWB0raRq                                34       2727 planned
         5 DbCiZ2 FRsjDD4bG                          73       2971 orderable

5 rows selected.

The products are random strings. The orders go from the end of 2006 to April 2012:

select to_char(min(order_date), 'YYYY-MM-DD') first_order,
       to_char(max(order_date), 'YYYY-MM-DD') last_order,
       count(*) orders
from   orders;
FIRST_ORDE LAST_ORDER     ORDERS
---------- ---------- ----------
2006-12-31 2012-04-30    1429790

1 row selected.

Now the line breaks. Some values in the lists that the wizard uses have a line break and a run of spaces inside them. In the output below, \n is a line break and _ is a space:

select replace(replace(customer_class, chr(10), '\n'), ' ', '_') customer_class,
       length(customer_class) len, count(*) customers
from   customers
group  by customer_class
order  by 3 desc;
CUSTOMER_CLASS                                    LEN  CUSTOMERS
------------------------------------------ ---------- ----------
Occasional                                         10     500113
Occasional\n____________________________           39     100470
\n________________________________Prime            38     100140
Regular                                             7      99918
Business                                            8      99787
Prime                                               5      99572

6 rows selected.
select count(*) customers,
       count(case when instr(customer_class, chr(10)) > 0 then 1 end) class_nl,
       count(case when instr(cust_email,     chr(10)) > 0 then 1 end) email_nl,
       count(case when instr(nls_territory,  chr(10)) > 0 then 1 end) territory_nl
from   customers;
 CUSTOMERS   CLASS_NL   EMAIL_NL TERRITORY_NL
---------- ---------- ---------- ------------
   1000000     200610     133429       112603

1 row selected.

So 200,610 customer classes, 133,429 emails and 112,603 territories have a line break inside. This doesn’t bother Oracle or the benchmark at all. It will matter when I export this data to CSV files for PostgreSQL and MySQL, so I’ll come back to it in the next posts.

Step 6: Run a workload with charbench

charbench is the command line version of the load generator. I use the SOE_Server_Side_V2.xml config, which runs the Order Entry transactions as PL/SQL inside the database. The mix is mostly browsing and ordering products, with some customer registrations, customer updates, order processing and order browsing.

The options:

  • -c ../configs/SOE_Server_Side_V2.xml: the workload
  • -cs, -u and -p: the same connection as in step 4, now as the SOE user
  • -uc 8: 8 users
  • -rt 0:02: run for 2 minutes
  • -v users,tpm,tps,errs: print one line per second with these numbers
  • -mr: print a short report at the end
  • -r: where to write the XML results file

The config has no think time, so each user sends the next transaction as soon as the previous one finishes. The output has one line per second, so I cut most of those lines and five of the six transaction blocks of the report. The cuts are marked with [...]:

[oracle@dblab bin]$ ./charbench -c ../configs/SOE_Server_Side_V2.xml -cs //localhost:1521/blog -u soe -p "$SOE_PWD" -uc 8 -rt 0:02 -v users,tpm,tps,errs -mr -nc -r ~/swingbench_blog/logs/results_8users.xml
Swingbench 
Author  :  	 Dominic Giles 
Version :  	 2.8.0.1630  

Results will be written to /home/oracle/swingbench_blog/logs/results_8users.xml 
Expected Benchmark Runtime is set to 2 minutes. 

Time      Users       TPM      TPS     Errors   
21:17:01  [0/8]       0        0       0        
21:17:02  [8/8]       52       52      0        
21:17:03  [8/8]       524      472     0        
21:17:04  [8/8]       1220     696     0        
21:17:05  [8/8]       1925     705     0        
21:17:06  [8/8]       2754     829     0        
21:17:07  [8/8]       3645     891     0        
21:17:08  [8/8]       4478     833     0        
21:17:09  [8/8]       5298     820     0        
21:17:10  [8/8]       6219     921     0        
[... one line per second from 21:17:11 to 21:18:55 ...]
21:18:56  [8/8]       38269    565     0        
21:18:57  [8/8]       38133    668     0        
21:18:58  [8/8]       38403    859     0        
21:18:59  [8/8]       38382    563     0        
21:19:00  [8/8]       38394    619     0        
---------------------------------------------------------------
|Results of Charbench Run                                     |
---------------------------------------------------------------
|Benchmark Name                |Order Entry benchmark using serverside plsql Version 2|
|Time of Run                   |       Dec 5, 2026, 9:17:01 PM|
|Length of Benchmark           |                       0:02:00|
|Total Logon Time              |                       0:00:00|
|Total Completed Transactions  |                         77839|
|Total Failed Transactions     |                             0|
|Maximum Transactions/min      |                         40613|
|Average Transactions/sec      |                        648.66|
|Total Select Statements       |                        815139|
|Total Insert Statements       |                        139058|
|Total Update Statements       |                        104693|
|Total Delete Statements       |                             0|
|Total Commit Statements       |                         77839|
|Total Rollback Statements     |                             0|
---------------------------------------------------------------
[... Customer Registration, Update Customer Details and Browse Products ...]
|Transaction :  Order Products                                |
---------------------------------------------------------------
|Minimum Response Time         |                             3|
|Maximum Response Time         |                          2196|
|Average Response Time         |                         21.45|
|Geometric Mean Response Time  |                         13.86|
|Median Response Time          |                         11.38|
|Number of Transactions        |                         24603|
|Failed Transactions           |                             0|
|Rolled Back Transactions      |                             0|
---------------------------------------------------------------
[... Process Orders and Browse Orders ...]
21:19:01  [8/8]       38059    510     0        
21:19:02  [8/8]       37993    674     0        
Saved results to results_8users.xml 
21:19:03  [0/8]       37491    103     8        
Completed Run. 

77,839 transactions in 2 minutes, 648.66 per second on average, and no failed transactions. Don’t read too much into the number: this is the Free edition, using 2 CPUs at most. The 8 errors on the last line show up when charbench stops the 8 users at the end of the run (the users go from 8/8 to 0/8 on that line). The report above it shows 0 failed transactions.

Step 7: The results are in the database too

Recent builds of Swingbench also store the results of every run as a JSON document in a table called BENCHMARK_RESULTS, in the benchmark schema. The column is a JSON column, so I can read it with the dot notation. A few column formats first:

set lines 180 pages 100 trimout on tab off
col recorded  for a19
col completed for a10
col failed    for a6
col avg_tps   for a8
select br.id,
       to_char(br.recording_time, 'YYYY-MM-DD HH24:MI:SS') recorded,
       br.results_json.Results.Overview.TotalCompletedTransactions.string() completed,
       br.results_json.Results.Overview.TotalFailedTransactions.string() failed,
       br.results_json.Results.Overview.AverageTransactionsPerSecond.string() avg_tps
from   benchmark_results br
order  by br.id;
        ID RECORDED            COMPLETED  FAILED AVG_TPS
---------- ------------------- ---------- ------ --------
         1 2026-12-05 21:19:02 77839      0      648.66

I like this a lot for my trainings. I run the same workload a few times with different settings, and then compare the runs with a simple query instead of opening XML files.

What’s next

Oracle now has the SOE schema in the BLOG PDB: almost 16 million rows, 2.2 GB with the indexes, and a workload that runs with one command. In the next post I’ll move the same data to PostgreSQL 19 on the same VM, and then to MySQL 9.7. There are a few things to deal with on the way: the line breaks above, a TIMESTAMP WITH LOCAL TIME ZONE column in ORDERS, an INTERVAL YEAR TO MONTH column in PRODUCT_INFORMATION and NVARCHAR2 columns in PRODUCT_DESCRIPTIONS.

Comments