[C#] Versioning - Underlying DBMS error

4640
4
01-11-2012 12:32 AM
HarrisonFord
New Contributor II
I have an application, which is trying to find differences between two versions of tables (and FC). I used this example from ArcObjects SDK 10 Help. My code works fine if I need to handle less than ~200 tables. But when I use more than ~200 tables as an input, I get an exception on 200th one:
Underlying DBMS error [<TABLENAME>] Error code: -2147216072

In SDE log files I found this:
db_describe_select describe error (-51), column 1.

Server Configuration:
Windows Server 2008 SP2
ArcSDE 10.0 for Oracle 11g Build 1343
Oracle Client 11.2.0.1

Any thoughts?
0 Kudos
4 Replies
AlexanderGray
Occasional Contributor III
I don't see the code here but my guess is you are keeping a reference to every single table you open.  This keeps memory and table space for the user locked up on the oracle server and runs out.  An Oracle and SDE expert would give you more detail on that.  Are you releasing the references to cursors, rows and tables explicitly when done with them (comreleaser or marshalcomrelease)?  That could go a long way to avoiding this sort of situation.
0 Kudos
HarrisonFord
New Contributor II
1. My user has unlimited tablespace privelege.

2. SYSTEM and USERS tablespaces are autoextendable and have unlimited maximum space option.

3. I post here my test application code.

There is one point: in the application I am using DEFAULT version of gdb as child version and MY_VERSION as parent.  But actually MY_VERSION is child of DEFAULT.

      
        public void FindDifferences(IWorkspace ws, List<string> tableNames)
        {
            try
            {
                // Searching for insert differences
                foreach (string tableName in tableNames)
                    FindDiff(ws, tableName);
            }
            catch (Exception ex)
            {
                //Logging
            }
        }
        
       
        public void FindDiff(IWorkspace workspace, string tabName)
        {
            IVersionedWorkspace versionedWorkspace = (IVersionedWorkspace)workspace;
            IVersion childVersion = versionedWorkspace.DefaultVersion;
            IVersion parentVersion = versionedWorkspace.FindVersion("MY_VERSION");

            // Cast to the IVersion2 interface to find the common ancestor.
            IVersion2 childVersion2 = (IVersion2)childVersion;
            IVersion commonAncestorVersion = childVersion2.GetCommonAncestor(parentVersion);

            // Cast the child version to IFeatureWorkspace and open the table.
            IFeatureWorkspace childFWS = (IFeatureWorkspace)childVersion;
            ITable childTable = childFWS.OpenTable(tabName);

            // Cast the common ancestor version to IFeatureWorkspace and open the table.
            IFeatureWorkspace commonAncestorFWS = (IFeatureWorkspace)commonAncestorVersion;
            ITable commonAncestorTable = commonAncestorFWS.OpenTable(tabName);

            IVersionedTable versionedTable = (IVersionedTable)childTable;
            IDifferenceCursor differenceCursor = versionedTable.Differences(commonAncestorTable,
                esriDifferenceType.esriDifferenceTypeInsert, null);

            // Create output variables for the IDifferenceCursor.Next method.
            IRow differenceRow = null;
            int objectID = -1;

            // Step through the cursor, showing the ID of each modified row.
            differenceCursor.Next(out objectID, out differenceRow);
            while (objectID != -1)
            {
                differenceCursor.Next(out objectID, out differenceRow);
                ReleaseObject(differenceRow);
            }

            ReleaseObject(differenceCursor);
            ReleaseObject(commonAncestorTable);
            ReleaseObject(versionedTable);
        }


        public static void ReleaseObject(object comObj)
        {
            try
            {
                if (comObj != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(comObj);
                }
            }
            catch { }
        }
0 Kudos
Vara_PrasadM_S
Occasional Contributor II

Hi Harrison,

I am implementing the same thing in JAVA. I have implemented same code you quoted above both JAVA and .NET. I could able to get correct results in .NET. However, I am not getting any results in JAVA. Below is my code in JAVA. Could you please help me out.

IVersionedWorkspace versionedWorkspace = new VersionedWorkspace(workspace);

              IVersion childVersion = versionedWorkspace.findVersion("SDE.Test");

              IVersion parentVersion = versionedWorkspace.getDefaultVersion();

              // Cast to the IVersion2 interface to find the common ancestor.

              IVersion2 childVersion2 = new IVersion2Proxy(childVersion);

              commonAncestorVersion = childVersion2.getCommonAncestor(parentVersion);

             

                  // Cast the child version to IFeatureWorkspace and open the table.

              IFeatureWorkspace childFWS = new IFeatureWorkspaceProxy(childVersion);

              ITable childTable = childFWS.openTable(tableName);

              // Cast the common ancestor version to IFeatureWorkspace and open the table.

              commonAncestorFWS =  new IFeatureWorkspaceProxy(commonAncestorVersion);

              commonAncestorTable = commonAncestorFWS.openTable(tableName);

              // Cast to the IVersionedTable interface to create a difference cursor.

              IVersionedTable versionedTable =  new IVersionedTableProxy(childTable);

              differenceCursor = versionedTable.differences(commonAncestorTable, esriDifferenceType.esriDifferenceTypeInsert, null);             

              int countChildRecords = childTable.rowCount(null);

              int countParentRecords = commonAncestorTable.rowCount(null);

             

              // Create output variables for the IDifferenceCursor.Next method and a FID set.

              IFIDSet fidSet = new FIDSet();

              IRow[] differenceRow = null;

              int[] objectID = null;

              // Step through the cursor, showing the ID of each modified row.

              differenceCursor.next(objectID, differenceRow);

Thanks & Regards,

Vara Prasad.

0 Kudos
AlexanderGray
Occasional Contributor III
Does reversing the parent-child order of the versions make any difference?  I would doubt it.  Looks like you are doing everything ok.  I am not enough of an Oracle with SDE expert to point to the right place but I suspect Oracle to be the problem.  I assume that a difference cursor between two versions done in oracle would involve some particularly convoluted SQL (all versioning does) and it might be caching things for performance sake.   I would look there first.
0 Kudos