Question

Am using oracle 11g, and i have a sql file with 'spool on' which runs for at least 7+ hours, as it has to spool huge data. But spool output is dumped only when the whole sql is finished, but i would like to know is there any other way to know the progress of my sql, or data spooled until that point in time, so that am rest assured that my sql is running properly as expected. Please help with your inputs.

Was it helpful?

Solution

Sounds like you are using DBMS_OUTPUT, which always only starts to actually output the results after the procedure completes.

If you want to have real/near time monitoring of progress you have 3 options:

  1. Use utl_file to write to a OS file. You will need access to the db server OS file system for this.

  2. Write to a table and use PRAGMA AUTONOMOUS_TRANSACTION so you can commit the log table entries without impacting your main processing. This is easy to implement, and readily accessible. Implemented in a good way this can become a de facto standard for all your procedures. You may then need to implement some sort of house keeping to avoid this getting too big and unwieldy.

  3. A quick and dirty option which is transient, is to use DBMS_APPLICATION.SET_CLIENT_INFO, and then query v$session.client_info. This works well, good for keeping track of things, fairly unobtrusive and because it is a memory structure is fast.

DBMS_OUTPUT really is limited.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top