-- Name:
-- sp_ORAposttracertoken
-- Description:
-- Post a tracer token in HREPL_Event
-- Security:
-- Internal
-- Returns:
-- Success/failure
-- Notes:
-- This stored procedure calls HREPL.Trace at the Oracle publisher to
-- post a tracer token to the HREPL_Event table. When the heterogeneous
-- log reader processes the event table and sees the token, it will enter
-- it into MSrepl_commands.
-- Owner:
--
CREATE PROCEDURE sys.sp_ORAposttracertoken
(
@publicationID int,
@articleID int,
@tracercmdtype int,
@tracerstr sysname,
@publisher sysname
)
AS
BEGIN
DECLARE @retcode int
SET NOCOUNT ON
-- Define sp_IHquery support table
create table #hquery
(
seq int identity(2,1),
cmd nvarchar(4000)
)
-- Call the remote routine to post the tracer token
INSERT INTO #hquery (cmd) VALUES (N'{call HREPL.Trace(')
INSERT INTO #hquery (cmd) VALUES (CONVERT(NVARCHAR(255), @publicationID) + N', ')
INSERT INTO #hquery (cmd) VALUES (CONVERT(NVARCHAR(255), @articleID) + N', ')
INSERT INTO #hquery (cmd) VALUES (CONVERT(NVARCHAR(255), @tracercmdtype) + N',')
INSERT INTO #hquery (cmd) VALUES (QUOTENAME(@tracerstr, '''') + N' )}')
EXEC @retcode = sys.sp_IHquery @publisher
IF (@@error <> 0 OR @retcode <> 0)
BEGIN
RAISERROR (21833, 16, -1, @publisher)
RETURN (1)
END
RETURN(0)
END