Biblioteca

How to run Firebird tracing for visualization

Please note: tracing is safe, it can be started on the production, it does not affect the performance in case of using the recommended configuration below.

 

Tracing for Firebird 3.0

Step 1

Copy the following configuration into the file fbtrace30.conf, or download the ready file from here (https://ib-aid.com/download/trace/fbtrace30.conf).
database
{
	enabled = true
	time_threshold = 200
	log_connections = true
	log_statement_finish = true
	log_errors = true
	log_initfini = false
	print_plan = true
	#explain_plan = false
	print_perf = true
	max_sql_length = 65000
	max_arg_length = 240
	max_arg_count = 50
}
Store the file in the folder withpout spaces, for example, C:\temp\fbtrace30.conf, or /opt/fbtrace30.conf

Step 2

Run fbtracemgr to check that configuration works:

 

Windows

Open command prompt (run cmd.exe), go to folder with Firebird, and run
fbtracemgr.exe -se service_mgr -user SYSDBA -pass masterkey -start -conf C:\temp\fbtrace30.conf
As a result, you will see output in the command prompt, something like this
Trace session ID 2 started
2021-05-26T10:23:48.5690 (2996:00000000018E0040) ATTACH_DATABASE
        C:\HQBIRD\FIREBIRD30\SECURITY3.FDB (ATT_6189, SYSDBA:NONE, NONE, )

Linux

Run terminal, and then fbtracemgr from Firebird bin folder (/opt/firebird/bin or /usr/local/bin)
./fbtracemgr -se service_mgr -user SYSDBA -pass masterkey -start -conf /opt/fbtrace30.conf   

Step 3>/h3> If you don't see errors, run tracing to collect output of the data to the file, c:\temp\log1.log in the example:

Windows

fbtracemgr.exe -se service_mgr -user SYSDBA -pass masterkey -start -conf C:\temp\fbtrace30.conf > c:\temp\log1.log

Linux

./fbtracemgr -se service_mgr -user SYSDBA -pass masterkey -start -conf /opt/fbtrace30.conf >    log1.log  
Keep it running to catch the problematic SQL queries for a while (the minimum is 3-4 minutes, recommended is 1 hour), and then interrupt the fbtracemgr with Ctrl-C.

Step 4. Upload the resulted log file to the Trace Visualization on cc.ib-aid.com

Please note, if the size of the lo file is more that 100Mb, zip it (with standard Windows zip or with Linux zip), and upload compressed log instead.

Tracing for Firebird 2.5

Step 1

Copy the following configuration into the file fbtrace25.conf, or download the ready file from here (https://ib-aid.com/download/trace/fbtrace25.conf).

	enabled true
	log_connections true
	log_statement_finish true
	log_errors true
	print_plan true
	print_perf true
	time_threshold 200
	max_sql_length 65000
	max_blr_length 500
	max_dyn_length 500
	max_arg_length 80
	max_arg_count 50

Store the file in the folder withpout spaces, for example, C:\temp\fbtrace25.conf, or /opt/fbtrace25.conf

Step 2

Run fbtracemgr to check that configuration works:

Windows

Open command prompt (run cmd.exe), go to folder with Firebird, and run
fbtracemgr.exe -se service_mgr -user SYSDBA -pass masterkey -start -conf C:\temp\fbtrace30.conf
As a result, you will see output in the command prompt, something like this
Trace session ID 2 started
2021-05-26T10:23:48.5690 (2996:00000000018E0040) ATTACH_DATABASE
        C:\HQBIRD\FIREBIRD30\SECURITY3.FDB (ATT_6189, SYSDBA:NONE, NONE, )

Linux

Run terminal, and then run fbtracemgr from Firebird bin folder (/opt/firebird/bin or /usr/local/bin)
./fbtracemgr -se service_mgr -user SYSDBA -pass masterkey -start -conf /opt/fbtrace30.conf   

Step 3

If you don't see errors, run tracing to collect output of the data to the file, c:\temp\log1.log in the example:

Windows

fbtracemgr.exe -se service_mgr -user SYSDBA -pass masterkey -start -conf C:\temp\fbtrace30.conf > c:\temp\log1.log

Linux

./fbtracemgr -se service_mgr -user SYSDBA -pass masterkey -start -conf /opt/fbtrace30.conf >    log1.log  
Keep it running to catch the problematic SQL queries for a while (the minimum is 3-4 minutes, recommended is 1 hour), and then interrupt the fbtracemgr with Ctrl-C.

Step 4. Upload the resulted log file to the Trace Visualization on cc.ib-aid.com

Please note, if the size of the lo file is more that 100Mb, zip it (with standard Windows zip or with Linux zip), and upload compressed log instead.