none
Select scope info - error with ODP.NET RRS feed

  • Question

  • Hello all,

    I have a sync app to sync 2 oracle databases and because of the OracleClient limitations when working with BLOB values and OracleParameter, I turn to ODP.NET's DataAccess components. After a few changes, I thought I made it work, but then I have this error (the code is the same like when I was using OracleClient instead of ODP.NET, so all the "names" are correct) :

    An unexpected error occurred when applying batch file Batching\WebSync_bec8d7b84bcdb14da163f2cf2e4b7d4f\9d62ce37-9e61-461e-abd8-9df83ff13290.batch. See the inner exception for more details.

    Cannot read scope information for scope CMET_SCOPE_CATALOGUES_65E0D1DE15A14A5383FDF0C3D5374F82. Ensure that the scope name is correct and the SqlCeSyncScopeProvisioning.Apply method was called to create that scope.
      
    at Microsoft.Synchronization.Data.DbSyncScopeHandler.ReadScope(IDbConnection connection, IDbTransaction transaction, ReadKnowledgeType readType, ReadForgottenKnowledgeType readFKtype)
       at Microsoft.Synchronization.Data.SyncScopeHandlerBase.ReadScope(IDbConnection connection, ReadKnowledgeType readType)
       at Microsoft.Synchronization.Data.RelationalSyncProvider.InitializeChangeApplicationTransaction()
       at Microsoft.Synchronization.Data.RelationalSyncProvider.ApplyChanges(DbSyncScopeMetadata scopeMetadata, DataSet dataSet, DbSyncSession DbSyncSession, Boolean commitTransaction, String batchFileName, ChangeApplicationAction& action)
       at Microsoft.Synchronization.Data.DbSyncBatchConsumer.ApplyBatches(DbSyncScopeMetadata scopeMetadata, DbSyncSession syncSession, SyncSessionStatistics sessionStatistics)


    Here is the code for the SelectScopeInfo command(the constants represent string values that have the same value) :
    string oraParamName = ":" + DbSyncSession.SyncScopeName;
    
    // Build command text
    StringBuilder strBuilder = new StringBuilder();
    strBuilder.AppendLine("SELECT ");
    strBuilder.AppendLine(OracleSyncScopeProvisioning.SCOPE_ID + ", ");
    strBuilder.AppendLine(OracleSyncScopeProvisioning.SCOPE_LOCAL_ID + ", ");
    strBuilder.AppendLine(OracleSyncScopeProvisioning.SCOPE_SYNC_KNOWLEDGE + ", ");
    strBuilder.AppendLine(OracleSyncScopeProvisioning.SCOPE_TOMBSTONE_CLEANUP_KNOW + ", ");
    strBuilder.AppendLine(OracleSyncScopeProvisioning.SCOPE_TIMESTAMP + " ");
    strBuilder.AppendLine("FROM " + OracleSyncScopeProvisioning.SCOPE_INFO_TABLE + " ");
    strBuilder.AppendLine("WHERE " + OracleSyncScopeProvisioning.SCOPE_NAME + " = " + oraParamName);
    strBuilder.Replace("\r", "");
    
    string commandText = strBuilder.ToString();
    
    // Specify the command to select local replica metadata.
    OracleCommand selScopeInfoCmd = new OracleCommand();
    selScopeInfoCmd.CommandType = CommandType.Text;
    
    selScopeInfoCmd.CommandText = commandText;
    
    OracleParameter scopeNameParam = new OracleParameter(oraParamName, OracleDbType.Varchar2, 200);
    selScopeInfoCmd.Parameters.Add(scopeNameParam); selScopeInfoCmd.BindByName = true; this.SelectScopeInfoCommand = selScopeInfoCmd;
    Here is the SCOPE_INFO table :

    CREATE TABLE SCOPE_INFO
    	(
    	SCOPE_LOCAL_ID               NUMBER (9) NOT NULL,
    	SCOPE_ID                     RAW (16) NOT NULL,
    	SCOPE_NAME                   VARCHAR2 (200) NOT NULL,
    	SCOPE_SYNC_KNOWLEDGE         BLOB,
    	SCOPE_TOMBSTONE_CLEANUP_KNOW BLOB,
    	SCOPE_TIMESTAMP              NUMBER (9),
    	SCOPE_RESTORE_COUNT          NUMBER (9) DEFAULT 0,
    	PRIMARY KEY (SCOPE_NAME)
    	);

    And this are the table's contents when the sync orchestrator calls the command:
    1,
    85EC3B2CCE4E42AABEDA5852DAFA447B,
    'CMET_SCOPE_CATALOGUES_65E0D1DE15A14A5383FDF0C3D5374F82',
    NULL,
    NULL,
    2001,
    0



    Thank you for any input you may have on this one,

    phazzy
    Monday, February 22, 2010 8:40 AM

Answers

  • When Source or Target Provider is created for Sync (used by SyncOrchestrator object), the scope name needs to be passed in as a parameter to the constructor. 

    Please check.

    Thanks.


    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, February 22, 2010 8:30 PM
    Answerer
  • you can enable SyncTracing to see what's being passed. taking a peek at ReadScope,  it's expecting the parameter name to be "@sync_scope_name"
    Tuesday, February 23, 2010 1:32 AM
    Moderator

All replies

  • Update:
    It seems to be from the scope name parameter of the oracle command, because if do the select without the parameter (just with SCOPE_LOCAL_ID = 1 condition), it works.

    I have ran the oracle command separately in another test program and it works if I manually set the parameter value to be the one above(i.e. CMET_...etc). This means the the value set by the sync orchestrator(or its type) is not ok. But I don't have a way to see what is in the parameter when the sync orchestrator runs the command. Maybe try different values for scopeNameParam.DbType and see wich of them works.


    Monday, February 22, 2010 11:18 AM
  • When Source or Target Provider is created for Sync (used by SyncOrchestrator object), the scope name needs to be passed in as a parameter to the constructor. 

    Please check.

    Thanks.


    Leo Zhou ------ This posting is provided "AS IS" with no warranties, and confers no rights.
    Monday, February 22, 2010 8:30 PM
    Answerer
  • you can enable SyncTracing to see what's being passed. taking a peek at ReadScope,  it's expecting the parameter name to be "@sync_scope_name"
    Tuesday, February 23, 2010 1:32 AM
    Moderator