How to execute IBM DB2 UDB Admin commands that are part of CLP in Aqua Data Studio ?

by Nov 4, 2014


How to execute IBM DB2 UDB Admin Functions in Aqua Data Studio ?
IBM DB2 has server SQL commands, and commands that are part of their command line tool.  SQL Commands are executed on the server, while the command line commands are executed on the client by the native library. So, in the command line tool you can write a script that executes both SQL commands and client commands. But ADS only sends SQL commands to the server.  If you execute RUNSTATS in ADS, it will send it to the server to execute, but since RUNSTATS is a client side command, the DB2 server doesn't understand it and returns an error.
Is there a way to execute ADMIN commands like EXPORT, IMPORT, RUNSTATS, BACKUP, DESCRIBE through Aqua Data Studio ? I can execute these commands through the DB2 CLP


ariq Rahiman over 9 years ago

To execute DB2 UDB Admin Functions to work in Aqua Data Studio, you can use the SYSPROC.ADMIN_CMD procedure which will work through most of the JDBC drivers.

1. Open a query window in Aqua Data Studio to your DB2 Server
3. Some sample IBM DB2 UDB Admin commands which run in Aqua Data Studio Query Analyzer are given below:

To describe a table use the command:

CALL SYSPROC.ADMIN_CMD(‘describe table DCMS.acct_activity’)
To execute DB2 RUNSTATS on a table use the command:

To run a DB2 Export command use:

CALL SYSPROC.ADMIN_CMD(‘Export To c:\acct.del OF DEL SELECT * FROM DCMS.”acct_activity” ‘)
Note: For EXPORT command to work you need specify a directory path of the Server. Export will also work with a file url to a shared drive on another device.