Last active
January 12, 2016 09:11
-
-
Save BenRhouma/d86e681b25d4b5f435ab to your computer and use it in GitHub Desktop.
Long plsql operation monitoring
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare | |
rindex BINARY_INTEGER; | |
slno BINARY_INTEGER; | |
totalwork NUMBER := 0; -- Total number of structures | |
worksofar NUMBER := 0; -- Number of structures processed | |
cursor cons is select * from CONSUMPTION; | |
begin | |
select nvl(count(*) , 0) into totalwork from CONSUMPTION; | |
for c in cons loop | |
worksofar := worksofar + 1; | |
dbms_application_info.set_session_longops( | |
rindex => rindex, | |
slno => slno, | |
op_name => 'Updating conso', | |
sofar => worksofar , | |
totalwork => totalwork, | |
target_desc => 'Updating conso', | |
units => 'structures'); | |
end loop; | |
if worksofar mod 5000 = 0 then | |
commit; | |
end if; | |
end; | |
--SELECT opname, | |
-- target_desc, | |
-- sofar, | |
-- totalwork, | |
-- units, | |
-- elapsed_seconds, | |
-- time_remaining | |
-- FROM v$session_longops | |
-- WHERE opname = 'Processing of Molecular Structures'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment