SQL administration API admin() and task() functions
The SQL administration API consists of two functions: admin() and task() that are defined in the sysadmin database.
These functions perform the same tasks, but return results in different formats. The task() function returns a string that describes the results of the command. The admin() function returns an integer.
By default, only user informix, can connect to the sysadmin database. If user root or a member of the DBSA group is granted privileges to connect to the sysadmin database, user root or a member of the DBSA group can also run the SQL administration API task() and admin() functions.
Run the task() or admin() function in a transaction that does not include any other statements.
You can use EXECUTE FUNCTION statement to execute the admin() and task() functions.
For example, the following SQL statement, which is equivalent to the oncheck
-ce command, instructs the database server to check the
extents:
BEGIN WORK;
EXECUTE FUNCTION admin("check extents");
END WORK;
You use SQL administration API functions in your Scheduler task
actions. For example, you can define a task that creates a dbspace
by using the following statement in the task action:
EXECUTE FUNCTION admin("create dbspace","dbspace2","/work/dbspace2","20 MB");