Hi Mark,
Thanks. Noted your recommendations.
1. Yes, in the above stated example myLog is solely used as a key generator
2. The identity gap that might be generated due to PDS or RDS shutdown hard - is taken care.
3. Modifying the stored procedure code is not allowed.
Stored procedure replication is implemented. It is noted execution of stored procedure is logged and replicated.
There is another case.
Table DDL:
create table myTran (
myTran_Id numeric(20,0) identity ,
myMessage varchar(255) not null ,
myKey numeric(20,0) not null
)
go
Procedure DDL:
create procedure myTran_sp
(
@myKey numeric(20) output )
as
select @myKey = convert( numeric(20,0), reserve_identity( 'mydb..myTran', 1 ) )
INSERT mydb..myTran (myMessage, myKey) VALUES ( 'testing', @myKey )
go
Though stored procedure replication executes the stored procedure at RDS, while tracing it is noted there are additional independent grouped transactions INSERT into and DELETE from table "mydb..myTran".
Some insert fails at RDS reporting of duplicate key error WHEN the stored procedure is replicated.
Based on the traces, suspecting there might be other sources (other than stored procedures) in their application which might be causing the identity gap by using "reserve_identity"
When stored procedure is not replicated everything is OK, except that the next value for tables with IDENTITY column will not be in sync. One way to solve would be as you had mentioned write a script to periodically check and keep RDS in sync.
Question:
- Is there any other method you think might solve this issue globally.
Thanks & Regards,
Shiva