February 8, 2012, Wednesday, 38


ADMIN CMD procedure

From SQL PL Guide for DB2

Jump to: navigation, search

ADMIN_CMD Procedure

The ADMIN_CMD procedure can be used to run administative commands as a procedure. All important commands like runstats, reorg, export, import, load, online backup, etc. are supported. The advantage is the CALL statement is SQL and not an command. So you can use it inside a stored procedure.

Syntax:

 call SYSPROC.ADMIN_CMD (<command string>); 


Example (Performing a LOAD-CURSOR from a remote database by the ADMIN_CMD Procedure):

 call SYSPROC.ADMIN_CMD ('LOAD FROM (DATABASE mysamp2 SELECT * FROM db2inst1.employee )
      OF CURSOR REPLACE INTO db2inst2.employee NONRECOVERABLE' );

An other example can be found here: Example Runstats



Link to the DB2 Information Center: DB2 9 DB2 9.5 DB2 9.7