+ Start a Discussion
E_GoehringE_Goehring 

PHP - ORACLE Replication Script

I was wondering if anyone should shed some light on a problem I am having. I wrote a script that replicates the information from SalesForce into an Oracle DB. The wierd thing is the Oracle row count is 1 higher then SalesForce. I am using a QueryAll call and can't figure out why there is 1 additional in Account and Contact.

 

I am running a script that is checking the Id's against Sforce, in the meantime I would love it if someone could shed some light on this. I don't think it is a duplicate insert.

 

 

Best Answer chosen by Admin (Salesforce Developers) 
msimondsmsimonds

So you script does this?:

 

1) connects to salesforce and does a SOQL query that basically selects * from Table

2) you download the data into an array and then compare the data against what  you already have in Oralce

3) then insert what is needed?

 

So is it possible that one time you had a record that was placed into your Oracle table that was deleted from Salesforce and still remains in the database?

 

Our main Database is oracle 10g and I insert records into the database two ways.  

 

1) script 1 - truncates the table in Oralce, gets a set of records and inserts them into the database. last check is to compare the amount of records in Salesforce and Oracle, if they are different, then email me

 

2) for larger tables I use getupdated() and getdeleted() toolkit functions and some other logic to get the data into Oracle

 

All these scripts work fine, i dont know how you are going to find the one record unless you have a temp table that has all the current ID's from Salesforce and you compare the data that way

 

maybe you could do a compare between the account.id and the contact.accountid, or maybe I am totally wrong here

 

I hope some of this helps

 

 

~Mike

 

All Answers

msimondsmsimonds

So you script does this?:

 

1) connects to salesforce and does a SOQL query that basically selects * from Table

2) you download the data into an array and then compare the data against what  you already have in Oralce

3) then insert what is needed?

 

So is it possible that one time you had a record that was placed into your Oracle table that was deleted from Salesforce and still remains in the database?

 

Our main Database is oracle 10g and I insert records into the database two ways.  

 

1) script 1 - truncates the table in Oralce, gets a set of records and inserts them into the database. last check is to compare the amount of records in Salesforce and Oracle, if they are different, then email me

 

2) for larger tables I use getupdated() and getdeleted() toolkit functions and some other logic to get the data into Oracle

 

All these scripts work fine, i dont know how you are going to find the one record unless you have a temp table that has all the current ID's from Salesforce and you compare the data that way

 

maybe you could do a compare between the account.id and the contact.accountid, or maybe I am totally wrong here

 

I hope some of this helps

 

 

~Mike

 

This was selected as the best answer
EgoehringEgoehring

Mike,

Thanks for your response on this. I moved past it. The problem was on my development server and I still don't know what the issue was, but the production server did not have the same issues.

 

I wrote scripts to test the counts in all different ways, I just couldn't figure it out.

 

I always welcome your comments.

 

Thanks,

 

Eric

 

PS. it was nice meeting you a couple of years ago at Dreamforce '07 PHP course.

msimondsmsimonds

Oh cool Eric I am glad that it was just a server issue. 

 

Honestly I do not remember meeting you sir, I apologize for that!!  

 

Best of luck

 

~Mike