This control enables users to specify the number of database sessions that BTEQ is to request be logged on when the LOGON command is next used.
where the following is true:
- The number of sessions that BTEQ is to run.
The maximum value of n is 200.
For information on session reserve, see “DISABLE SESSION RESERVE” and “ENABLE SESSION RESERVE” in Teradata® Director Program Reference, B035-2416.
Specify the SESSIONS command before specifying the LOGON command. The SESSIONS command is not accepted between the time that sessions are logged on and the time they are logged off. The most recent SESSIONS command is used for the number of sessions to log on with the next LOGON command.
If a SESSIONS command has not been used since invoking BTEQ, only one session is logged on.
To run more than one session concurrently, use the REPEAT or = command. When more than one session is used, the order in which requests are processed is not guaranteed. All sessions process identical requests, where only the data differs.
Running multiple sessions has the advantage of available sessions ready to retry a request if the in-use session becomes non-viable.
When running multiple sessions with the REPEAT command, supply the REPEAT command with the number of sessions before specifying the SQL DATABASE statement. And use the REPEAT command when setting session specific attributes with the database, so that each session behaves the same.
Use the SHOW CONTROLS command to determine the current value of n.
The SESSIONS command is not valid in an SQL macro.
Example 1 – SESSIONS
To run three sessions concurrently that repeat the SQL INSERT request as many times as needed, specify:
.SET SESSIONS 3 .LOGON SIA1/KLD .REPEAT 3 DATABASE Workforce; .REPEAT * USING num(SMALLINT) INSERT INTO Department (DeptNo) VALUES (:num) ;
The first REPEAT command specifies the default database for all three sessions. The second REPEAT command runs the three sessions until all the data is inserted. If the first REPEAT command is not specified, only the first session uses the Workforce database. The other two sessions do not have a database set.
Example 2 – SESSIONS
Use the following syntax to specify the default database within an SQL statement that specifies a table name:
.SET SESSIONS 3 .LOGON SIA1/KLD .REPEAT * USING num(SMALLINT) INSERT INTO Workforce.Department (DeptNo) VALUES (:num) ;
In this example, the default database Workforce is supplied with the table name on the SQL INSERT statement. In this case, only one REPEAT command is required.
Example 3 – SESSIONS
To choose five database user sessions, enter the following syntax:
.SET SESSIONS 5 .LOGON SIA1/KLD
After validating the logon, BTEQ displays:
*** Logon successfully completed. *** 5 sessions logged on. *** Total elapsed time was 7 seconds.
Example 4 – SESSIONS
Use the REPEAT command to define session-specific attributes to all sessions:
.SET SESSIONS 4 .LOGON SIA1/KLD .REPEAT 4 SET SESSION CHARACTER SET UNICODE PASS THROUGH ON;
In this case, the database's UPT feature is turned on for each session.