Replays SQL statements after the connection is established to the failover server and before a new client request is accepted using that connection. Use rp_replay to specify to the connection before the failover occurs the SQL statements to be replayed.
rp_replay spid, action, name, sql, canfail
Either an OpenSwitch process ID, or NULL.
The action to be performed on the SQL statements. Action can be ADD, DELETE, CLEAR, or SHOW. If the action is CLEAR, the name parameter must be NULL; if the action is SHOW, the name parameter can be NULL. See the Usage section for more information.
The name of the SQL statement, which must be unique within a thread
A SQL statement. The maximum length of the SQL statement is 2048 bytes. Supply this parameter when the action is ADD.
Checks whether or not the statement is allowed to fail. If you do not supply this parameter, canfail has a value of zero (0). If canfail is 1, the connection is still considered properly failed over even if the statement did not execute on the remote server. Supply this parameter only when the action is ADD.
Creates multiple rp_replay SQL statements for spid 8.
1> rp_replay 8, "add", "a1", "create table temp1(a int, b char)", 0 2> go (return status = 0) 1> rp_replay 8, "add", "a2", "insert into temp1 values (15, 'w')", 1 2> go (return status = 0) 1> rp_replay 8, "add", "a3", "insert into temp1 values (17, 'x')", 0 2> go (return status = 0) 1> rp_replay 8, "add", "a4", "insert into temp1 values (22, 'y')", 0 2> go (return status = 0) 1> rp_replay 8, "add", "a5", "insert into temp1 values (78, 'z')", 0 2> go (return status = 0)
Displays the rp_replay SQL statement for “a2” and spid 8.
1> rp_replay 8, "show", "a2" 2> go
Returns:
spid SQL_Name SQL_Statement canfail -------- ------------ ------------------------------------- ------- 8 a2 insert into temp1 values (15, 'w') 1 (return status = 0)
Displays the rp_replay SQL statements for spid 8.
1> rp_replay 8, "show", NULL 2> go
Returns:
spid SQL_Name SQL_Statement canfail -------- ------------ ------------------------------------- ------- 8 a1 create table temp1(a int, b char) 0 8 a2 insert into temp1 values (15, 'w') 1 8 a3 insert into temp1 values (17, 'x') 0 8 a4 insert into temp1 values (22, 'y') 0 8 a5 insert into temp1 values (78, 'z') 0 (return status = 0)
Displays all rp_replay SQL statements for “a1.”
1> rp_replay NULL, "show", "a1" 2> go
Results:
spid SQL_Name SQL_Statement canfail -------- ------------ ------------------------------------- ------- 8 a1 create table temp1(a int, b char) 0 11 a1 insert into temp1 values (97, 'q') 0 (return status = 0)
Adds the same re_replay SQL statement to all spids that are currently active in the OpenSwitch server.
1> rp_replay NULL, "add", "a7", "set textsize 17889", 1 2> go (return status = 0) 1> rp_replay NULL, "show", "a7" 2> go
Returns:
spid SQL_Name SQL_Statement canfail -------- ------------ ------------------------------------- ------- 8 a7 set textsize 17889 1 11 a7 set textsize 17889 1 (return status = 0)
Displays all SQL statements for all spids.
1> rp_replay NULL, "show", NULL 2> go
Returns:
spid SQL_Name SQL_Statement canfail ------------------------------------------------------------------------- 8 a1 create table temp1(a int, b char) 0 8 a2 insert into temp1 values (15, 'w') 1 8 a3 insert into temp1 values (17, 'x') 0 8 a4 insert into temp1 values (22, 'y') 0 8 a5 insert into temp1 values (78, 'z') 0 8 a7 set textsize 17889 1 11 a1 insert into temp1 values (97, 'q') 0 11 a2 insert into temp1 values (98, 'r') 1 11 a8 insert into temp1 values (100, 's') 0 11 a9 delete from temp1 where a = 22 0 11 a10 set textsize 32567 0 11 a3 set rowcount 2 1 11 a7 set textsize 17889 1 (return status = 0)
rp_replay replays SQL statements after the connection is established to the failover server and before a new client request is accepted using that connection.
rp_replay parameters allows users to add, delete, clear, and display the SQL statements.
If the user gives NULL for the spid parameter, the action is applied only to existing spids and not new spids.
DELETE removes the SQL statement based on the name parameter, while CLEAR removes all SQL statements attached to the specified spid.
The user has supplied an action parameter other than ADD, CLEAR, DELETE, or SHOW:
rp_replay: The @action parameter must be ADD, CLEAR, DELETE, or SHOW surrounded by double quotes.
The user has not supplied the SQL statement to add:
rp_replay: The @sql parameter must be supplied with an "add" action
The user has supplied the sql parameter when the action parameter is not ADD:
rp_replay: The @sql parameter must be supplied with an "add" action.
The user has supplied the canfail parameter when the action parameter is not ADD:
rp_replay: The @canfail parameter must be supplied with an "add" action
The action is CLEAR but the name parameter is not NULL:
rp_replay: @name should be NULL for CLEAR action. To remove a specific statement, use action=delete instead.
The user is trying to delete a SQL statement that does not exist:
thrd_sql_rem: Attempt to remove nonexistent SQL `a1' Msg 20075, Level 13, State 0: Server 'test_osw': rp_replay: Internal thrd_sql_rem error, see log file (return status = -1)
The user is trying to add a SQL statement with a nonunique name:
Messsage – test_osw: INFO: spid 10: thrd_sql_add: @name should be unique, 'insert into temp1 values (15, 'w')' already have name 'a2' for spid '8'. Unable to add statement for spid '8'. Msg 20075, Level 13, State 0: Server 'test_osw': rp_replay: Internal thrd_sql_add error, see log file (return status = -1)