Wednesday, March 28, 2012
Question regarding the execution of jobs
figure out a way to let me know who executes a job and when. Would anyone
have any ideas they would be willing to share?
Thanks,
Jeff
If I understand correctly, this would basically be an email sent to whoever
saying this job has started. How about an approach where everytime this job
is executed, a row gets written to a log table?
"DeeJay Puar" <deejaypuar@.yahoo.com> wrote in message
news:392901c48f88$950e40c0$a501280a@.phx.gbl...[vbcol=seagreen]
> Hi,
> Assuming that all jobs are configured with SQL Agent, you
> could implement automatic notifications using a MAPI
> client. You will have to configure a MAPI client and then
> configure the Agent to use that profile and then configure
> each job for notification.
> hth
> DeeJay
> am trying to
> when. Would anyone
|||Job execution does get sent the job history tables. You could query those.
Another method that may be more conducive to what you are after is to create
a DTS package that uses VBScript, that pushes information to an outside
logfile. Then add that DTS package as steps to your job and send it
whatever data you want to push out.
HTH
Rick Sawtell
MCT, MCSD, MCDBA
"Jeff" <jeff.southworth@.verizon.net> wrote in message
news:u8s0iu4jEHA.3896@.TK2MSFTNGP15.phx.gbl...
> If I understand correctly, this would basically be an email sent to
whoever
> saying this job has started. How about an approach where everytime this
job
> is executed, a row gets written to a log table?
> "DeeJay Puar" <deejaypuar@.yahoo.com> wrote in message
> news:392901c48f88$950e40c0$a501280a@.phx.gbl...
>
|||You understood properly.
Here is the approach similar to yours:
You can do this ways (one is done by default):
1. Go into the SQLServerAgent Properties and towards the
bottom under 'Error log', check 'Include execution trace
messages'. This will write all trace messages in the
SQLServerAgent log. This is not recommended since the log
can get quite large and should be only done for
troubleshooting purposes.
2. This is done by default: All job execution history is
retained in the 'sysjobhistory' table in the msdb
database. You can get the job_id and query this table.
However, the options to log here must be specified
according to your needs. For example, how long the history
is kept by the job itself and if your SQLServerAgent is
configured to retain the job history and how long. The
agent job history retention is configured in the
SQLServerAgent properties under 'Job System' tab.
This should do the job.
I would go with option 2 and perhaps create a reporting
table to export data (query whatever you need) out the
sysjobhistory table and then run your reports.
hth
DeeJay
>--Original Message--
>If I understand correctly, this would basically be an
email sent to whoever
>saying this job has started. How about an approach where
everytime this job[vbcol=seagreen]
>is executed, a row gets written to a log table?
>"DeeJay Puar" <deejaypuar@.yahoo.com> wrote in message
>news:392901c48f88$950e40c0$a501280a@.phx.gbl...
you[vbcol=seagreen]
then[vbcol=seagreen]
configure[vbcol=seagreen]
and I
>
>.
>
sql
Question regarding the execution of jobs
figure out a way to let me know who executes a job and when. Would anyone
have any ideas they would be willing to share?
Thanks,
JeffHi,
Assuming that all jobs are configured with SQL Agent, you
could implement automatic notifications using a MAPI
client. You will have to configure a MAPI client and then
configure the Agent to use that profile and then configure
each job for notification.
hth
DeeJay
>--Original Message--
>We have a ton of jobs that we run from time to time and I
am trying to
>figure out a way to let me know who executes a job and
when. Would anyone
>have any ideas they would be willing to share?
>Thanks,
>Jeff
>
>.
>|||If I understand correctly, this would basically be an email sent to whoever
saying this job has started. How about an approach where everytime this job
is executed, a row gets written to a log table?
"DeeJay Puar" <deejaypuar@.yahoo.com> wrote in message
news:392901c48f88$950e40c0$a501280a@.phx.gbl...
> Hi,
> Assuming that all jobs are configured with SQL Agent, you
> could implement automatic notifications using a MAPI
> client. You will have to configure a MAPI client and then
> configure the Agent to use that profile and then configure
> each job for notification.
> hth
> DeeJay
> >--Original Message--
> >We have a ton of jobs that we run from time to time and I
> am trying to
> >figure out a way to let me know who executes a job and
> when. Would anyone
> >have any ideas they would be willing to share?
> >
> >Thanks,
> >Jeff
> >
> >
> >.
> >|||Job execution does get sent the job history tables. You could query those.
Another method that may be more conducive to what you are after is to create
a DTS package that uses VBScript, that pushes information to an outside
logfile. Then add that DTS package as steps to your job and send it
whatever data you want to push out.
HTH
Rick Sawtell
MCT, MCSD, MCDBA
"Jeff" <jeff.southworth@.verizon.net> wrote in message
news:u8s0iu4jEHA.3896@.TK2MSFTNGP15.phx.gbl...
> If I understand correctly, this would basically be an email sent to
whoever
> saying this job has started. How about an approach where everytime this
job
> is executed, a row gets written to a log table?
> "DeeJay Puar" <deejaypuar@.yahoo.com> wrote in message
> news:392901c48f88$950e40c0$a501280a@.phx.gbl...
> > Hi,
> >
> > Assuming that all jobs are configured with SQL Agent, you
> > could implement automatic notifications using a MAPI
> > client. You will have to configure a MAPI client and then
> > configure the Agent to use that profile and then configure
> > each job for notification.
> >
> > hth
> >
> > DeeJay
> > >--Original Message--
> > >We have a ton of jobs that we run from time to time and I
> > am trying to
> > >figure out a way to let me know who executes a job and
> > when. Would anyone
> > >have any ideas they would be willing to share?
> > >
> > >Thanks,
> > >Jeff
> > >
> > >
> > >.
> > >
>|||You understood properly.
Here is the approach similar to yours:
You can do this ways (one is done by default):
1. Go into the SQLServerAgent Properties and towards the
bottom under 'Error log', check 'Include execution trace
messages'. This will write all trace messages in the
SQLServerAgent log. This is not recommended since the log
can get quite large and should be only done for
troubleshooting purposes.
2. This is done by default: All job execution history is
retained in the 'sysjobhistory' table in the msdb
database. You can get the job_id and query this table.
However, the options to log here must be specified
according to your needs. For example, how long the history
is kept by the job itself and if your SQLServerAgent is
configured to retain the job history and how long. The
agent job history retention is configured in the
SQLServerAgent properties under 'Job System' tab.
This should do the job.
I would go with option 2 and perhaps create a reporting
table to export data (query whatever you need) out the
sysjobhistory table and then run your reports.
hth
DeeJay
>--Original Message--
>If I understand correctly, this would basically be an
email sent to whoever
>saying this job has started. How about an approach where
everytime this job
>is executed, a row gets written to a log table?
>"DeeJay Puar" <deejaypuar@.yahoo.com> wrote in message
>news:392901c48f88$950e40c0$a501280a@.phx.gbl...
>> Hi,
>> Assuming that all jobs are configured with SQL Agent,
you
>> could implement automatic notifications using a MAPI
>> client. You will have to configure a MAPI client and
then
>> configure the Agent to use that profile and then
configure
>> each job for notification.
>> hth
>> DeeJay
>> >--Original Message--
>> >We have a ton of jobs that we run from time to time
and I
>> am trying to
>> >figure out a way to let me know who executes a job and
>> when. Would anyone
>> >have any ideas they would be willing to share?
>> >
>> >Thanks,
>> >Jeff
>> >
>> >
>> >.
>> >
>
>.
>
Friday, March 9, 2012
question on locks
1.What kind of lockes are created on what resources when following
querys executes ?
select * from JOBQUEUE where ID='XXX'
update JOBQUEUE set columnA='YYY' where ID='XXX'
2.Under what kind of situation, share lock on a row or on a page or on a
table will convert to exclusive lock?
Thanks a lot.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!stan cai (caichuang@.digitalchina.com) writes:
> somebody helps ?
> 1.What kind of lockes are created on what resources when following
> querys executes ?
> select * from JOBQUEUE where ID='XXX'
> update JOBQUEUE set columnA='YYY' where ID='XXX'
Depends. If there is an index on ID, you should get a shared row lock
and a exclusive row lock. If there is no index on ID, both statement
will need a shared table lock. The UPDATE still needs an exclusive row
lock.
> 2.Under what kind of situation, share lock on a row or on a page or on a
> table will convert to exclusive lock?
When you update the row.
If you want to learn more about locking, it could be an idea to check
out Kalen Delaney's E-book, "Hands-On SQL Server 2000 : Troubleshooting
Locking and Blocking". See www.netimpress.com or directly:
http://www.shareit.com/product.html...¤cies=USD
--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp