Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_ORACheckLoopbackSupport

  No additional text.


Syntax


-- Name:
--		sp_ORACheckLoopbackSupport

-- Description:
--		Verify subscriber is configured with loopback support (Oracle specific)

-- Inputs:
--		@subscriber		== subscriber name

-- Returns:
--		Return code (0 for success, 1 for failure)

-- Security:
--		Internal

-- Notes:
--		Used by sp_IHCheckLoopbackSupport


CREATE PROCEDURE sys.sp_ORACheckLoopbackSupport
(
	@subscriber			sysname
)
AS
BEGIN
	DECLARE @retcode		int
	DECLARE @subid			int
	DECLARE @InsColumnList		nvarchar(200)
	DECLARE @SelectColumnList	nvarchar(200)
	DECLARE @publisher		sysname

	-- Verify subscriber exists
	SELECT	@subid = srvid
	FROM	master.dbo.sysservers
	WHERE	UPPER(srvname collate database_default) = UPPER(@subscriber) collate database_default
	
	IF @subid IS NULL
	BEGIN
		SELECT	@subscriber = QUOTENAME(@subscriber)
		RAISERROR(21740, 16, -1, @subscriber)
		RETURN (1)
	END

	-- Define sp_ORAremotequery support table
	create table #hquery
	(
		seq	int identity(2,1),
		cmd	nvarchar(4000)
	)

	-- Define #MSSQLSERVERDISTRIBUTOR support table
	create table #MSSQLSERVERDISTRIBUTOR
	(
		publisher	sysname,
		distributor	sysname,
		distributiondb	sysname,
		version		sysname,
		status		int
	)

	
	-- Populate a temp table with the distributor information from subscriber
	
	SELECT @InsColumnList    = 'publisher, distributor, distributiondb, version, status'
	SELECT @SelectColumnList = '*'

	-- Query subscriber for distributor information
	INSERT INTO #hquery(cmd) VALUES ('SELECT DISTRIBUTOR_PUBLISHERNAME, ')
	INSERT INTO #hquery(cmd) VALUES ('DISTRIBUTOR_DISTRIBUTORNAME, ')
	INSERT INTO #hquery(cmd) VALUES ('DISTRIBUTOR_DISTRIBUTIONDB, ')
	INSERT INTO #hquery(cmd) VALUES ('DISTRIBUTOR_PRODUCTVERSION, ')
	INSERT INTO #hquery(cmd) VALUES ('DISTRIBUTOR_STATUS ')
	INSERT INTO #hquery(cmd) VALUES ('FROM MSSQLSERVERDISTRIBUTOR ')
	
	EXEC @retcode = sp_ORAremotequery
					@Server			= @subscriber,
					@SelectColumnList	= @SelectColumnList,
					@InsTable		= '#MSSQLSERVERDISTRIBUTOR',
					@InsColumnList		= @InsColumnList

	IF  (@@error <> 0 OR @retcode <> 0)
	BEGIN
		DROP TABLE #MSSQLSERVERDISTRIBUTOR
		DROP TABLE #hquery

		SELECT	@subscriber = QUOTENAME(@subscriber)

		RAISERROR (21741, 16, -1, @subscriber)
		RETURN (1)
	END

	-- Verify subscriber is also publisher
	IF NOT EXISTS
	(
		SELECT	publisher
		FROM	#MSSQLSERVERDISTRIBUTOR
		WHERE	UPPER(publisher collate database_default) = UPPER(@subscriber)
	)
	BEGIN
		DROP TABLE #MSSQLSERVERDISTRIBUTOR
		DROP TABLE #hquery

		SELECT	@publisher = QUOTENAME(@publisher),
			@subscriber = QUOTENAME(@subscriber)

		RAISERROR (21742, 16, -1, @publisher, @subscriber)
		RETURN (1)
	END
	
	DROP TABLE #MSSQLSERVERDISTRIBUTOR

	-- Verify that HREPL.SetSqlOriginator can be called using the connection
	-- to the subscriber.

	TRUNCATE TABLE #hquery

	-- call HREPL.SetSqlOriginator to verify that bi-directional support has
	-- been installed at the Oracle database. Since this query may not be made by
	-- the replication administrator, use the public synonym to identify the HREPL package.
	INSERT INTO #hquery(cmd) VALUES (N'CALL MSSQLSERVERSETSQLORIGINATOR.SetSqlOriginator')

	EXEC @retcode = sys.sp_IHquery @publisher
	
	IF  (@@error <> 0 OR @retcode <> 0 )
	BEGIN
		DROP TABLE #hquery

		SELECT	@publisher = QUOTENAME(@publisher)

		RAISERROR (21743, 16, -1, @publisher)
		RETURN (1)
	END
	
	DROP TABLE #hquery

	RETURN (0)
END

 
Last revision 2008RTM
See also

  sp_MSadd_subscription (Procedure)
sp_MSdrop_repltran (Procedure)
       



News

  Query a named instance
Sybase+ASE+silent+install
SQL 2008 R2
Deprecated procedures in SQL2008
Reporting Services item-level role definitions
Create all your missing indexes
Converting datetime field
Start MSSQL Server Profiler at time
Replicating MSSQL Server views
Exploring Microsoft Sharepoint
The OLE DB provider "SQLNCLI10" for linked server indicates.
Mobile solar charger
Oracle to SQL Server replication
Cannot insert the value NULL into column
Undocumented Microsoft SQL Server 2008
VMware
Zoekmachine optimalisatie
SQL Servers hidden objects
FckEditor
Flash in Ajax
De hype die AJAX heet
Barcode scannen
MySQL; Gratis, makkelijk en snel!
PHP
sIFR; de combinatie tussen HTML en Flash