none
Issue with Ms.Sync framework 2.0 and odp.net managed driver RRS feed

  • Question

  • Hi,

    We have been using Ms.Sync framework 2.0 and Oracle ODP.NET Umanaged driver to sync data with Oracle database.

    Now, we moved to ODP.NET, Managed driver.

    The synchronization fails with this error when we call RelationalSyncProvider.ProcessChangeBatch.

    Do you have any ideas?

    We contacted Oracle in below thread and provide the trace log. After reviewing, they suggest us to contact Microsoft.

    https://community.oracle.com/thread/4153267

    Thanks very much.

     

    System.ObjectDisposedException was unhandled by user code

      HResult=-2146232798

      Message=Cannot access a disposed object.

    Object name: 'OracleCommand'.

      Source=Oracle.ManagedDataAccess

      ObjectName=OracleCommand

      StackTrace:

           at Oracle.ManagedDataAccess.Client.OracleCommand.set_Connection(OracleConnection value)

           at Oracle.ManagedDataAccess.Client.OracleCommand.set_DbConnection(DbConnection value)

           at Microsoft.Synchronization.Data.DbSyncScopeHandler.ReadScope(IDbConnection connection, IDbTransaction transaction, ReadKnowledgeType readType, ReadForgottenKnowledgeType readFKtype)

           at Microsoft.Synchronization.Data.RelationalSyncProvider.InitializeChangeApplicationTransaction()

           at Microsoft.Synchronization.Data.RelationalSyncProvider.SingleTransactionApplyChangesAdapter.PrepareForApplyOrRetry(DataSet ds)

           at Microsoft.Synchronization.Data.RelationalSyncProvider.ApplyChanges(DbSyncScopeMetadata scopeMetadata, DataSet dataSet, DbSyncSession dbSyncSession, Boolean commitTransaction)

           at Microsoft.Synchronization.Data.RelationalSyncProvider.ProcessChangeBatch(ConflictResolutionPolicy resolutionPolicy, ChangeBatch sourceChanges, Object changeDataRetriever, SyncCallbacks syncCallbacks, SyncSessionStatistics sessionStatistics)

    Monday, June 25, 2018 4:49 AM

All replies

  • I'd like to add that our OracleDbSyncProvider code is listed below and basically originated from this article:

    https://code.msdn.microsoft.com/Database-Sync-Oracle-and-037fb083#content

    Thanks.

    /// <summary>
        /// Derived DbSyncProvider for Oracle.
        /// </summary>
        public class OracleDbSyncProvider : DbSyncProvider
        {
            public OracleDbSyncProvider()
            {
                // We need to modify this particular column name because the default is longer than Oracle allows.
                this.ScopeForgottenKnowledgeColName = "scope_forgotten_knowledge";
                this.ScopeNameColName = "scope_name";
            }

            /// <summary>
            /// The IsolationLevel is ReadCommitted, however executing "set transaction read only" guarantees transaction-level
            /// read consistency.
            /// </summary>
            /// <returns></returns>
            protected override IDbTransaction CreateEnumerationTransaction()
            {
                OracleTransaction trans = (OracleTransaction)this.Connection.BeginTransaction();
                new OracleCommand("set transaction read only", (OracleConnection)this.Connection).ExecuteNonQuery();
                return trans;
            }

            public DbSyncScopeDescription ScopeDescription
            {
                get;
                set;
            }
        }

    Monday, June 25, 2018 5:28 AM