Showing posts with label aware. Show all posts
Showing posts with label aware. Show all posts

Tuesday, March 27, 2012

Calling SSIS packages from a Service Broker Queue

I would like to call an SSIS package from a Service Broker Queue.

There is one way that I am aware of -

Using xp_cmdshell from within an activation stored procedure and using DTEXEC.

Is there a more elegant way of executing an SSIS package from within SSB?

Also, I am not interested in writing a .NET external activator to process my messages in the queue. I would like this operation to be strictly database oriented. Having said this, I am also trying to avoid triggers processing the messages in the queue.

Thank you!

SQLCLR with unsafe assembly (in order to call Process.Start()) would be slightly better option than xp_cmdshell. Even then, starting external processes from an activated stored procedure is limiting and dangerous. Limiting because you can only start the external application as the service account running sqlservr.exe. Dangerous because if the process fails to start (eg> out of memory), you may orphan messages in the queue since there will be no process to process them.

You might want to look at the External Activator sample (linked from www.sqlservicebroker.com) and adapt it or build something similar.

I don't know what you mean by "triggers processing the messages in the queue". SQL Server 2005 has no triggers for queues.

Rushi

|||

We use this mechanism to farm out data warehouse ETL mechanism and it works fairly well.

Once you start up SSIS, though, your package should be the one that reaches back into the DB and pulls messages off the queue. Make sure to put your transaction logic, error handling, etc. in the SSIS control flow, taking into account what should be done with messages in the context of your package.

There's a ton of SSIS overhead (at least compared with pulling a message off a queue), so if you're getting a fair number of messages, you don't want to start up the engine each time you want to process a message. We opted to call out to dtexec rather than have a separate service running, although I think that's a matter of preference (and your level of comfort/concern of running external processes from SQL vs. having to install/manage other services).

|||

Couldn't you just create a SQLCLR stored procedure to execute the package directly & with full transactional support? I.e. Have an activated stored proc, authored in C#, executing the SSIS package without doing any "shelling out".

Something like the link below implemented as a SQLCLR proc?

http://www.codeproject.com/useritems/CallSSISFromCSharp.asp?df=100&forumid=309846&exp=0&select=1519306

Calling SSIS packages from a Service Broker Queue

I would like to call an SSIS package from a Service Broker Queue.

There is one way that I am aware of -

Using xp_cmdshell from within an activation stored procedure and using DTEXEC.

Is there a more elegant way of executing an SSIS package from within SSB?

Also, I am not interested in writing a .NET external activator to process my messages in the queue. I would like this operation to be strictly database oriented. Having said this, I am also trying to avoid triggers processing the messages in the queue.

Thank you!

SQLCLR with unsafe assembly (in order to call Process.Start()) would be slightly better option than xp_cmdshell. Even then, starting external processes from an activated stored procedure is limiting and dangerous. Limiting because you can only start the external application as the service account running sqlservr.exe. Dangerous because if the process fails to start (eg> out of memory), you may orphan messages in the queue since there will be no process to process them.

You might want to look at the External Activator sample (linked from www.sqlservicebroker.com) and adapt it or build something similar.

I don't know what you mean by "triggers processing the messages in the queue". SQL Server 2005 has no triggers for queues.

Rushi

|||

We use this mechanism to farm out data warehouse ETL mechanism and it works fairly well.

Once you start up SSIS, though, your package should be the one that reaches back into the DB and pulls messages off the queue. Make sure to put your transaction logic, error handling, etc. in the SSIS control flow, taking into account what should be done with messages in the context of your package.

There's a ton of SSIS overhead (at least compared with pulling a message off a queue), so if you're getting a fair number of messages, you don't want to start up the engine each time you want to process a message. We opted to call out to dtexec rather than have a separate service running, although I think that's a matter of preference (and your level of comfort/concern of running external processes from SQL vs. having to install/manage other services).

|||

Couldn't you just create a SQLCLR stored procedure to execute the package directly & with full transactional support? I.e. Have an activated stored proc, authored in C#, executing the SSIS package without doing any "shelling out".

Something like the link below implemented as a SQLCLR proc?

http://www.codeproject.com/useritems/CallSSISFromCSharp.asp?df=100&forumid=309846&exp=0&select=1519306

Tuesday, February 14, 2012

Calculating initial size tempdb

Although I may not be sure I know how to set the initial size of the tempdb
(this is on a production server), I am aware from the reading I have done,
that it may be possible to increase performance if the initial size of the
log is adequate to prevent the tempdb from performing a great deal of
autogrowth [viewable in the dbcc loginfo('mydb') command]. Is there a
formula to calculate approximately what this initial size should be set at?
Do I risk hurting performance if this is done incorrectly? Currently there
is plenty of disk space available but we are considering log shipping which
will substantially reduce that space. The log file for the very large
database tends to hover around 10 gig which seems fairly large to me, but
considering there is a history filegroup that hovers around 55 gig and a
primary filegroup around 35 gig, it may be correct.
I am looking for some general guidance on how to set the tempdb initial
size for greater performance and perhaps how to fix log files that are
disporportionately large resulting from constant bulk inserts. Two sites I
looked at
http://www.karaszi.com/SQLServer/info_dont_shrink.asp
and
http://sqlserver2000.databases.aspfaq.com/why-is-tempdb-full-and-how-can-i-prevent-this-from-happening.html
have pushed me to inquire in this fashion.
Regards,
Jamie
Correction to the above. The test database indicates that the initial size
should be about 400 MB if it is to be larger than the one currently there.
I have set the initial size to 400 MB. Is there a way to test this size?
Regards,
Jamie
"thejamie" wrote:

> Although I may not be sure I know how to set the initial size of the tempdb
> (this is on a production server), I am aware from the reading I have done,
> that it may be possible to increase performance if the initial size of the
> log is adequate to prevent the tempdb from performing a great deal of
> autogrowth [viewable in the dbcc loginfo('mydb') command]. Is there a
> formula to calculate approximately what this initial size should be set at?
> Do I risk hurting performance if this is done incorrectly? Currently there
> is plenty of disk space available but we are considering log shipping which
> will substantially reduce that space. The log file for the very large
> database tends to hover around 10 gig which seems fairly large to me, but
> considering there is a history filegroup that hovers around 55 gig and a
> primary filegroup around 35 gig, it may be correct.
> I am looking for some general guidance on how to set the tempdb initial
> size for greater performance and perhaps how to fix log files that are
> disporportionately large resulting from constant bulk inserts. Two sites I
> looked at
> http://www.karaszi.com/SQLServer/info_dont_shrink.asp
> and
>
> http://sqlserver2000.databases.aspfaq.com/why-is-tempdb-full-and-how-can-i-prevent-this-from-happening.html
> have pushed me to inquire in this fashion.
> --
> Regards,
> Jamie
|||Hi Jamie
I am not sure there is a formula that tells you a figure that you can set
tempdb to to get the size. There are separate ones for things like how much
space would be used by rebuilding indexes
http://msdn2.microsoft.com/en-us/library/ms191183.aspx. In general I would
look at setting a reasonable size and then monitoring when and by how much it
grows. Then setting the initial size to a value that will cover normal usage.
John
"thejamie" wrote:
[vbcol=seagreen]
> Correction to the above. The test database indicates that the initial size
> should be about 400 MB if it is to be larger than the one currently there.
> I have set the initial size to 400 MB. Is there a way to test this size?
> --
> Regards,
> Jamie
>
> "thejamie" wrote:

Calculating initial size tempdb

Although I may not be sure I know how to set the initial size of the tempdb
(this is on a production server), I am aware from the reading I have done,
that it may be possible to increase performance if the initial size of the
log is adequate to prevent the tempdb from performing a great deal of
autogrowth [viewable in the dbcc loginfo('mydb') command]. Is there a
formula to calculate approximately what this initial size should be set at?
Do I risk hurting performance if this is done incorrectly? Currently there
is plenty of disk space available but we are considering log shipping which
will substantially reduce that space. The log file for the very large
database tends to hover around 10 gig which seems fairly large to me, but
considering there is a history filegroup that hovers around 55 gig and a
primary filegroup around 35 gig, it may be correct.
I am looking for some general guidance on how to set the tempdb initial
size for greater performance and perhaps how to fix log files that are
disporportionately large resulting from constant bulk inserts. Two sites I
looked at
http://www.karaszi.com/SQLServer/info_dont_shrink.asp
and
http://sqlserver2000.databases.aspf...-happening.html
have pushed me to inquire in this fashion.
Regards,
JamieCorrection to the above. The test database indicates that the initial size
should be about 400 MB if it is to be larger than the one currently there.
I have set the initial size to 400 MB. Is there a way to test this size?
--
Regards,
Jamie
"thejamie" wrote:

> Although I may not be sure I know how to set the initial size of the tempd
b
> (this is on a production server), I am aware from the reading I have done,
> that it may be possible to increase performance if the initial size of the
> log is adequate to prevent the tempdb from performing a great deal of
> autogrowth [viewable in the dbcc loginfo('mydb') command]. Is there
a
> formula to calculate approximately what this initial size should be set at
?
> Do I risk hurting performance if this is done incorrectly? Currently ther
e
> is plenty of disk space available but we are considering log shipping whic
h
> will substantially reduce that space. The log file for the very large
> database tends to hover around 10 gig which seems fairly large to me, but
> considering there is a history filegroup that hovers around 55 gig and a
> primary filegroup around 35 gig, it may be correct.
> I am looking for some general guidance on how to set the tempdb initial
> size for greater performance and perhaps how to fix log files that are
> disporportionately large resulting from constant bulk inserts. Two sites
I
> looked at
> http://www.karaszi.com/SQLServer/info_dont_shrink.asp
> and
>
> http://sqlserver2000.databases.aspf...-happening.html
> have pushed me to inquire in this fashion.
> --
> Regards,
> Jamie|||Hi Jamie
I am not sure there is a formula that tells you a figure that you can set
tempdb to to get the size. There are separate ones for things like how much
space would be used by rebuilding indexes
http://msdn2.microsoft.com/en-us/library/ms191183.aspx. In general I would
look at setting a reasonable size and then monitoring when and by how much i
t
grows. Then setting the initial size to a value that will cover normal usage
.
John
"thejamie" wrote:
[vbcol=seagreen]
> Correction to the above. The test database indicates that the initial siz
e
> should be about 400 MB if it is to be larger than the one currently there.
> I have set the initial size to 400 MB. Is there a way to test this size?
> --
> Regards,
> Jamie
>
> "thejamie" wrote:
>