Backup fails due to database being offline

On this page

Error message

MSSQL: warning: explicitly included database 'XXX' on DEFAULT server instance appears to be offline, will try anyway
MSSQL: error: backup of database 'XXX' on DEFAULT server instance failed unexpectedly: An exception occurred while executing a Transact-SQL statement or batch.: because Database 'XXX' cannot be opened because it is offline.

Error description

Databases and all of their dependencies must be online to be backed up through Microsoft SQL Server.

Any backup operation that implicitly or explicitly references data that is offline fails. Some typical examples include the following: You request a full database backup, but one file group of the database is offline. Because all file groups are implicitly included in a full database backup, this operation fails.

To back up this database, you can use a file backup and specify only the file groups that are online. You request a partial backup, but a read/write file group is offline. Because all read/write file groups are required for a partial backup, the operation fails. You request a file backup of specific files, but one of the files is not online. The operation fails. To back up the online files, you can omit the offline file from the file list and repeat the operation.

See further details.

Steps to resolve

Exclude offline databases from the backup using RVXConfig, or bring the selected databases and all of their dependents online before attempting backup.