![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm looking for a simple way to run a Maintenance Plan's backup job from a DTS package. I know I can use the sp_Start_Job, but this requires a jobname or jobID. To get those I would need to parse through the output from a sp_Help-Job & look for 'Backup' & 'databasename'. Also, I want to use the backup job from my Maintenance Plan, so that if I or another DBA needs to perform a recovery, all of the backup files are in the same location with the sme naming conventions. Thanks |
#3
| |||
| |||
|
|
Is there some reason you would need to dunamically dtermine the job name? Can you not just hard code it ++ you cannot just start any old job, you have to have permissions. From BOL Execute permissions default to the public role in the msdb database. A user who can execute this procedure and is a member of the sysadmin fixed role can start any job. A user who is not a member of the sysadmin role can use sp_start_job to start only the jobs he/she owns. -- -- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. www.konesans.com - Consultancy from the people who know "Sam" <Sam (AT) discussions (DOT) microsoft.com> wrote in message news:2E7D8BB6-2DEB-4F1D-B9AC-DE3CBC5EB2D2 (AT) microsoft (DOT) com... I'm looking for a simple way to run a Maintenance Plan's backup job from a DTS package. I know I can use the sp_Start_Job, but this requires a jobname or jobID. To get those I would need to parse through the output from a sp_Help-Job & look for 'Backup' & 'databasename'. Also, I want to use the backup job from my Maintenance Plan, so that if I or another DBA needs to perform a recovery, all of the backup files are in the same location with the sme naming conventions. Thanks |
#4
| |||
| |||
|
|
Yes I could hard code the jobname, but I was looking for something a little more dynamic that would allow me to more easily deploy the package to multiple servers & hopefully allow me to specify the UserID/Passwword to run the job. Sam "Allan Mitchell" wrote: Is there some reason you would need to dunamically dtermine the job name? Can you not just hard code it ++ you cannot just start any old job, you have to have permissions. From BOL Execute permissions default to the public role in the msdb database. A user who can execute this procedure and is a member of the sysadmin fixed role can start any job. A user who is not a member of the sysadmin role can use sp_start_job to start only the jobs he/she owns. -- -- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. www.konesans.com - Consultancy from the people who know "Sam" <Sam (AT) discussions (DOT) microsoft.com> wrote in message news:2E7D8BB6-2DEB-4F1D-B9AC-DE3CBC5EB2D2 (AT) microsoft (DOT) com... I'm looking for a simple way to run a Maintenance Plan's backup job from a DTS package. I know I can use the sp_Start_Job, but this requires a jobname or jobID. To get those I would need to parse through the output from a sp_Help-Job & look for 'Backup' & 'databasename'. Also, I want to use the backup job from my Maintenance Plan, so that if I or another DBA needs to perform a recovery, all of the backup files are in the same location with the sme naming conventions. Thanks |
#5
| |||
| |||
|
|
Can't do that. You do not get the option to "Run As". If you schedule your DTS package then you can have the Account under which it runs have perms to do the job running. How do you propose to know that the backup job you have selected comes from your maint plan? I can backup databases without using main plans Which maint plan? You may have one for logs and one for some databases, others for other databases. In msdb you have dbo.sysdbmaintplan_jobs which will give you the Guids of the Job and the Plan dbo.sysdbmaintplans will give you name of the plans matched on GUIDs dbo.sysdbmaintplan_databases will give you the name(s) of the databases upon which your plan operates. At no point do I see an action type though. You still need to know the name of the plan though. -- -- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. www.konesans.com - Consultancy from the people who know "Sam" <Sam (AT) discussions (DOT) microsoft.com> wrote in message news:70754FB4-F03E-4614-97B4-BA0EDA0B58F4 (AT) microsoft (DOT) com... Yes I could hard code the jobname, but I was looking for something a little more dynamic that would allow me to more easily deploy the package to multiple servers & hopefully allow me to specify the UserID/Passwword to run the job. Sam "Allan Mitchell" wrote: Is there some reason you would need to dunamically dtermine the job name? Can you not just hard code it ++ you cannot just start any old job, you have to have permissions. From BOL Execute permissions default to the public role in the msdb database. A user who can execute this procedure and is a member of the sysadmin fixed role can start any job. A user who is not a member of the sysadmin role can use sp_start_job to start only the jobs he/she owns. -- -- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. www.konesans.com - Consultancy from the people who know "Sam" <Sam (AT) discussions (DOT) microsoft.com> wrote in message news:2E7D8BB6-2DEB-4F1D-B9AC-DE3CBC5EB2D2 (AT) microsoft (DOT) com... I'm looking for a simple way to run a Maintenance Plan's backup job from a DTS package. I know I can use the sp_Start_Job, but this requires a jobname or jobID. To get those I would need to parse through the output from a sp_Help-Job & look for 'Backup' & 'databasename'. Also, I want to use the backup job from my Maintenance Plan, so that if I or another DBA needs to perform a recovery, all of the backup files are in the same location with the sme naming conventions. Thanks |
![]() |
| Thread Tools | |
| Display Modes | |
| |