Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: OCI: Can I know/estimate the duration of my statements ?
> Hi there,
>
> I observed in Oracle Enterprise Manager that it displays the progress of
> long processes. For example when I do a command like "INSERT INTO A SELECT *
> FROM B" and there is a lot in B... OEM will show me the progress in a
> progress bar (0..100%) and even tell me how long it is going to take
> (roughly) and count down the seconds.
>
> My question is: Can I also do this inside my C/C++ application using OCI ?
> Can ayone point me to some function or so that does this ?
You need to open two sessions two the server, one that initiates the long operation (and waits for it to be finished), and a second, that repeatedly, say every 0.5 seconds, or every second queries v$session_longops. I believe the columns you're interested in are time_remaining and the ration of sofar:totalwork.
Obviously, your application will need to be built multithreaded.
> Also, another observation is that OEM is obviously able to know how many
> rows my SELECT statement is going to return after it has been fired and
> before the fetch loop has started (i am sure everyone of you has seen the
> 2000-records warning before in OEM).
Afaik, that's not possible, though I wait for someone to correct me here. My guess is that OEM starts fetching records and when it realizes it has already fetched 2000 records, it issues this warning.
Hth
Rene
-- Rene Nyffenegger www.adp-gmbh.chReceived on Fri Aug 15 2003 - 07:25:21 CDT