|
| This chapter describes how to use TG in the command line mode. It assumes that you have already installed TG in the "C:\tg08X" directory. |
  |
|
Step1 |
- Edit the "tg.conf" configration file - |
                                  |
In the begining, Edit the "tg.conf" configration file and set the target database informationon and random variables, transactions, etc... |
| |
* SAMPLE "tg.conf"
|
######## Sample configration file for TG
#### System Field.
<SYSTEM
 EDITOR  = notepad.exe
 PROMPT  = TG
 AUTOEXEC = off
 SPOOL   = off
>
#### Database Field.
<DATABASE
 JDBC_DRIVER = ORACLE
 DRIVER_TYPE = THIN
 HOSTNAME   = dbsrv01
 PORT       = 1521
 SID_NAME   = testdb
>
#### Agent Field.
<AGENT
 USERNAME   = test
 PASSWORD   = test
 SESSIONS   = 50
 THINKTIME  = 200
>
#### Variable Field.
<VARIABLE
 VARIABLE_NAME = :NDATA
 VARIABLE_TYPE = NUMBER
 VARIABLE_PROP = 1..1000000
>
<VARIABLE
 VARIABLE_NAME = :CDATA
 VARIABLE_TYPE = CHARACTER
 VARIABLE_PROP = 128..255 >
<VARIABLE
 VARIABLE_NAME = :DDATA
 VARIABLE_TYPE = DATE
 VARIABLE_PROP = 2000/01/01..2002/12/31
>
<VARIABLE
 VARIABLE_NAME = :MONTH
 VARIABLE_TYPE = LIST
 VARIABLE_PROP = "January", "February", "March", "April", "May", "June",
 "July" , "August" , "September","October", "November", "December"
>
<VARIABLE
 VARIABLE_NAME = :ID
 VARIABLE_TYPE = AGENTID
>
#### Transaction Field.
<TRANSACTION
 TRANS_NAME = SELECT0
 AVERAGE   = 80
 STATEMENT = select * from test where id = :NDATA;
>
<TRANSACTION
 TRANS_NAME = INSERT0
 AVERAGE   = 10
 STATEMENT = insert into test values
              (idseq.nextval,:NDATA,to_date(:DDATA,'YYYY/MM/DD'),:CDATA);
 STATEMENT = commit;
>
<TRANSACTION
 TRANS_NAME = UPDATE0
 AVERAGE   = 5
 STATEMENT = select ndata from test where id = :NDATA for update;
 STATEMENT = update test
             set cdata = :MONTH
             where id = :NDATA;
 STATEMENT = commit;
>
<TRANSACTION
 TRANS_NAME = DELETE0
 AVERAGE   = 5
 STATEMENT = delete from test where id = :NDATA;
 STATEMENT = rollback;
>
#### Job Field.
<JOB
 JOB_NAME = EXEC_STATSPACK
 JOB_TYPE = TELNET
 HOSTNAME = 192.168.100.100
 PORT   = 23
 USERNAME = oracle
 PASSWORD = oracle
 EXECFILE = $TGSCRIPT0.tgs
>
|
|
| |
Run "tg.bat" startup script from the command prompt. TG will load the "tg.conf" configration file and execute self initilaization.
|
| |
* COMMAND-LINE SAMPLE
|
C:\> cd tg08X
C:\tg08X> tg
TG - Transaction Generator - [ Version 0.8X ] Sat Jun 16 14:24:42 JST 2007
Loading configuration file... OK.
Registered transactions:4 , variables:5 , jobs:1 , slave servers:0
Loading JDBC driver "oracle.jdbc.driver.OracleDriver" ... OK.
type "HELP" or "h" to print help messages.
TG>
|
|
| |
In the example of the above, four transactions and five random variables are registered. |
  |
|
Step3 |
- Verify the configuration - |
                                  |
Using "SHOW" command, you can verify each configuration. |
| |
* COMMAND-LINE SAMPLE
|
TG> show config variables
-- VARIABLE CONFIGURATION -----------------------------
Registerd Variables Total : 5
VARIABLE No : 1
VARIABLE_NAME : :NDATA
VARIABLE_TYPE : NUMBER
VARIABLE_PROP : 1..1000000
VARIABLE No : 2
VARIABLE_NAME : :CDATA
VARIABLE_TYPE : CHARACTER
VARIABLE_PROP : 128..255
VARIABLE No : 3
VARIABLE_NAME : :DDATA
VARIABLE_TYPE : DATE
VARIABLE_PROP : 2000/01/01..2002/12/31
VARIABLE No : 4
VARIABLE_NAME : :MONTH
VARIABLE_TYPE : LIST
VALUES : January, February, March, April, May, June, July, August, September, October, November, December
VARIABLE No : 5
VARIABLE_NAME : :ID
VARIABLE_TYPE : AGENTID
TG> |
|
| |
| |
* COMMAND-LINE SAMPLE
|
TG> show config transactions
-- TRANSACTION CONFIGRATION ---------------------------
Registerd Transactions Total : 4
TRANSACTION No : 1
 TRANS_NAME : SELECT0
 AVERAGE : 80
 SQL No.1 : select * from test where id = :NDATA
TRANSACTION No : 2
 TRANS_NAME : INSERT0
 AVERAGE : 10
 SQL No.1 : insert into test values  (idseq.nextval,:NDATA,to_date(:DDATA,'YYYY/MM/DD'),:CDATA)
 SQL No.2 : commit
TRANSACTION No : 3
 TRANS_NAME : UPDATE0
 AVERAGE : 5
 SQL No.1 : select ndata from test where id = :NDATA for update
 SQL No.2 : update test set cdata = :MONTH where id = :NDATA
 SQL No.3 : commit
TRANSACTION No : 4
 TRANS_NAME : DELETE0
 AVERAGE : 5
 SQL No.1 : delete from test where id = :NDATA
 SQL No.2 : rollback
TG> |
|
| |
  |
|
Step4 |
- Connection test - |
                                  |
Usign "CHECK CONFIG" command, you can test a current configuration. |
  |
|
Step5 |
- Create sessions - |
                                  |
Using "CONNECT" command, make agents connect to the target database. |
| |
* COMMAND-LINE SAMPLE
|
TG> connect
Make agents connect to the target database.
TG>
|
|
| |
Using "MONITOR" command, you can confirm current session status. |
  |
|
Step6 |
- Start transactions - |
                                  |
Using "START" command, change agent's status into "ACTIVE" mode. |
| |
* COMMAND-LINE SAMPLE
|
TG> start
Activate Agents.
TG>
|
|
| |
Using "MONITOR" command, You can confirm the current transaction statistics. |
Using "VERBOSE" command, you can look at the actual agents processing. Executing SQL statements, getting results of the query, etc... Input "verbose on" to start verbose mode, and "verbose off" to finish it.
* To short, "v on" and "v off" are available too. |
| |
* COMMAND-LINE SAMPLE
|
TG> verbose on
enable verbose output : All agents
23:30:48 AgentID:14 RN:99 TN:4 MESG: ******** Transaction started. ******
23:30:48 AgentID:14 RN:99 TN:4 STMT: delete from test where id = ?
23:30:48 AgentID:14 RN:99 TN:4 STMT: setint=:NDATA (VALNo:1) [VAL:553165]
23:30:48 AgentID:14 RN:99 TN:4 STMT: execstmt
23:30:48 AgentID:14 RN:99 TN:4 STMT: rollback
23:30:48 AgentID:14 RN:99 TN:4 MESG: Elapsed time : 1 msec.
23:30:48 AgentID:14 RN:99 TN:4 MESG: ******** Transaction completed. ****
23:30:48 AgentID:14 MESG: Now thinking for 500 msec
23:30:48 AgentID:45 RN:12 TN:1 MESG: ******** Transaction started. ******
23:30:48 AgentID:45 RN:12 TN:1 STMT: select * from test where id = ?
23:30:48 AgentID:45 RN:12 TN:1 STMT: setint=:NDATA (VALNo:1) [VAL:61083]
23:30:48 AgentID:45 RN:12 TN:1 STMT: execstmt
23:30:48 AgentID:45 RN:12 TN:1 RSLT:
23:30:48 AgentID:45 RN:12 TN:1 MESG: Elapsed time : 1 msec.
23:30:48 AgentID:45 RN:12 TN:1 MESG: ******** Transaction completed. ****
23:30:48 AgentID:45 MESG: Now thinking for 500 msec
disable verbose output : All agents
TG>
|
|
| |
When you stop the transaction temporary, use "STOP" command. To restart the transaction, issue "START" command again. |
| |
* COMMAND-LINE SAMPLE
|
TG> stop
Freeze Agents.
TG>
|
|
| |
Issue "DISCONNECT" command to make agents disconnect from the target database. |
| |
* COMMAND-LINE SAMPLE
|
TG> disconnect
Make agents disconnect from the target database.
TG>
|
|
| |
Use "EXIT" command and terminate TG. |
| |
* COMMAND-LINE SAMPLE
|
TG> exit
bye.
TG - Transaction Generator - [ Version 0.8X ] Thu May 05 23:36:14 JST 2008
C:\tg080>
|
|
| |
|