dbTalk Databases Forums  

Package run from query

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Package run from query in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Knut Bohn via SQLMonster.com
 
Posts: n/a

Default Package run from query - 02-02-2005 , 02:25 AM






I have a DTS package containg a Send Mail task, which runs fine when
manually executed. Thanks to some great tip at this site I've managed to
create a shell command, which also fires the package.
What I really want to do is to run this package from a query, which
contains:
EXEC [master].[dbo].[xp_cmdshell] 'DTSRun /S "(local)" /N "Reissue_eksport"
/G "{AD959795-E8C6-4B88-B0D9-5F29EBC38AE5}" /W "0" /E'
(The same command that executes fine from Run.)
When checking this in the Query Analyzer, it fails with the following error
message:
Error: -2147220352 (80040480); Provider Error: 0 (0)
Error string: Logon failed: MapiLogonEx Failed due to MAPI error 273:
MAPI Logon failed.
Error source: Microsoft Data Transformation Services (DTS) Package
Help file: sqldts80.hlp
Help context: 1100
Now, I've come to realize that the Outlook/SQL Server MAPI configuration is
supposed to be a mystery to most users, but what's the difference that
yields two success cases and one sad failing here? Is DTSRun something
entirely different than manually executing a package? I'm guessing the
problem occurs within the xp_cmdshell - any way to bypass this in this
circumstance?

Hope someone can help a novice - TIA.
knut, oslo, norway

--
Message posted via http://www.sqlmonster.com

Reply With Quote
  #2  
Old   
Darren Green
 
Posts: n/a

Default Re: Package run from query - 02-02-2005 , 06:55 AM






The execution context and location changes. Using xp_cmdshell means it runs
on the server under the SQL server service account. Des this have a MAPI
profile of the correct name?

My advice is don't even both trying to fix it, as MAPI is just not designed
for reliable execution server-side. I just use an Execute SQL Task, as all
my servers already have xp_smtp_sendmail setup with options pre-defined in a
wrapper proc.

http://www.sqldev.net/xp/xpsmtp.htm

There is now another option, recently relapsed as well, a SMTP based DTS
Send Mail task-

http://www.sqldev.net/dts/SMTPTask.htm


--
Darren Green
http://www.sqldts.com
http://www.sqlis.com

"Knut Bohn via SQLMonster.com" <forum (AT) SQLMonster (DOT) com> wrote

Quote:
I have a DTS package containg a Send Mail task, which runs fine when
manually executed. Thanks to some great tip at this site I've managed to
create a shell command, which also fires the package.
What I really want to do is to run this package from a query, which
contains:
EXEC [master].[dbo].[xp_cmdshell] 'DTSRun /S "(local)" /N
"Reissue_eksport"
/G "{AD959795-E8C6-4B88-B0D9-5F29EBC38AE5}" /W "0" /E'
(The same command that executes fine from Run.)
When checking this in the Query Analyzer, it fails with the following
error
message:
Error: -2147220352 (80040480); Provider Error: 0 (0)
Error string: Logon failed: MapiLogonEx Failed due to MAPI error 273:
MAPI Logon failed.
Error source: Microsoft Data Transformation Services (DTS) Package
Help file: sqldts80.hlp
Help context: 1100
Now, I've come to realize that the Outlook/SQL Server MAPI configuration
is
supposed to be a mystery to most users, but what's the difference that
yields two success cases and one sad failing here? Is DTSRun something
entirely different than manually executing a package? I'm guessing the
problem occurs within the xp_cmdshell - any way to bypass this in this
circumstance?

Hope someone can help a novice - TIA.
knut, oslo, norway

--
Message posted via http://www.sqlmonster.com



Reply With Quote
  #3  
Old   
Knut Bohn via SQLMonster.com
 
Posts: n/a

Default Re: Package run from query - 02-09-2005 , 12:49 AM



Thank you for answering. I gave up on the MAPI xp_cmdshell business, and
simply saved a bat of the DTSpackage as the SendMail task when fired from
the package itself worked fine all along.

k

--
Message posted via http://www.sqlmonster.com

Reply With Quote
  #4  
Old   
Scalp
 
Posts: n/a

Default re:Package run from query - 03-02-2005 , 01:06 AM



I struggled with this problem realy long time, but finaly i have foun
workaround and it even works with MAPI

Insted of calling the DTS package from xp_cmdshell, create and SQL Jo
(it does not has to be enabled) who calls the package in one step a
Operating System Command (CmdExec) with Command like: DTSRu
/~Z0x1C04218A874655D55ABDBE2C4A6316BFB718E61387458A E8734779E24A5B52E222FD72E8EA466FCE5E2798629DA20736 AFA22481DF438FC13190965C35CB87F733EA611DED019BABD1 28269A0EF4809B4E97A6A43658435D902B6A78073DA1A71F6B 7

You have to find the encrypted command used to execute the DT
package, it can be done by executing DTS in Query Analyser a
xp_cmdshell DTSRun command with parameter /!Y. This command actual
runs DTS without executing it, just returns the encrypted command


Reply With Quote
  #5  
Old   
Darren Green
 
Posts: n/a

Default Re: Package run from query - 03-08-2005 , 01:59 PM



In message <9rWdnekJXKeP-7jfRVn_vQ (AT) giganews (DOT) com>, Scalp
<mfx (AT) scanvaegt-dot-dk (DOT) no-spam.invalid> writes
Quote:
I struggled with this problem realy long time, but finaly i have found
workaround and it even works with MAPI.

Insted of calling the DTS package from xp_cmdshell, create and SQL Job
(it does not has to be enabled) who calls the package in one step as
Operating System Command (CmdExec) with Command like: DTSRun
/~Z0x1C04218A874655D55ABDBE2C4A6316BFB718E61387458A E8734779E24A5B52E222F
D72E8EA466FCE5E2798629DA20736AFA22481DF438FC131909 65C35CB87F733EA611DED0
19BABD128269A0EF4809B4E97A6A43658435D902B6A78073DA 1A71F6B77

You have to find the encrypted command used to execute the DTS
package, it can be done by executing DTS in Query Analyser as
xp_cmdshell DTSRun command with parameter /!Y. This command actualy
runs DTS without executing it, just returns the encrypted command.
Getting Syntax Help for DTSRun
(http://www.sqldts.com/default.aspx?301)

--
Darren Green (SQL Server MVP)
DTS - http://www.sqldts.com

PASS - the definitive, global community for SQL Server professionals
http://www.sqlpass.org



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.