• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 194
  • Last Modified:

Job step does not specify database yet job completes successfully -- which db runs against?

I have inherited a database and jobs that go with it.  One of the jobs has a step that executes a proc but does not specify which database to find the proc in.  There are actually 2 different databases on this server that have procedures with the name listed in the job step.  The job runds successfully.  Does it execute this proc in every db that has a proc by that name?  If not then which db does it execute against?

See attached screenshot of the job step.

Thx,

Eric Doc1.doc
0
Eric3141
Asked:
Eric3141
  • 2
  • 2
1 Solution
 
Scott PletcherSenior DBACommented:
Look in the history for the job.  You should  be able to determine from that which db it ran against, then change the job to reflect the desired db (that one or other one).

I've had this issue too, don't know yet what internal glitch in SQL Server causes it.
0
 
Eric3141Author Commented:
View History for the job tells me the server name and job name and step name but I don't see the name of the db.
0
 
Scott PletcherSenior DBACommented:
Ouch, you're right, sorry, thought the step history had the db name.

See if the database_name column in msdb.dbo.sysjobstep is actually NULL or empty for that job:

SELECT database_name, *
FROM msdb.dbo.sysjobsteps
WHERE job_id = (SELECT job_id FROM msdb.dbo.sysjobs WHERE name = '<job_name_goes_here>')
0
 
Eric3141Author Commented:
Worked great.  There are 2 databases on this server each with a proc by that name.  I thought maybe both of them got executed.  However, the results of the query you gave me show that only one of the procs is being executed.  The query gave me the db name.

I'll change the job now to explicity designate the db by name.

Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now