I'm having trouble using custom stored procedures to ins/upd/del to an Oracle subscriber using SQL Server 2008 R2 SP2 with transactional replication.
My custom 'create procedures' are located at the end of the creation script. However, it appears that during the Distributor to Subscriber process, it may be attempting to create the procedures also, even though the stored procedures already exist on the Oracle database. This results in an error ORA-00900 'invalid SQL statement' while attempting to do:
if object_id(N'[dbo].[sp_ins_a_test_msrepl_ccs]', 'P') > 0
drop proc [dbo].[sp_ins_a_test_msrepl_ccs]
I know this code is not from my creation script because I have removed '[dbo].' entirely from my script.
I must use custom stored procedures because some of the column names in the SQL Server table are longer than 30 characters and I needed to change them in the create table statement. Without the custom stored procedures, we will be unable to replicate updates for columns for which the name has changed.
Here is my sp_addarticle:
exec sp_addarticle
@publication = N'test5',
@article = N'a_test',
@source_owner = N'dbo',
@source_object = N'a_test',
@type = N'logbased',
@description = N'',
@creation_script = N'c:\test\a_test.sql',
@pre_creation_cmd = N'drop',
@schema_option = 0x00,
@identityrangemanagementoption = N'none',
@destination_table = N'a_test',
@status = 0,
@vertical_partition = N'false',
@ins_cmd = N'CALL sp_ins_a_test',
@del_cmd = N'CALL sp_del_a_test',
@upd_cmd = N'CALL sp_upd_a_test'
If you can help, thank you!