Is there a way to find only unique entries for a search. Currently I am
looking for jobs that a run for a give database, but the script will
return multiple job entries for the same job if the database is
reference many times in that job, (once per reference) is there a way
to weed out the duplicates?
Thanks.
-Matt-
<code>
select sj.name
from msdb.dbo.sysjobs sj join msdb.dbo.sysjobsteps sjs
on sj.job_id = sjs.job_id
where sjs.database_name = 'database_name' order by 'name'
</code>Try,
select sj.name
from msdb.dbo.sysjobs sj
where exists (
select *
from msdb.dbo.sysjobsteps sjs
where sjs.database_name = 'database_name' and sjs.job_id = sj.job_id
)
order by 'name'
go
You can also use "DISTINCT" in the original statement.
AMB
"Matthew" wrote:
> Is there a way to find only unique entries for a search. Currently I am
> looking for jobs that a run for a give database, but the script will
> return multiple job entries for the same job if the database is
> reference many times in that job, (once per reference) is there a way
> to weed out the duplicates?
> Thanks.
> -Matt-
>
> <code>
> select sj.name
> from msdb.dbo.sysjobs sj join msdb.dbo.sysjobsteps sjs
> on sj.job_id = sjs.job_id
> where sjs.database_name = 'database_name' order by 'name'
> </code>
>|||Thanks
Works perfectly.
Showing posts with label jobs. Show all posts
Showing posts with label jobs. Show all posts
Wednesday, March 28, 2012
Friday, March 23, 2012
Remote view
I was wondering if i should create a lil program that could run in the tray
showing status of jobs running on a SQL server. By that i mean if they are
enabled, runnable and so on. Are there anyone in here that can lead me to
some info related to that? I want to devlope it using C#.
I have been roaming the net for info about this but so far no luck. Is there
an API on the SQL server that enables me to do this?
Best regards
TrondThe SQL-DMO API should give you what you want for SQL7.0 and 2000.
However, DMO is a COM API so you may prefer instead to develop your
application with SMO, which is DMO's .NET replacement in SQL Server
2005.
http://msdn.microsoft.com/library/d.../>
01_2yi7.asp
David Portas
SQL Server MVP
--
showing status of jobs running on a SQL server. By that i mean if they are
enabled, runnable and so on. Are there anyone in here that can lead me to
some info related to that? I want to devlope it using C#.
I have been roaming the net for info about this but so far no luck. Is there
an API on the SQL server that enables me to do this?
Best regards
TrondThe SQL-DMO API should give you what you want for SQL7.0 and 2000.
However, DMO is a COM API so you may prefer instead to develop your
application with SMO, which is DMO's .NET replacement in SQL Server
2005.
http://msdn.microsoft.com/library/d.../>
01_2yi7.asp
David Portas
SQL Server MVP
--
Tuesday, March 20, 2012
Remote server
Hi,
I have created 1 sqls server as a remote server in another sql server, so I can execute backup jobs on the backup server from the production server.
This was all working ok, but now everytime the backup is called I get an error message saying login falied for 'sa'.
I haven't changed anything and the remote logins look like they are set up correctly.
Any advise would be appreciatedMy guess would be that you applied sp3, and when it "hardened" the sa password on your slave server, things went amok. Open Query Analyzer on your master, and attempt to log into your slave as sa. If that breaks, you'll need to find (or change) the sa password for your slave, then fix the problem(s) (there may be more than one) in the remote login definitions.
-PatP|||Hi,
Did not apply sp3? they were both applied to both the servers before this error occured.
this is the kind thing that has stopped working
Run on server 1 as a job
exec Server2.msdb.dbo.sp_start_job @.job_name='Restore = Load Alpha AM'
I have created 1 sqls server as a remote server in another sql server, so I can execute backup jobs on the backup server from the production server.
This was all working ok, but now everytime the backup is called I get an error message saying login falied for 'sa'.
I haven't changed anything and the remote logins look like they are set up correctly.
Any advise would be appreciatedMy guess would be that you applied sp3, and when it "hardened" the sa password on your slave server, things went amok. Open Query Analyzer on your master, and attempt to log into your slave as sa. If that breaks, you'll need to find (or change) the sa password for your slave, then fix the problem(s) (there may be more than one) in the remote login definitions.
-PatP|||Hi,
Did not apply sp3? they were both applied to both the servers before this error occured.
this is the kind thing that has stopped working
Run on server 1 as a job
exec Server2.msdb.dbo.sp_start_job @.job_name='Restore = Load Alpha AM'
Friday, March 9, 2012
Remote Manage SQL Server Agent via SSMS
When I open up SSMS from the SQL Server 2005 box itself I can see all SQL
Server Agent jobs. When I open a specific job I can see the owner and steps
etc. When I use SSMS remotely from my Vista laptop to connect to the SQL
Server 2005 instance I can see the jobs, but when I go to look at properties
it is acting like it is a new job with none of the actual owner/config
information. The account I am using to connect in both cases is the same
account and is in the sysadmin role. Any advice is appreciated.
Thanks
--
Adam SYou need to install SP2 or later on your client machine. I believe you have
a mismatch between client and server (a later edition has probably been
upgraded on the server). You should always try to maintain consistency
between the version of tools installed on the server and all clients that
will access it...
A
"Adam S" <Adam S@.community.nospam> wrote in message
news:7B3CEA63-4090-48D4-AFEA-70487F537E5E@.microsoft.com...
> When I open up SSMS from the SQL Server 2005 box itself I can see all SQL
> Server Agent jobs. When I open a specific job I can see the owner and
> steps
> etc. When I use SSMS remotely from my Vista laptop to connect to the SQL
> Server 2005 instance I can see the jobs, but when I go to look at
> properties
> it is acting like it is a new job with none of the actual owner/config
> information. The account I am using to connect in both cases is the same
> account and is in the sysadmin role. Any advice is appreciated.
> Thanks
> --
> Adam S
Server Agent jobs. When I open a specific job I can see the owner and steps
etc. When I use SSMS remotely from my Vista laptop to connect to the SQL
Server 2005 instance I can see the jobs, but when I go to look at properties
it is acting like it is a new job with none of the actual owner/config
information. The account I am using to connect in both cases is the same
account and is in the sysadmin role. Any advice is appreciated.
Thanks
--
Adam SYou need to install SP2 or later on your client machine. I believe you have
a mismatch between client and server (a later edition has probably been
upgraded on the server). You should always try to maintain consistency
between the version of tools installed on the server and all clients that
will access it...
A
"Adam S" <Adam S@.community.nospam> wrote in message
news:7B3CEA63-4090-48D4-AFEA-70487F537E5E@.microsoft.com...
> When I open up SSMS from the SQL Server 2005 box itself I can see all SQL
> Server Agent jobs. When I open a specific job I can see the owner and
> steps
> etc. When I use SSMS remotely from my Vista laptop to connect to the SQL
> Server 2005 instance I can see the jobs, but when I go to look at
> properties
> it is acting like it is a new job with none of the actual owner/config
> information. The account I am using to connect in both cases is the same
> account and is in the sysadmin role. Any advice is appreciated.
> Thanks
> --
> Adam S
Remote Manage SQL Server Agent via SSMS
When I open up SSMS from the SQL Server 2005 box itself I can see all SQL
Server Agent jobs. When I open a specific job I can see the owner and steps
etc. When I use SSMS remotely from my Vista laptop to connect to the SQL
Server 2005 instance I can see the jobs, but when I go to look at properties
it is acting like it is a new job with none of the actual owner/config
information. The account I am using to connect in both cases is the same
account and is in the sysadmin role. Any advice is appreciated.
Thanks
Adam SYou need to install SP2 or later on your client machine. I believe you have
a mismatch between client and server (a later edition has probably been
upgraded on the server). You should always try to maintain consistency
between the version of tools installed on the server and all clients that
will access it...
A
"Adam S" <Adam S@.community.nospam> wrote in message
news:7B3CEA63-4090-48D4-AFEA-70487F537E5E@.microsoft.com...
> When I open up SSMS from the SQL Server 2005 box itself I can see all SQL
> Server Agent jobs. When I open a specific job I can see the owner and
> steps
> etc. When I use SSMS remotely from my Vista laptop to connect to the SQL
> Server 2005 instance I can see the jobs, but when I go to look at
> properties
> it is acting like it is a new job with none of the actual owner/config
> information. The account I am using to connect in both cases is the same
> account and is in the sysadmin role. Any advice is appreciated.
> Thanks
> --
> Adam S
Server Agent jobs. When I open a specific job I can see the owner and steps
etc. When I use SSMS remotely from my Vista laptop to connect to the SQL
Server 2005 instance I can see the jobs, but when I go to look at properties
it is acting like it is a new job with none of the actual owner/config
information. The account I am using to connect in both cases is the same
account and is in the sysadmin role. Any advice is appreciated.
Thanks
Adam SYou need to install SP2 or later on your client machine. I believe you have
a mismatch between client and server (a later edition has probably been
upgraded on the server). You should always try to maintain consistency
between the version of tools installed on the server and all clients that
will access it...
A
"Adam S" <Adam S@.community.nospam> wrote in message
news:7B3CEA63-4090-48D4-AFEA-70487F537E5E@.microsoft.com...
> When I open up SSMS from the SQL Server 2005 box itself I can see all SQL
> Server Agent jobs. When I open a specific job I can see the owner and
> steps
> etc. When I use SSMS remotely from my Vista laptop to connect to the SQL
> Server 2005 instance I can see the jobs, but when I go to look at
> properties
> it is acting like it is a new job with none of the actual owner/config
> information. The account I am using to connect in both cases is the same
> account and is in the sysadmin role. Any advice is appreciated.
> Thanks
> --
> Adam S
Remote Manage SQL Server Agent via SSMS
When I open up SSMS from the SQL Server 2005 box itself I can see all SQL
Server Agent jobs. When I open a specific job I can see the owner and steps
etc. When I use SSMS remotely from my Vista laptop to connect to the SQL
Server 2005 instance I can see the jobs, but when I go to look at properties
it is acting like it is a new job with none of the actual owner/config
information. The account I am using to connect in both cases is the same
account and is in the sysadmin role. Any advice is appreciated.
Thanks
Adam S
You need to install SP2 or later on your client machine. I believe you have
a mismatch between client and server (a later edition has probably been
upgraded on the server). You should always try to maintain consistency
between the version of tools installed on the server and all clients that
will access it...
A
"Adam S" <Adam S@.community.nospam> wrote in message
news:7B3CEA63-4090-48D4-AFEA-70487F537E5E@.microsoft.com...
> When I open up SSMS from the SQL Server 2005 box itself I can see all SQL
> Server Agent jobs. When I open a specific job I can see the owner and
> steps
> etc. When I use SSMS remotely from my Vista laptop to connect to the SQL
> Server 2005 instance I can see the jobs, but when I go to look at
> properties
> it is acting like it is a new job with none of the actual owner/config
> information. The account I am using to connect in both cases is the same
> account and is in the sysadmin role. Any advice is appreciated.
> Thanks
> --
> Adam S
Server Agent jobs. When I open a specific job I can see the owner and steps
etc. When I use SSMS remotely from my Vista laptop to connect to the SQL
Server 2005 instance I can see the jobs, but when I go to look at properties
it is acting like it is a new job with none of the actual owner/config
information. The account I am using to connect in both cases is the same
account and is in the sysadmin role. Any advice is appreciated.
Thanks
Adam S
You need to install SP2 or later on your client machine. I believe you have
a mismatch between client and server (a later edition has probably been
upgraded on the server). You should always try to maintain consistency
between the version of tools installed on the server and all clients that
will access it...
A
"Adam S" <Adam S@.community.nospam> wrote in message
news:7B3CEA63-4090-48D4-AFEA-70487F537E5E@.microsoft.com...
> When I open up SSMS from the SQL Server 2005 box itself I can see all SQL
> Server Agent jobs. When I open a specific job I can see the owner and
> steps
> etc. When I use SSMS remotely from my Vista laptop to connect to the SQL
> Server 2005 instance I can see the jobs, but when I go to look at
> properties
> it is acting like it is a new job with none of the actual owner/config
> information. The account I am using to connect in both cases is the same
> account and is in the sysadmin role. Any advice is appreciated.
> Thanks
> --
> Adam S
Remote login
Hi,
I have messed around with some remote login stuff and really screwed things up, now all of my jobs that execute prcedures on the remote server all fail saying the login failed for user 'sa'.
I need to get this working again and could really do with some help.Depending on how you've got your security configured, you need to clear out the remote login matrix on either the local or the linked server. Pop into Enterprise Mangler, and remove any local to remote mappings with constant values (I don't think you can delete the "passthrough" mapping, but don't even try just in case you could).
-PatP|||These are listed as remote servers not linked servers.
How do I remove remote mappings in Enterprise Mangler?|||Check BOL (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/entrmgr/em_62p8.asp).
-PatP
I have messed around with some remote login stuff and really screwed things up, now all of my jobs that execute prcedures on the remote server all fail saying the login failed for user 'sa'.
I need to get this working again and could really do with some help.Depending on how you've got your security configured, you need to clear out the remote login matrix on either the local or the linked server. Pop into Enterprise Mangler, and remove any local to remote mappings with constant values (I don't think you can delete the "passthrough" mapping, but don't even try just in case you could).
-PatP|||These are listed as remote servers not linked servers.
How do I remove remote mappings in Enterprise Mangler?|||Check BOL (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/entrmgr/em_62p8.asp).
-PatP
Remote Job Execution
Is there a way to execute SQL Server jobs (Not the jobs
created by DTS packages or Maintenance Plans. Just jobs
created with --> Create new Job...)remote (Trough a batch
file, third party software like tivoli schedular)?
Thanks.
Use OSQL the command line utility to run execute stored procedure
sp_start_job.
----
Need SQL Server Examples check out my website at
http://www.geocities.com/sqlserverexamples
"Tom" <anonymous@.discussions.microsoft.com> wrote in message
news:98aa01c433ac$97e9f420$a301280a@.phx.gbl...
> Is there a way to execute SQL Server jobs (Not the jobs
> created by DTS packages or Maintenance Plans. Just jobs
> created with --> Create new Job...)remote (Trough a batch
> file, third party software like tivoli schedular)?
> Thanks.
>
created by DTS packages or Maintenance Plans. Just jobs
created with --> Create new Job...)remote (Trough a batch
file, third party software like tivoli schedular)?
Thanks.
Use OSQL the command line utility to run execute stored procedure
sp_start_job.
----
Need SQL Server Examples check out my website at
http://www.geocities.com/sqlserverexamples
"Tom" <anonymous@.discussions.microsoft.com> wrote in message
news:98aa01c433ac$97e9f420$a301280a@.phx.gbl...
> Is there a way to execute SQL Server jobs (Not the jobs
> created by DTS packages or Maintenance Plans. Just jobs
> created with --> Create new Job...)remote (Trough a batch
> file, third party software like tivoli schedular)?
> Thanks.
>
Remote Job Execution
Is there a way to execute SQL Server jobs (Not the jobs
created by DTS packages or Maintenance Plans. Just jobs
created with --> Create new Job...)remote (Trough a batch
file, third party software like tivoli schedular)?
Thanks.Use OSQL the command line utility to run execute stored procedure
sp_start_job.
----
----
--
Need SQL Server Examples check out my website at
http://www.geocities.com/sqlserverexamples
"Tom" <anonymous@.discussions.microsoft.com> wrote in message
news:98aa01c433ac$97e9f420$a301280a@.phx.gbl...
> Is there a way to execute SQL Server jobs (Not the jobs
> created by DTS packages or Maintenance Plans. Just jobs
> created with --> Create new Job...)remote (Trough a batch
> file, third party software like tivoli schedular)?
> Thanks.
>
created by DTS packages or Maintenance Plans. Just jobs
created with --> Create new Job...)remote (Trough a batch
file, third party software like tivoli schedular)?
Thanks.Use OSQL the command line utility to run execute stored procedure
sp_start_job.
----
----
--
Need SQL Server Examples check out my website at
http://www.geocities.com/sqlserverexamples
"Tom" <anonymous@.discussions.microsoft.com> wrote in message
news:98aa01c433ac$97e9f420$a301280a@.phx.gbl...
> Is there a way to execute SQL Server jobs (Not the jobs
> created by DTS packages or Maintenance Plans. Just jobs
> created with --> Create new Job...)remote (Trough a batch
> file, third party software like tivoli schedular)?
> Thanks.
>
Remote Job Execution
Is there a way to execute SQL Server jobs (Not the jobs
created by DTS packages or Maintenance Plans. Just jobs
created with --> Create new Job...)remote (Trough a batch
file, third party software like tivoli schedular)?
Thanks.Use OSQL the command line utility to run execute stored procedure
sp_start_job.
--
----
----
--
Need SQL Server Examples check out my website at
http://www.geocities.com/sqlserverexamples
"Tom" <anonymous@.discussions.microsoft.com> wrote in message
news:98aa01c433ac$97e9f420$a301280a@.phx.gbl...
> Is there a way to execute SQL Server jobs (Not the jobs
> created by DTS packages or Maintenance Plans. Just jobs
> created with --> Create new Job...)remote (Trough a batch
> file, third party software like tivoli schedular)?
> Thanks.
>
created by DTS packages or Maintenance Plans. Just jobs
created with --> Create new Job...)remote (Trough a batch
file, third party software like tivoli schedular)?
Thanks.Use OSQL the command line utility to run execute stored procedure
sp_start_job.
--
----
----
--
Need SQL Server Examples check out my website at
http://www.geocities.com/sqlserverexamples
"Tom" <anonymous@.discussions.microsoft.com> wrote in message
news:98aa01c433ac$97e9f420$a301280a@.phx.gbl...
> Is there a way to execute SQL Server jobs (Not the jobs
> created by DTS packages or Maintenance Plans. Just jobs
> created with --> Create new Job...)remote (Trough a batch
> file, third party software like tivoli schedular)?
> Thanks.
>
Subscribe to:
Posts (Atom)