Link to home
Start Free TrialLog in
Avatar of DrewBryant1961
DrewBryant1961

asked on

Cannot delete or run SQL Maintenance Plans from SQL Management Studio

I hope this is somewhat clear. Recent deployment of SQL Server 2008 Standard on a Windows 2003 Server. All mandatory service packs and hotfixes have been applied.

I have 2 issues:

1.      Deleting the initial maintenance plan that was created via the wizard from SSMS to backup the databases.

The error message is:

Exception has been thrown by the target of an invocation. (mscorlib)

An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 53)

Ive seen where some can overcome this by deleting the faulty plan id record in the sysmaintplan_subplans, sysmaintplan_log and the sysdtspackages tables. These tables are empty.

Subsequent maintenance plans can be created and deleted. However the original maintenance plan remains and the job cannot be deleted once a second Maintenance Plan is deleted. The job is displayed under SQL Server Agent | Jobs. If you attempt to delete the job from SSMS, a message is displayed that the job does not exist.

2.      Any Maintenance Plan created fails to execute successfully.

The error message is:

Execution failed. See the maintenance plan and SQL Server Agent job history logs for details.

Additional information:
      Job jobname.Subplan_1 failed (SqlManagerUI)

The job history log only states the job failed and the last step to run was step 1 (subplan_1).

This message occurs for any Maintenance Plan job defined.

Any guidance would be appreciated. Thank you.
Avatar of Soccerman55
Soccerman55

This was the solution in SQL 2005, I would assume it would be pretty close to the same for SQL 2008

Execute these in the MSDB database
SELECT * FROM sysdtspackages90 (to get the Plan_ID of the Bad Plan)
DELETE FROM sysmaintplan_log WHERE plan_id = BadPlanID
DELETE FROM sysmaintplan_subplans WHERE plan_id = BadPlanID
DELETE FROM sysdtspackages90 WHERE plan_id = BadPlanID

After doing this, the plan goes away by itself, and the associated job can be deleted w/o error.
Avatar of DrewBryant1961

ASKER

Thanks for your reply. I saw that, however there is not a sysdtspackages90 table. I removed the entry in the sysdtspackages table. The other sysmaintplan tables have nothing in them.

The job went away although the original maintenance plan remains and cannot be deleted.

Any new maintenance plans created from the wizard will not execute successfully although new plans can be created and deleted.

I'm having the same issue #2 here, on Server 2008 x64 with SQL 2008. Any ideas?
Avatar of Mark Wills
Have you looked through the sysjobs tables ?
I just took a look, and didn't see anything useful. The jobs that were created by log shipping work fine, but the maintanance plan jobs fail every time. The only text available says that they failed, with no reason.
I get lines like this:
The job failed.  The Job was invoked by User MYDOMAIN\Administrator.  The last step to run was step 1 (backup_all_DBs).
ASKER CERTIFIED SOLUTION
Avatar of radersolutions
radersolutions

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
About to suggest exactly that - well, first to see if 2005 was still installed, then uninstall (via control panel) and re-install SSIS for 2008 / VS...

Beat me by seconds... Was typing up when your e-mail notice came in.
hehe.. Thanks for your help though. Your first comment got me to thinking that there was definitely something missing based on the fact that the error messages didn't have any real "errors" in them, like something was missing.

This is a fresh installation of 2008, no 2005 pre-existing.
Pleased you are OK, but what about : DrewBryant1961 ?
Installed SQL Server Integration Services and new maintenance plans run fine.

The original plan will not run and cannot be deleted. I get the same exception error listed in issue 1 above.

This was a new install of SQL 2008 and I, too, wasn't aware that SQL Server Integration Services was required for Maintenance Plans to work.

Thanks for your replies.
Thanks for your help.