Showing posts with label exe. Show all posts
Showing posts with label exe. Show all posts

Saturday, February 25, 2012

Agent Service Fails to Start

For some time now, I've been unable to start SQL Server
Agent service. I can run agent in cmd window via:
sqlagent.exe -c -v. The error on failed startup is
something like, sqlagent failed to start in a timely
manner.Have you tried starting the agent from Service Manager? If so, what error
message do you get? What user account does the Agent run with? Does the
account belong to a Win2K domain or the local machine?
The answers to these questions will help to diagnose the problem.
"Clark" <anonymous@.discussions.microsoft.com> wrote in message
news:4a2e01c3ab7d$eebde570$a601280a@.phx.gbl...
> For some time now, I've been unable to start SQL Server
> Agent service. I can run agent in cmd window via:
> sqlagent.exe -c -v. The error on failed startup is
> something like, sqlagent failed to start in a timely
> manner.|||Oh yes, I've tried that.
1. With Service Manager, it fails to start with something
like, sqlagent failed to start in a timely manner.
2. Agent uses the sama account as SQL Server service.
I plan to dink with this on Monday morning.
Question: Can the time to load a service be extended,
for example, to load a service on a very busy server?
>--Original Message--
>Have you tried starting the agent from Service Manager?
If so, what error
>message do you get? What user account does the Agent run
with? Does the
>account belong to a Win2K domain or the local machine?
>The answers to these questions will help to diagnose the
problem.
>
>"Clark" <anonymous@.discussions.microsoft.com> wrote in
message
>news:4a2e01c3ab7d$eebde570$a601280a@.phx.gbl...
>> For some time now, I've been unable to start SQL Server
>> Agent service. I can run agent in cmd window via:
>> sqlagent.exe -c -v. The error on failed startup is
>> something like, sqlagent failed to start in a timely
>> manner.
>
>.
>|||I am having a similar problem too. I am trying to start the service from
Enterprise Manager and get the following error:
A error 5 - (Access is denied) occured while performing the service opeation
on the SQL ServerAgent service
I tried changeing the account info to the SA login and password but to no
avail. Is it possibel that the service is needs the machine domain Admin
account info?
John.
"Clark" <anonymous@.discussions.microsoft.com> wrote in message
news:505301c3ac4e$be0c0070$a601280a@.phx.gbl...
> Oh yes, I've tried that.
> 1. With Service Manager, it fails to start with something
> like, sqlagent failed to start in a timely manner.
> 2. Agent uses the sama account as SQL Server service.
> I plan to dink with this on Monday morning.
> Question: Can the time to load a service be extended,
> for example, to load a service on a very busy server?
>
> >--Original Message--
> >Have you tried starting the agent from Service Manager?
> If so, what error
> >message do you get? What user account does the Agent run
> with? Does the
> >account belong to a Win2K domain or the local machine?
> >
> >The answers to these questions will help to diagnose the
> problem.
> >
> >
> >"Clark" <anonymous@.discussions.microsoft.com> wrote in
> message
> >news:4a2e01c3ab7d$eebde570$a601280a@.phx.gbl...
> >> For some time now, I've been unable to start SQL Server
> >> Agent service. I can run agent in cmd window via:
> >> sqlagent.exe -c -v. The error on failed startup is
> >> something like, sqlagent failed to start in a timely
> >> manner.
> >
> >
> >.
> >|||Hi John,
Sa login is for SQL server authentication, which is different from the account used for SQL server agent service. To run sql server agent, one must typically have a domain user account (as it is used for sql mail, replication, backup etc). Also this domain name should have administrative privs on the machine where sql server instance is running.
Sometimes I guess rebuilding registry can solve the problem. Use "regrebld" in the cmd line prompt. I haven't used this utility myself, so inquire with others before using it
Thank
GYK|||Thanks for you help.
"GYK" <anonymous@.discussions.microsoft.com> wrote in message
news:CFD08193-68CB-48CA-A931-04BBA0EC21A2@.microsoft.com...
> Hi John,
> Sa login is for SQL server authentication, which is different from the
account used for SQL server agent service. To run sql server agent, one must
typically have a domain user account (as it is used for sql mail,
replication, backup etc). Also this domain name should have administrative
privs on the machine where sql server instance is running.
> Sometimes I guess rebuilding registry can solve the problem. Use
"regrebld" in the cmd line prompt. I haven't used this utility myself, so
inquire with others before using it.
> Thanks
> GYK

Agent Jobs

hello,
i am trying to create a job to execute an exe. i would like to kick off the
job through a trigger. however i am running into some prblems.
i created a job - myjob.
i created a step - step1
the step1 has operating system command: c:\myexe.exe
then i create a trigger on my table
CREATE TRIGGER MyTrigger1
ON testtable FOR INSERT
AS
EXEC sp_start_job @.job_name = 'myjob'
however when i add a row to the table i get this error:
[microsoft][odbc sql server driver][sql server] could not find stored
procedure 'sp_start_job'
this seems like a very basic problem.
why does it think i have a job sp_start_job. i thought sp_start_job just
kicks off the job?
thanks for any help
Try,
exec msdb.dbo.sp_start_job @.job_name = 'myjob'
AMB
"brian" wrote:

> hello,
> i am trying to create a job to execute an exe. i would like to kick off the
> job through a trigger. however i am running into some prblems.
> i created a job - myjob.
> i created a step - step1
> the step1 has operating system command: c:\myexe.exe
> then i create a trigger on my table
> CREATE TRIGGER MyTrigger1
> ON testtable FOR INSERT
> AS
> EXEC sp_start_job @.job_name = 'myjob'
> however when i add a row to the table i get this error:
> [microsoft][odbc sql server driver][sql server] could not find stored
> procedure 'sp_start_job'
> this seems like a very basic problem.
> why does it think i have a job sp_start_job. i thought sp_start_job just
> kicks off the job?
> thanks for any help
>
>
>
|||thanks. that got me a little further. but i see this now.
when i add my row i get the message:
[microsoft][odbc sql server driver][sql server]SQLServerAgent is not
currently running so it cannot be notified of this action.
which is simular to if i go to the job ad click start. i get this message:
[microsoft][odbc sql server driver][sql server]SQLServerAgent is not running
so it cannot be notified of this action.
is there something i have to set on the job to make it runnable? either
from sp_start_job or from "start job"?
thanks for the help
"Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in message
news:D628A23E-F59E-4B27-B015-38E431C080B2@.microsoft.com...[vbcol=seagreen]
> Try,
> exec msdb.dbo.sp_start_job @.job_name = 'myjob'
>
> AMB
> "brian" wrote:
|||i think i have it.
you need to start the SQL Agent service.
"brian" <brian@.nospam.com> wrote in message
news:%23wHFt3pzFHA.464@.TK2MSFTNGP15.phx.gbl...
> thanks. that got me a little further. but i see this now.
> when i add my row i get the message:
> [microsoft][odbc sql server driver][sql server]SQLServerAgent is not
> currently running so it cannot be notified of this action.
> which is simular to if i go to the job ad click start. i get this
> message:
> [microsoft][odbc sql server driver][sql server]SQLServerAgent is not
> running so it cannot be notified of this action.
> is there something i have to set on the job to make it runnable? either
> from sp_start_job or from "start job"?
> thanks for the help
>
> "Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in
> message news:D628A23E-F59E-4B27-B015-38E431C080B2@.microsoft.com...
>
|||You got it.
AMB
"brian" wrote:

> i think i have it.
> you need to start the SQL Agent service.
>
> "brian" <brian@.nospam.com> wrote in message
> news:%23wHFt3pzFHA.464@.TK2MSFTNGP15.phx.gbl...
>
>
|||Starting a job from a trigger? Sounds painful from a couple of stances.
What are you trying to accomplish?
Performance on your inserts is going to be horrible.
Only one copy of the job can be running at any time. If multiple insert
batches occur at nearly the same time one will fail.
The trigger will fire once for each insert batch not each row. This may or
may not be your intention.
"brian" <brian@.nospam.com> wrote in message
news:e45VUnpzFHA.2076@.TK2MSFTNGP14.phx.gbl...
> hello,
> i am trying to create a job to execute an exe. i would like to kick off
> the job through a trigger. however i am running into some prblems.
> i created a job - myjob.
> i created a step - step1
> the step1 has operating system command: c:\myexe.exe
> then i create a trigger on my table
> CREATE TRIGGER MyTrigger1
> ON testtable FOR INSERT
> AS
> EXEC sp_start_job @.job_name = 'myjob'
> however when i add a row to the table i get this error:
> [microsoft][odbc sql server driver][sql server] could not find stored
> procedure 'sp_start_job'
> this seems like a very basic problem.
> why does it think i have a job sp_start_job. i thought sp_start_job just
> kicks off the job?
> thanks for any help
>
>
|||And in addition, you need to execute sp_start_job in msdb:
EXEC msdb.dbo.sp_start_job ...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in message
news:3BAABBB2-27C5-4BB4-BEC3-CCE48CF6D6C7@.microsoft.com...[vbcol=seagreen]
> You got it.
>
> AMB
> "brian" wrote:

Agent Jobs

hello,
i am trying to create a job to execute an exe. i would like to kick off the
job through a trigger. however i am running into some prblems.
i created a job - myjob.
i created a step - step1
the step1 has operating system command: c:\myexe.exe
then i create a trigger on my table
CREATE TRIGGER MyTrigger1
ON testtable FOR INSERT
AS
EXEC sp_start_job @.job_name = 'myjob'
however when i add a row to the table i get this error:
[microsoft][odbc sql server driver][sql server] could not find s
tored
procedure 'sp_start_job'
this seems like a very basic problem.
why does it think i have a job sp_start_job. i thought sp_start_job just
kicks off the job?
thanks for any helpTry,
exec msdb.dbo.sp_start_job @.job_name = 'myjob'
AMB
"brian" wrote:

> hello,
> i am trying to create a job to execute an exe. i would like to kick off t
he
> job through a trigger. however i am running into some prblems.
> i created a job - myjob.
> i created a step - step1
> the step1 has operating system command: c:\myexe.exe
> then i create a trigger on my table
> CREATE TRIGGER MyTrigger1
> ON testtable FOR INSERT
> AS
> EXEC sp_start_job @.job_name = 'myjob'
> however when i add a row to the table i get this error:
> [microsoft][odbc sql server driver][sql server] could not find
stored
> procedure 'sp_start_job'
> this seems like a very basic problem.
> why does it think i have a job sp_start_job. i thought sp_start_job just
> kicks off the job?
> thanks for any help
>
>
>|||thanks. that got me a little further. but i see this now.
when i add my row i get the message:
[microsoft][odbc sql server driver][sql server]SQLServerAgent is
not
currently running so it cannot be notified of this action.
which is simular to if i go to the job ad click start. i get this message:
[microsoft][odbc sql server driver][sql server]SQLServerAgent is
not running
so it cannot be notified of this action.
is there something i have to set on the job to make it runnable? either
from sp_start_job or from "start job"?
thanks for the help
"Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in message
news:D628A23E-F59E-4B27-B015-38E431C080B2@.microsoft.com...[vbcol=seagreen]
> Try,
> exec msdb.dbo.sp_start_job @.job_name = 'myjob'
>
> AMB
> "brian" wrote:
>|||i think i have it.
you need to start the SQL Agent service.
"brian" <brian@.nospam.com> wrote in message
news:%23wHFt3pzFHA.464@.TK2MSFTNGP15.phx.gbl...
> thanks. that got me a little further. but i see this now.
> when i add my row i get the message:
> [microsoft][odbc sql server driver][sql server]SQLServerAgent
is not
> currently running so it cannot be notified of this action.
> which is simular to if i go to the job ad click start. i get this
> message:
> [microsoft][odbc sql server driver][sql server]SQLServerAgent
is not
> running so it cannot be notified of this action.
> is there something i have to set on the job to make it runnable? either
> from sp_start_job or from "start job"?
> thanks for the help
>
> "Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in
> message news:D628A23E-F59E-4B27-B015-38E431C080B2@.microsoft.com...
>|||You got it.
AMB
"brian" wrote:

> i think i have it.
> you need to start the SQL Agent service.
>
> "brian" <brian@.nospam.com> wrote in message
> news:%23wHFt3pzFHA.464@.TK2MSFTNGP15.phx.gbl...
>
>|||Starting a job from a trigger? Sounds painful from a couple of stances.
What are you trying to accomplish?
Performance on your inserts is going to be horrible.
Only one copy of the job can be running at any time. If multiple insert
batches occur at nearly the same time one will fail.
The trigger will fire once for each insert batch not each row. This may or
may not be your intention.
"brian" <brian@.nospam.com> wrote in message
news:e45VUnpzFHA.2076@.TK2MSFTNGP14.phx.gbl...
> hello,
> i am trying to create a job to execute an exe. i would like to kick off
> the job through a trigger. however i am running into some prblems.
> i created a job - myjob.
> i created a step - step1
> the step1 has operating system command: c:\myexe.exe
> then i create a trigger on my table
> CREATE TRIGGER MyTrigger1
> ON testtable FOR INSERT
> AS
> EXEC sp_start_job @.job_name = 'myjob'
> however when i add a row to the table i get this error:
> [microsoft][odbc sql server driver][sql server] could not find
stored
> procedure 'sp_start_job'
> this seems like a very basic problem.
> why does it think i have a job sp_start_job. i thought sp_start_job just
> kicks off the job?
> thanks for any help
>
>|||And in addition, you need to execute sp_start_job in msdb:
EXEC msdb.dbo.sp_start_job ...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in message
news:3BAABBB2-27C5-4BB4-BEC3-CCE48CF6D6C7@.microsoft.com...[vbcol=seagreen]
> You got it.
>
> AMB
> "brian" wrote:
>

Agent Jobs

hello,
i am trying to create a job to execute an exe. i would like to kick off the
job through a trigger. however i am running into some prblems.
i created a job - myjob.
i created a step - step1
the step1 has operating system command: c:\myexe.exe
then i create a trigger on my table
CREATE TRIGGER MyTrigger1
ON testtable FOR INSERT
AS
EXEC sp_start_job @.job_name = 'myjob'
however when i add a row to the table i get this error:
[microsoft][odbc sql server driver][sql server] could not find stored
procedure 'sp_start_job'
this seems like a very basic problem.
why does it think i have a job sp_start_job. i thought sp_start_job just
kicks off the job?
thanks for any helpTry,
exec msdb.dbo.sp_start_job @.job_name = 'myjob'
AMB
"brian" wrote:
> hello,
> i am trying to create a job to execute an exe. i would like to kick off the
> job through a trigger. however i am running into some prblems.
> i created a job - myjob.
> i created a step - step1
> the step1 has operating system command: c:\myexe.exe
> then i create a trigger on my table
> CREATE TRIGGER MyTrigger1
> ON testtable FOR INSERT
> AS
> EXEC sp_start_job @.job_name = 'myjob'
> however when i add a row to the table i get this error:
> [microsoft][odbc sql server driver][sql server] could not find stored
> procedure 'sp_start_job'
> this seems like a very basic problem.
> why does it think i have a job sp_start_job. i thought sp_start_job just
> kicks off the job?
> thanks for any help
>
>
>|||thanks. that got me a little further. but i see this now.
when i add my row i get the message:
[microsoft][odbc sql server driver][sql server]SQLServerAgent is not
currently running so it cannot be notified of this action.
which is simular to if i go to the job ad click start. i get this message:
[microsoft][odbc sql server driver][sql server]SQLServerAgent is not running
so it cannot be notified of this action.
is there something i have to set on the job to make it runnable? either
from sp_start_job or from "start job"?
thanks for the help
"Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in message
news:D628A23E-F59E-4B27-B015-38E431C080B2@.microsoft.com...
> Try,
> exec msdb.dbo.sp_start_job @.job_name = 'myjob'
>
> AMB
> "brian" wrote:
>> hello,
>> i am trying to create a job to execute an exe. i would like to kick off
>> the
>> job through a trigger. however i am running into some prblems.
>> i created a job - myjob.
>> i created a step - step1
>> the step1 has operating system command: c:\myexe.exe
>> then i create a trigger on my table
>> CREATE TRIGGER MyTrigger1
>> ON testtable FOR INSERT
>> AS
>> EXEC sp_start_job @.job_name = 'myjob'
>> however when i add a row to the table i get this error:
>> [microsoft][odbc sql server driver][sql server] could not find stored
>> procedure 'sp_start_job'
>> this seems like a very basic problem.
>> why does it think i have a job sp_start_job. i thought sp_start_job just
>> kicks off the job?
>> thanks for any help
>>
>>|||i think i have it.
you need to start the SQL Agent service.
"brian" <brian@.nospam.com> wrote in message
news:%23wHFt3pzFHA.464@.TK2MSFTNGP15.phx.gbl...
> thanks. that got me a little further. but i see this now.
> when i add my row i get the message:
> [microsoft][odbc sql server driver][sql server]SQLServerAgent is not
> currently running so it cannot be notified of this action.
> which is simular to if i go to the job ad click start. i get this
> message:
> [microsoft][odbc sql server driver][sql server]SQLServerAgent is not
> running so it cannot be notified of this action.
> is there something i have to set on the job to make it runnable? either
> from sp_start_job or from "start job"?
> thanks for the help
>
> "Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in
> message news:D628A23E-F59E-4B27-B015-38E431C080B2@.microsoft.com...
>> Try,
>> exec msdb.dbo.sp_start_job @.job_name = 'myjob'
>>
>> AMB
>> "brian" wrote:
>> hello,
>> i am trying to create a job to execute an exe. i would like to kick off
>> the
>> job through a trigger. however i am running into some prblems.
>> i created a job - myjob.
>> i created a step - step1
>> the step1 has operating system command: c:\myexe.exe
>> then i create a trigger on my table
>> CREATE TRIGGER MyTrigger1
>> ON testtable FOR INSERT
>> AS
>> EXEC sp_start_job @.job_name = 'myjob'
>> however when i add a row to the table i get this error:
>> [microsoft][odbc sql server driver][sql server] could not find stored
>> procedure 'sp_start_job'
>> this seems like a very basic problem.
>> why does it think i have a job sp_start_job. i thought sp_start_job
>> just
>> kicks off the job?
>> thanks for any help
>>
>>
>|||You got it.
AMB
"brian" wrote:
> i think i have it.
> you need to start the SQL Agent service.
>
> "brian" <brian@.nospam.com> wrote in message
> news:%23wHFt3pzFHA.464@.TK2MSFTNGP15.phx.gbl...
> > thanks. that got me a little further. but i see this now.
> > when i add my row i get the message:
> > [microsoft][odbc sql server driver][sql server]SQLServerAgent is not
> > currently running so it cannot be notified of this action.
> >
> > which is simular to if i go to the job ad click start. i get this
> > message:
> > [microsoft][odbc sql server driver][sql server]SQLServerAgent is not
> > running so it cannot be notified of this action.
> >
> > is there something i have to set on the job to make it runnable? either
> > from sp_start_job or from "start job"?
> >
> > thanks for the help
> >
> >
> >
> > "Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in
> > message news:D628A23E-F59E-4B27-B015-38E431C080B2@.microsoft.com...
> >> Try,
> >>
> >> exec msdb.dbo.sp_start_job @.job_name = 'myjob'
> >>
> >>
> >> AMB
> >>
> >> "brian" wrote:
> >>
> >> hello,
> >> i am trying to create a job to execute an exe. i would like to kick off
> >> the
> >> job through a trigger. however i am running into some prblems.
> >>
> >> i created a job - myjob.
> >> i created a step - step1
> >> the step1 has operating system command: c:\myexe.exe
> >>
> >> then i create a trigger on my table
> >> CREATE TRIGGER MyTrigger1
> >> ON testtable FOR INSERT
> >> AS
> >> EXEC sp_start_job @.job_name = 'myjob'
> >>
> >> however when i add a row to the table i get this error:
> >> [microsoft][odbc sql server driver][sql server] could not find stored
> >> procedure 'sp_start_job'
> >>
> >> this seems like a very basic problem.
> >> why does it think i have a job sp_start_job. i thought sp_start_job
> >> just
> >> kicks off the job?
> >>
> >> thanks for any help
> >>
> >>
> >>
> >>
> >>
> >
> >
>
>|||Starting a job from a trigger? Sounds painful from a couple of stances.
What are you trying to accomplish?
Performance on your inserts is going to be horrible.
Only one copy of the job can be running at any time. If multiple insert
batches occur at nearly the same time one will fail.
The trigger will fire once for each insert batch not each row. This may or
may not be your intention.
"brian" <brian@.nospam.com> wrote in message
news:e45VUnpzFHA.2076@.TK2MSFTNGP14.phx.gbl...
> hello,
> i am trying to create a job to execute an exe. i would like to kick off
> the job through a trigger. however i am running into some prblems.
> i created a job - myjob.
> i created a step - step1
> the step1 has operating system command: c:\myexe.exe
> then i create a trigger on my table
> CREATE TRIGGER MyTrigger1
> ON testtable FOR INSERT
> AS
> EXEC sp_start_job @.job_name = 'myjob'
> however when i add a row to the table i get this error:
> [microsoft][odbc sql server driver][sql server] could not find stored
> procedure 'sp_start_job'
> this seems like a very basic problem.
> why does it think i have a job sp_start_job. i thought sp_start_job just
> kicks off the job?
> thanks for any help
>
>|||And in addition, you need to execute sp_start_job in msdb:
EXEC msdb.dbo.sp_start_job ...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in message
news:3BAABBB2-27C5-4BB4-BEC3-CCE48CF6D6C7@.microsoft.com...
> You got it.
>
> AMB
> "brian" wrote:
>> i think i have it.
>> you need to start the SQL Agent service.
>>
>> "brian" <brian@.nospam.com> wrote in message
>> news:%23wHFt3pzFHA.464@.TK2MSFTNGP15.phx.gbl...
>> > thanks. that got me a little further. but i see this now.
>> > when i add my row i get the message:
>> > [microsoft][odbc sql server driver][sql server]SQLServerAgent is not
>> > currently running so it cannot be notified of this action.
>> >
>> > which is simular to if i go to the job ad click start. i get this
>> > message:
>> > [microsoft][odbc sql server driver][sql server]SQLServerAgent is not
>> > running so it cannot be notified of this action.
>> >
>> > is there something i have to set on the job to make it runnable? either
>> > from sp_start_job or from "start job"?
>> >
>> > thanks for the help
>> >
>> >
>> >
>> > "Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in
>> > message news:D628A23E-F59E-4B27-B015-38E431C080B2@.microsoft.com...
>> >> Try,
>> >>
>> >> exec msdb.dbo.sp_start_job @.job_name = 'myjob'
>> >>
>> >>
>> >> AMB
>> >>
>> >> "brian" wrote:
>> >>
>> >> hello,
>> >> i am trying to create a job to execute an exe. i would like to kick off
>> >> the
>> >> job through a trigger. however i am running into some prblems.
>> >>
>> >> i created a job - myjob.
>> >> i created a step - step1
>> >> the step1 has operating system command: c:\myexe.exe
>> >>
>> >> then i create a trigger on my table
>> >> CREATE TRIGGER MyTrigger1
>> >> ON testtable FOR INSERT
>> >> AS
>> >> EXEC sp_start_job @.job_name = 'myjob'
>> >>
>> >> however when i add a row to the table i get this error:
>> >> [microsoft][odbc sql server driver][sql server] could not find stored
>> >> procedure 'sp_start_job'
>> >>
>> >> this seems like a very basic problem.
>> >> why does it think i have a job sp_start_job. i thought sp_start_job
>> >> just
>> >> kicks off the job?
>> >>
>> >> thanks for any help
>> >>
>> >>
>> >>
>> >>
>> >>
>> >
>> >
>>

Friday, February 24, 2012

AFTER TRIGGER

I would like to create a trigger that after a DML event, let's say an
INSERT, will call an external exe file using xp_cmdshell and pass to the exe
the @.@.identity which resulted by the INSERT.
Is there a way to achieve this?Yan,
Doing this will compromise the transaction (i.e. if the external program
hang up, then the transaction will remain open for a long time). Also take i
n
mind that the statement that activated the trigger could have affected
multiple rows. May be if you tell the group what are you trying to
accomplish, somebody can come with a better approach.
AMB
"Yan" wrote:

> I would like to create a trigger that after a DML event, let's say an
> INSERT, will call an external exe file using xp_cmdshell and pass to the e
xe
> the @.@.identity which resulted by the INSERT.
> Is there a way to achieve this?
>
>|||Hi Yan
This trigger runs for me. "Kuku" is a table with an IDENTITY column. I hope
it helps.
CREATE TRIGGER TRG_KUKU_ON_INSERT ON [dbo].[Kuku]
FOR INSERT
AS
DECLARE @.idd int
DECLARE @.cmd NVARCHAR(100)
SET @.idd = @.@.identity
SET @.cmd = 'CommandToExecute ' + CAST(@.idd AS NVARCHAR)
exec master..xp_cmdshell @.cmd
Boaz Ben-Porat
Milestone Systems
Denmark
"Yan" <yanive@.rediffmail.com> wrote in message
news:OSQOgBTmGHA.2372@.TK2MSFTNGP04.phx.gbl...
>I would like to create a trigger that after a DML event, let's say an
>INSERT, will call an external exe file using xp_cmdshell and pass to the
>exe the @.@.identity which resulted by the INSERT.
> Is there a way to achieve this?
>|||Yan wrote:
> I would like to create a trigger that after a DML event, let's say an
> INSERT, will call an external exe file using xp_cmdshell and pass to the e
xe
> the @.@.identity which resulted by the INSERT.
> Is there a way to achieve this?
>
I would take a different approach, for a couple of reasons:
1. An insert doesn't always involve a single record, multiple records
can be inserted at once, thus you won't have a single ID to work with.
2. Involving an external process in a transaction is introducing a
point of failure. If the external process fails, or performs poorly,
your transaction will as will, causing the insert to fail or perform poorly.
I would instead write the trigger to insert all new ID's into a
"staging" table, and create a scheduled job that monitors that staging
table for new records. When new records are found, then run your
external process.|||Thank you Tracy for this post and I thank all other answeres as well.
I have some logic in my trigger to ensure we work just on a single record as
we expect.
I adopt your approach to have the trigger insert the Ids to another table on
which we can make what we need and not in the context of a transaction
(inside the trigger).
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:uV6ShYTmGHA.4716@.TK2MSFTNGP04.phx.gbl...
> Yan wrote:
> I would take a different approach, for a couple of reasons:
> 1. An insert doesn't always involve a single record, multiple records can
> be inserted at once, thus you won't have a single ID to work with.
> 2. Involving an external process in a transaction is introducing a point
> of failure. If the external process fails, or performs poorly, your
> transaction will as will, causing the insert to fail or perform poorly.
> I would instead write the trigger to insert all new ID's into a "staging"
> table, and create a scheduled job that monitors that staging table for new
> records. When new records are found, then run your external process.

Sunday, February 19, 2012

After server rename, xp_cmdshell problem

I have a job which runs a SP containing a xp_cmdshell call to
wzunzip.exe to unzip a file. This has worked for over a year without
a glitch. I recently renamed the server, following the proper steps I
think, and now this SP hangs at the unzip command. I can't even
cancel the job, when I try I see that the server is doing a rollback,
but it never finishes, and I have no idea what it would be rolling
back. I end up stopping the agent and restarting. I am probably
missing something easy but I can't figure it out. This same script
has always worked and continues to work on other servers, the only
change being the server rename. Any ideas on what I am missing?
Thanks,
Charles
Are you using the command-line versions of winzip (separate download)?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Charles Sands" <z666z@.yahoo.com> wrote in message news:1f9df651.0408140754.3047b6a@.posting.google.co m...
> I have a job which runs a SP containing a xp_cmdshell call to
> wzunzip.exe to unzip a file. This has worked for over a year without
> a glitch. I recently renamed the server, following the proper steps I
> think, and now this SP hangs at the unzip command. I can't even
> cancel the job, when I try I see that the server is doing a rollback,
> but it never finishes, and I have no idea what it would be rolling
> back. I end up stopping the agent and restarting. I am probably
> missing something easy but I can't figure it out. This same script
> has always worked and continues to work on other servers, the only
> change being the server rename. Any ideas on what I am missing?
> Thanks,
> Charles
|||"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message news:<O2t6qnigEHA.2928@.TK2MSFTNGP10.phx.gbl>...
> Are you using the command-line versions of winzip (separate download)?
Yes I am using the command-line version. I just uninstalled and
reinstalled winzip and the command-line add-on. It is working fine
from the command line. But when I try to run it from QA it just
hangs, no indication of anything. I can see from taskmanager that
wzunzip.exe is running, but nothing happens.
[vbcol=seagreen]
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Charles Sands" <z666z@.yahoo.com> wrote in message news:1f9df651.0408140754.3047b6a@.posting.google.co m...
|||Perhaps it is waiting form some type of input? I believe that there are silent switches and stuff for the
command-line versions. Might be worth trying out? I haven't unzipped from xp_cmdshell, but I have zipped...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Charles Sands" <z666z@.yahoo.com> wrote in message news:1f9df651.0408151256.29d1aded@.posting.google.c om...
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
news:<O2t6qnigEHA.2928@.TK2MSFTNGP10.phx.gbl>...[vbcol=seagreen]
> Yes I am using the command-line version. I just uninstalled and
> reinstalled winzip and the command-line add-on. It is working fine
> from the command line. But when I try to run it from QA it just
> hangs, no indication of anything. I can see from taskmanager that
> wzunzip.exe is running, but nothing happens.
>

After server rename, xp_cmdshell problem

I have a job which runs a SP containing a xp_cmdshell call to
wzunzip.exe to unzip a file. This has worked for over a year without
a glitch. I recently renamed the server, following the proper steps I
think, and now this SP hangs at the unzip command. I can't even
cancel the job, when I try I see that the server is doing a rollback,
but it never finishes, and I have no idea what it would be rolling
back. I end up stopping the agent and restarting. I am probably
missing something easy but I can't figure it out. This same script
has always worked and continues to work on other servers, the only
change being the server rename. Any ideas on what I am missing?
Thanks,
CharlesAre you using the command-line versions of winzip (separate download)?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Charles Sands" <z666z@.yahoo.com> wrote in message news:1f9df651.0408140754.3047b6a@.posting.
google.com...
> I have a job which runs a SP containing a xp_cmdshell call to
> wzunzip.exe to unzip a file. This has worked for over a year without
> a glitch. I recently renamed the server, following the proper steps I
> think, and now this SP hangs at the unzip command. I can't even
> cancel the job, when I try I see that the server is doing a rollback,
> but it never finishes, and I have no idea what it would be rolling
> back. I end up stopping the agent and restarting. I am probably
> missing something easy but I can't figure it out. This same script
> has always worked and continues to work on other servers, the only
> change being the server rename. Any ideas on what I am missing?
> Thanks,
> Charles|||"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message news:<O2
t6qnigEHA.2928@.TK2MSFTNGP10.phx.gbl>...
> Are you using the command-line versions of winzip (separate download)?
Yes I am using the command-line version. I just uninstalled and
reinstalled winzip and the command-line add-on. It is working fine
from the command line. But when I try to run it from QA it just
hangs, no indication of anything. I can see from taskmanager that
wzunzip.exe is running, but nothing happens.
[vbcol=seagreen]
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Charles Sands" <z666z@.yahoo.com> wrote in message news:1f9df651.040814075
4.3047b6a@.posting.google.com...|||Perhaps it is waiting form some type of input? I believe that there are sile
nt switches and stuff for the
command-line versions. Might be worth trying out? I haven't unzipped from xp
_cmdshell, but I have zipped...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Charles Sands" <z666z@.yahoo.com> wrote in message news:1f9df651.0408151256.29d1aded@.posting
.google.com...
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in messag
e
news:<O2t6qnigEHA.2928@.TK2MSFTNGP10.phx.gbl>...[vbcol=seagreen]
> Yes I am using the command-line version. I just uninstalled and
> reinstalled winzip and the command-line add-on. It is working fine
> from the command line. But when I try to run it from QA it just
> hangs, no indication of anything. I can see from taskmanager that
> wzunzip.exe is running, but nothing happens.
>

After server rename, xp_cmdshell problem

I have a job which runs a SP containing a xp_cmdshell call to
wzunzip.exe to unzip a file. This has worked for over a year without
a glitch. I recently renamed the server, following the proper steps I
think, and now this SP hangs at the unzip command. I can't even
cancel the job, when I try I see that the server is doing a rollback,
but it never finishes, and I have no idea what it would be rolling
back. I end up stopping the agent and restarting. I am probably
missing something easy but I can't figure it out. This same script
has always worked and continues to work on other servers, the only
change being the server rename. Any ideas on what I am missing?
Thanks,
CharlesAre you using the command-line versions of winzip (separate download)?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Charles Sands" <z666z@.yahoo.com> wrote in message news:1f9df651.0408140754.3047b6a@.posting.google.com...
> I have a job which runs a SP containing a xp_cmdshell call to
> wzunzip.exe to unzip a file. This has worked for over a year without
> a glitch. I recently renamed the server, following the proper steps I
> think, and now this SP hangs at the unzip command. I can't even
> cancel the job, when I try I see that the server is doing a rollback,
> but it never finishes, and I have no idea what it would be rolling
> back. I end up stopping the agent and restarting. I am probably
> missing something easy but I can't figure it out. This same script
> has always worked and continues to work on other servers, the only
> change being the server rename. Any ideas on what I am missing?
> Thanks,
> Charles|||"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message news:<O2t6qnigEHA.2928@.TK2MSFTNGP10.phx.gbl>...
> Are you using the command-line versions of winzip (separate download)?
Yes I am using the command-line version. I just uninstalled and
reinstalled winzip and the command-line add-on. It is working fine
from the command line. But when I try to run it from QA it just
hangs, no indication of anything. I can see from taskmanager that
wzunzip.exe is running, but nothing happens.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Charles Sands" <z666z@.yahoo.com> wrote in message news:1f9df651.0408140754.3047b6a@.posting.google.com...
> > I have a job which runs a SP containing a xp_cmdshell call to
> > wzunzip.exe to unzip a file. This has worked for over a year without
> > a glitch. I recently renamed the server, following the proper steps I
> > think, and now this SP hangs at the unzip command. I can't even
> > cancel the job, when I try I see that the server is doing a rollback,
> > but it never finishes, and I have no idea what it would be rolling
> > back. I end up stopping the agent and restarting. I am probably
> > missing something easy but I can't figure it out. This same script
> > has always worked and continues to work on other servers, the only
> > change being the server rename. Any ideas on what I am missing?
> >
> > Thanks,
> > Charles|||Perhaps it is waiting form some type of input? I believe that there are silent switches and stuff for the
command-line versions. Might be worth trying out? I haven't unzipped from xp_cmdshell, but I have zipped...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Charles Sands" <z666z@.yahoo.com> wrote in message news:1f9df651.0408151256.29d1aded@.posting.google.com...
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in message
news:<O2t6qnigEHA.2928@.TK2MSFTNGP10.phx.gbl>...
> > Are you using the command-line versions of winzip (separate download)?
> Yes I am using the command-line version. I just uninstalled and
> reinstalled winzip and the command-line add-on. It is working fine
> from the command line. But when I try to run it from QA it just
> hangs, no indication of anything. I can see from taskmanager that
> wzunzip.exe is running, but nothing happens.
>
> > --
> > Tibor Karaszi, SQL Server MVP
> > http://www.karaszi.com/sqlserver/default.asp
> > http://www.solidqualitylearning.com/
> >
> >
> > "Charles Sands" <z666z@.yahoo.com> wrote in message news:1f9df651.0408140754.3047b6a@.posting.google.com...
> > > I have a job which runs a SP containing a xp_cmdshell call to
> > > wzunzip.exe to unzip a file. This has worked for over a year without
> > > a glitch. I recently renamed the server, following the proper steps I
> > > think, and now this SP hangs at the unzip command. I can't even
> > > cancel the job, when I try I see that the server is doing a rollback,
> > > but it never finishes, and I have no idea what it would be rolling
> > > back. I end up stopping the agent and restarting. I am probably
> > > missing something easy but I can't figure it out. This same script
> > > has always worked and continues to work on other servers, the only
> > > change being the server rename. Any ideas on what I am missing?
> > >
> > > Thanks,
> > > Charles