Sql-server – SQL Server Maintenence Plan error on an offline Database

maintenancesql server

Today is SQL day for me 🙂

I have a maintenance plan that is failing to run with the following error:

Failed:(-1073548784) Executing the
query "USE [SharedServices1_DB]"
failed with the following error:
"Database 'SharedServices1_DB' cannot
be opened because it is offline.".
Possible failure reasons: Problems
with the query, "ResultSet" property
not set correctly, parameters not set
correctly, or connection not
established correctly.

where SharedServices1_DB is a database that is set to offline. I would like to exclude this database from the maintenance plan, but when the database is offline, it does not show up at all as a "specific database" in the maintenance plan task, and if I bring it online, it is already unchecked in the maintenance plan task.

How can I exclude an offline database from a maintenance plan?

Best Answer

Yes we can exclude offline DB from specific maintenance plan. Please find below steps.

  1. Right click on maintenance plan -> select 'modify' -> you can see plan and subplans here ->right click on plan select 'properties' -> properties window will open in your right hand side > expand and search for the option 'IgnoreDatabaseInNotOnlinestate' -> check value set for this if its false then change it to 'True' with the help dropdown.

It works well for me without recreating maintenance plans on server.