Forum Stats

  • 3,768,921 Users
  • 2,252,874 Discussions
  • 7,874,798 Comments

Discussions

Memory problem with updating Oracle in Python (Anaconda)

3172122
3172122 Member Posts: 8
edited Apr 18, 2016 9:40PM in Python

I'm using a for cicle (2500 records) in Python (Anaconda) in order to update an Oracle 11g database. When the program arrive near to 100 cicle it stops...(no error, simply it doesn't go on...). I think it's a problem of memory, I'm using a PC windows.

Is there any method to get free memory during the process?

Thanks, regards.

Answers

  • Gaz in Oz
    Gaz in Oz Member Posts: 3,784 Bronze Crown
    edited Apr 18, 2016 9:40PM

    Hi 3172122

    To monitor process memory you can use Microsoft Sysinternals tool "Process Explorer" or "Process Monitor" available here, with a load of other great tools for windows:

    https://technet.microsoft.com/en-us/sysinternals

    This allows you to get details on running executables.

    To help us understand your problem better, it would help to post code that you are executing. If this is an update, then how long does the update take if you run the sql directly in, sqlplus or sqldeveloper? Are there index/s on the table/tables you are updating? What is the execution plan?

    If you want to start debugging your code memory wise then Memory profiler module might be of use:

    https://pypi.python.org/pypi/memory_profiler

    It could be a database issue, locks on objects you are trying to update, thus hanging the Oracle session until those locks are freed. It could even be caused by your code logic if it is multithreading across connections. To check for locks, the quickest way is to run a query using sqlplus/sql developer as a user with DBA privileges:

    SELECT  blk.sid,
            blk.wait_event_text,
            blk.blocker_sid,
            ses.osuser,
            ses.machine,
            ses.program,
            ses.seconds_in_wait,
            ses.username,
            ses.schemaname
    FROM    v$session_Blockers blk,
            v$session ses
    WHERE   blk.sid = ses.sid;
    
    
    
    

    It would also be worth checking the database alert logs for any actual database errors.

    Hope that helps,

    Gaz.

This discussion has been closed.