ifx_grid_execute() procedure
The ifx_grid_execute() procedure propagates the execution of a routine or data manipulation language (DML) SQL statement to all servers in the grid.
Syntax
Element | Purpose | Restrictions |
---|---|---|
grid_name | Name of the grid. | Must be the name of an existing grid. |
statement_text | The text format of the routine or SQL statement to be run. | Bound data items cannot be included in procedure text. |
tag | A character string to identify grid operations. |
Usage
Use the ifx_grid_execute() procedure to run a routine or DML SQL statement on a source server and propagate it so that it is also run on the other servers in the grid. The output of the routine, if any, is not returned to the client application. The results of routines or statements that are performed within the context of the ifx_grid_execute() procedure are not replicated. The ifx_grid_execute() procedure effectively runs routines and statements with a BEGIN WORK WITHOUT REPLICATION statement. Do not use the ifx_grid_execute() procedure to populate tables that are already involved in replication. Although you can use the ifx_grid_execute() procedure to run a DML statement, for example, to delete many rows from a table, in general use Enterprise Replication to replicate changes to replicated data. You can run DML statements on any type of table, including raw tables, virtual tables, and external tables.
You cannot run the ifx_grid_execute() procedure from within a transaction. When you run SQL administration API commands from the ifx_grid_execute() procedure, you must use double quotation marks around the SQL administration API function arguments and single quotation marks around the ifx_grid_execute() procedure arguments.
You must run this routine as an authorized user on an authorized server, as specified by the cdr grid enable command.
Example
The following example, run from the sysadmin database, uses an SQL administration API command to create a dbspace on every server in the grid:
EXECUTE PROCEDURE ifx_grid_execute('grid1',
'admin("create dbspace", "dbspace3",
"$ONEDB_HOME/WORK/dbspace3", "500 M")');
The following example drops the logical logs from the chunk number 3 from all the servers in the grid:
EXECUTE PROCEDURE ifx_grid_execute('grid1', 'SELECT task("drop log", number) FROM
sysmaster:syslogfil where chunk = 3;');