s.offermannconterra-de-esridist

CopyRaster GP tool keeps open cursors (ArcObjects 9.3.1 SP2)

Discussion created by s.offermannconterra-de-esridist Employee on Aug 2, 2011
Latest reply on Aug 7, 2011 by s.offermannconterra-de-esridist
Hi,

i have a problem with the CopyRaster geoprocessing tool. When I use the GP-Tool to execute it with the Geoprocessor object, it keeps 2 open cursors on my Oracle SDE. I have to copy many rasters from a local folder to the geodatabase. After some time I get ORA-0100: Maximum open cursors exceeded because the open cursors do not get closed until I close ArcMap (i am developing an ArcMap extension with C#). I have tried some things to free the c#-objects, but this does not close the open cursors. What can I do?

Here is the code which I use to copy the rasters from the file system to the Oracle SDE:

            var files = new Dictionary<string, string>();
            /* read directory structure and collect all BMP files */
            foreach (var file in files)
            {
                var fullRasterSourcePath = file.Key;
                var fullRasterSDE = @"Database Connections\vsdev0920.sde\MARA." + file.Value;

                var cpRas = new ESRI.ArcGIS.DataManagementTools.CopyRaster
                {
                    in_raster = fullRasterSourcePath,
                    out_rasterdataset = fullRasterSDE,
                    nodata_value = 0
                };
                var gp = new ESRI.ArcGIS.Geoprocessor.Geoprocessor();
                gp.Execute(cpRas, null);
                ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(gp);
                ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(cpRas);
                mygp = null;
                cpRas = null;

                GC.Collect();
                GC.WaitForPendingFinalizers();
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }


After every execution of the CopyRaster tool, there are 2 more open cursors which I checked with the following SQL statement:

select sum(a.value) total_cur, avg(a.value) avg_cur, max(a.value) max_cur, 
s.username, s.machine
from v$sesstat a, v$statname b, v$session s 
where a.statistic# = b.statistic#  and s.sid=a.sid
and b.name = 'opened cursors current' 
group by s.username, s.machine
order by 1 desc;


Both client and SDE are at ArcGIS level 9.3.1 SP2

Best regards, Stefan

Outcomes