Want to understand what is BI & DWH? Need help with your DWH design, Analysis Services, Panorama or MDX queries? Just call me.
10$
Mail me
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
In the last post, I explained the architecture of our BI project. The final part of the process is processing MS-OLAP object (cube/dimension) from Informatica mapplet. As explained earlier, the trick is to call Stored Procedure from the Informatica server. But first there is one more thing to do: How do you connect the Informatica server (Linux) with MS-OLAP (windows server)?
Informatica ships with number of drivers that can connect it with other servers. The drivers are called DataDirect and I'll discuss 4.20. You need to define this driver on the Informatica server (look in Informatica knowledge base for more information). This is an easy thing to do. Notice that you have to enter a full server name (including domain) and the password. Remember that if you'll change the password in the future the process will fail. You have to enable the protocol named "Named Pipes" in the MS-OLAP server. How to do this? Enter the Configuration Manager in the MS-OLAP server and in the section of MSSQLSERVER protocols enable the Named Pipes protocol. This will enable the connection from the Informatica server. On the Informatica server, make a regular ODBC connection.
Here is the code of the SP on the MS-OLAP side. This SP must be on the msdb Database on the Database engine.
ALTER PROCEDURE [dbo].[ProcessObject]@databaseId varchar(100),@objectType varchar(100),@objectId varchar(100),@login_name varchar(100),@returnValue int output,@errorMessage nvarchar(1024) outputASBEGINdeclare @jobName varchar(200)declare @xmla varchar(1000)declare @jobId binary(16)declare @ReturnCode intdeclare @stop int--Set job nameset @jobName = 'Process' + @objectType + '_' + @objectId--Delete the job if already existsif exists (select * from msdb.dbo.sysjobs where name = @jobName)exec msdb.dbo.sp_delete_job @job_name = @jobName--Create the jobExec msdb.dbo.sp_add_job @job_name=@jobName@enabled=1,@notify_level_eventlog=0,@notify_level_email=0,@notify_level_netsend=0,@notify_level_page=0,@delete_level=0,@description=N'process OLAP object',@category_name=N'[Uncategorized (Local)]',@owner_login_name=@login_name, @job_id=@jobId outputexec msdb.dbo.sp_add_jobserver @job_name=@jobName, @server_name=@@SERVERNAME--Declare XMLA for OLAP objectif (@objectType = 'Cube')set @xmla = ' ' + @dataBaseId + ' ' + @objectId + ' ProcessFull'else if (@objectType = 'Dim')set @xmla = ' + @dataBaseId + ' ' + @objectId + ' ProcessFull'elseBeginset @returnValue = 0return @returnValueEnd--Add the job stepExec msdb.dbo.sp_add_jobstep @job_id=@jobId, @step_name=N'Process Object',@step_id=1,@cmdexec_success_code=0,@on_success_action=1,@on_success_step_id=0,@on_fail_action=2,@on_fail_step_id=0,@retry_attempts=0,@retry_interval=0,@os_run_priority=0, @subsystem=N'ANALYSISCOMMAND',@command=@xmla,@server=@@SERVERNAME,@database_name=N'master',@flags=0--Run the jobExecute sp_start_job @jobNameWaitfor delay '00:00:05'set @returnValue = (select run_status from dbo.sysjobhistorywhere job_id = @jobIdand step_id = 1)-- Loop until the job ends and return its resultset @stop = 0if @returnValue is nullwhile @stop <> 1Beginset @returnValue = (select run_status from dbo.sysjobhistorywhere job_id = @jobIdand step_id = 1)if @returnValue is not nullset @stop = 1waitfor delay '00:00:10'End--Return error message (if exists)If @returnValue = 0 --failedset @errorMessage = (select [message] from dbo.sysjobhistorywhere job_id = @jobIdand step_id = 1)End
update: I see that the xmla code went bad in the post because it is not recognised html code. It doesn't matter, I believe you got the point...
Remember Me