Home Microsoft SQL Server DigiMailing iRN Contact
    Keyword



sys.sp_MSrepl_verify_oracle_provider_isregistered

  No additional text.


Syntax

-- Name: sp_MSrepl_verify_oracle_provider_isregistered

-- Descriptions: Verify that the Oracle OLEDB provider OraOLEDB.Oracle is registered and the the named DLL exists.

-- Parameters: as defined in create statement

-- Security:
-- Requires Certificate signature for catalog access

-- Returns: 0 - success
--          1 - Otherwise

CREATE procedure sys.sp_MSrepl_verify_oracle_provider_isregistered
AS
	SET NOCOUNT ON

	DECLARE @retcode  int
	DECLARE @regkey nvarchar(100)
	DECLARE @command nvarchar(4000)
	DECLARE @CLSIDRegName sysname
	DECLARE @CLSID nvarchar(100)
	DECLARE @InprocServer32RegName  sysname
	DECLARE @InprocServer32 nvarchar(4000)
	DECLARE @echo_text nvarchar(20)

	-- set registry key for Oracle CLSID
	SELECT @regkey = 'OraOLEDB.Oracle\CLSID'

	-- read the CLSID value
	SELECT @CLSIDRegName = null	
	SELECT @CLSID = null
	EXECUTE @retcode = master.dbo.xp_regread 'HKEY_CLASSES_ROOT',
		@regkey,
		@CLSIDRegName,					
		@param = @CLSID OUTPUT

	IF(@retcode <> 0)
	BEGIN
		RAISERROR(21629, 16, -1)
		RETURN(1)
	END

	-- set registry key for Oracle provider path
	SELECT @regkey = 'CLSID\' + sys.fn_escapecmdshellsymbolsremovequotes(@CLSID) collate database_default + '\InprocServer32'

	-- read the InprocServer32 value
	SELECT @InprocServer32RegName = null	
	SELECT @InprocServer32 = null
	EXECUTE @retcode = master.dbo.xp_regread 'HKEY_CLASSES_ROOT',
		@regkey,
		@InprocServer32RegName,					
		@param = @InprocServer32 OUTPUT

	IF(@retcode <> 0)
	BEGIN
		RAISERROR(21629, 16, -1)
		RETURN(1)
	END
	
	-- The registry key is not set so error as well.
	IF(@InprocServer32 is null)
	BEGIN
		RAISERROR(21629, 16, -1)
		RETURN(1)
	END

	select @echo_text = N'file_exists'

	select @command = N'if exist "' + sys.fn_escapecmdshellsymbolsremovequotes(@InprocServer32) collate database_default + N'" echo ' + @echo_text

	create table #text_ret(cmdoutput nvarchar(255) collate database_default null)

	insert into #text_ret exec @retcode = master.dbo.xp_cmdshell @command
	IF @@error <> 0 or @retcode <> 0
	BEGIN
		drop table #text_ret
		RAISERROR(21624, 16, -1)
		RETURN(1)
	END

	IF exists (select * from #text_ret where ltrim(rtrim(cmdoutput)) = @echo_text)
	BEGIN
		drop table #text_ret
		RETURN(0)
	END
	ELSE
	BEGIN
		drop table #text_ret
		RAISERROR(21624, 16, -1)
		RETURN(1)
	END

 
Last revision 2008RTM
See also

  sp_MSdrop_replcom (Procedure)
sp_MSrepl_testconnection (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