Hi,
One of the primary requirement for successful execution of dbexport job is that it needs database access in exclusive mode. A DBA need to monitor active sessions and plan dbexport job according to the least traffic situation in the database. A automated (batch process) may result in havoc of active sessions, should such batch process kill all those active sessions!
Anyway, you may fall upon steps outlined below to automate it.
1. output to aa.cmd without headings select 'onmode -z '||sid from sysmaster:syssessions ;
2. Run aa.cmd
3. Wait for some time. (example: sleep 10) Let the engine commit/rollback those active sessions having transactions.
4. Check for any remaining active sessions: select count(*) from sysmaster:syssessions;
5. If any sessions are active repeat steps 1 to 4
6. dbexport -d <database> -ss ...
Regards,
Shriyan