Ads

13 March 2013

To add article to existing Oracle -SQL Replication

Declare @Table_Owner varchar (4000)
Declare @Table varchar (4000)
Declare @Schema varchar (8000)
Declare @Str_Ins varchar (4000)
Declare @Str_Upd varchar (4000)
Declare @Str_Del varchar (4000)

Set @Table_Owner = N'OWNERNAME'
Set @Table = N'ARTICLENAME'
Set @Schema = @Table_Owner+@Table
Set @Str_Ins = N'CALL sp_MSins_'+@Schema+''
Set @Str_Upd = N'CALL sp_MSupd_'+@Schema+''
Set @Str_Del = N'CALL sp_MSdel_'+@Schema+''



-- Adding the transactional articles



use [distribution]

exec sp_addarticle @publication= N'Pegasus_OPS', @article= N' ARTICLENAME',
@publisher= N'PEGPDB', @source_owner= N'DOOR_PRD', @source_object= N'ARTICLENAME',
@type= N'logbased', @description= N'', @creation_script= N'', @pre_creation_cmd= N'drop',
@schema_option= 0x0000000000000083, @use_default_datatypes= 1, @destination_table= N'ARTICLENAME',
@destination_owner= N'dbo', @status= 16, @vertical_partition= N'false',@force_invalidate_snapshot=1,
@ins_cmd= @Str_Ins, @del_cmd= @Str_Del, @upd_cmd= @Str_Upd

Go

No comments:

Post a Comment