Help get this topic noticed by sharing it on Twitter, Facebook, or email.
I’m indifferent

Fatal DBAmp error attempting to query linked server for an object. SOQL works.

We recently started to receive a new error when we attempt to execute the SF_Refresh stored procedure, or even a Linked-Server query, against our Apttus__Proposal__Propsal__c object.

We were refreshing this table daily until recently without error, so I am assuming something with the stored data in salesforce might be causing this error:

-- Examples which are giving us errors now:
use sfdc_archive
go

exec SF_Refresh 'SFDC','Apttus_Proposal__Proposal__c'
go
-- FAILS WITH ERROR
-- Starting SF_Refresh for Apttus_Proposal__Proposal__c
-- 18:47:47: Using last run time of 2015-05-28 01:11:00
-- Msg 7330, Level 16, State 2, Line 9
-- Cannot fetch a row from OLE DB provider "DBAmp.DBAmp" for linked server "SFDC".

select *
from SFDC...Apttus_Proposal__Proposal__c where SystemModStamp > '2015-05-28 01:11:00'
go
-- FAILS WITH ERROR
-- Msg 7399, Level 16, State 1, Line 5
-- The OLE DB provider "DBAmp.DBAmp" for linked server "SFDC" reported an error. Provider caused a server fault in an external process.
-- Msg 7330, Level 16, State 2, Line 5
-- Cannot fetch a row from OLE DB provider "DBAmp.DBAmp" for linked server "SFDC".

select *
from OpenQuery(SFDC,'select * from Apttus_Proposal__Proposal__c where SystemModStamp > 2015-05-28T01:11:00Z')
go
-- SUCCEEDS

Why would be be reciving a new error with the linked server attempting to read this object? This looks like a potential dbAmp bug?
Should we try to zero in on which row of data is causing the problem? I can see the select query start to function and return rows prior to the error.
1 person has
this problem
+1
Reply
  • Can you provide a few other things:

    The version of DBAmp that is installed on this server

    A screenshot of the Server Options page of the linked server

    A screenshot of the DBAmp.DBAmp provider options page (Server Objects/Linked Servers/Providers / right click on DBAmp.DBAmp and choose Properties.)

    Also, how long does it usually take to REPLICATE (full) this object ?
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • Here is some further information from today's failure with the attempted refresh. It looks like replicate is failing as well, so I can't answer your question on how long it normally takes to replicate in full.

    Refresh failed for Apttus_Proposal__Proposal__c. Attempting Replicate. [SQLSTATE 01000]
    Error 7330, Severity 16, State 2, Line 1 [SQLSTATE 01000]
    Cannot fetch a row from OLE DB provider "DBAmp.DBAmp" for linked server "SFDC". [SQLSTATE 01000]
    Table Apttus_Proposal__Proposal__c is being replicated. [SQLSTATE 01000]
    --- Starting SF_Replicate for Apttus_Proposal__Proposal__c [SQLSTATE 01000]
    01:34:59: Drop Apttus_Proposal__Proposal__c_Previous if it exists. [SQLSTATE 01000]
    01:34:59: Create Apttus_Proposal__Proposal__c_Previous with new structure. [SQLSTATE 01000]
    01:35:00: Run the DBAmp.exe program. [SQLSTATE 01000]
    01:35:01: DBAmp Bulk Operations. V2.17.3 (c) Copyright 2006-2013 forceAmp.com LLC [SQLSTATE 01000]
    01:35:01: Populating local table Apttus_Proposal__Proposal__c_Previous , SQLCHSADB / SFDC_Archive . [SQLSTATE 01000]
    01:35:02: DBAmp is using the SQL Native Client. [SQLSTATE 01000]
    01:35:02: Opening SQL Server rowset [SQLSTATE 01000]
    01:44:06: Error: Fatal error occurred mapping salesforce object into buffer. [SQLSTATE 01000]
    01:44:06: Error: Replication failed. [SQLSTATE 01000]
    Source: ForceAmpAPI.FAField.1 [SQLSTATE 01000]
    Description: Failed to convert server data type to variant type::Total_Service_Or_Training_Discount__c 4.125E40 [SQLSTATE 01000]
    01:44:09: Error: DBAmp.exe was unsuccessful. [SQLSTATE 01000]
    01:44:09: Error: Command string is C:\"Program Files"\DBAmp\DBAmp.exe Export "Apttus_Proposal__Proposal__c_Previous" "SQLCHSADB" "SFDC_Archive" "SFDC" [SQLSTATE 01000]
    --- Ending SF_Replicate. Operation FAILED. [SQLSTATE 01000]

    The version of DBAmp we are currently running is 2.17.3

    And the screenshots you requested are attached.



  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • You have a formula fieldTotal_Service_Or_Training_Discount__c that is calculating a silly value : 4.125E40 (4 with 40 zeros).

    Later versions of DBAmp try to truncate this value before storing it in SQL server but your version does not.

    Clearly there is a record that was added recently that is the record that is causing this. I would suggest reviewing the formula for divide by zero or other weird calculations. You may need to add some bounds checking in the formula itself.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited

  • Thank you Bill.

    We were able to identify the row which was throwing the error, and we were able to alter the formula for the calculation so that it better handles rounding error in order to prevent the error from occurring fetching that row through the linked server.

    I appreciate your assistance.
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated indifferent, undecided, unconcerned kidding, amused, unsure, silly happy, confident, thankful, excited