大网数据广告活动
数据库与应用安全

Back up a database using a VSS backup application

· 52CE 我爱测

This article provides a resolution for the problem that occurs when you use Volume Shadow Copy Services (VSS) based applications to back up your SQL Server databases.

This article helps you resolve the problem that occurs when you use Volume Shadow Copy Services (VSS) based applications to back up your SQL Server databases.

Original product version:   SQL Server
Original KB number:   2014054

Symptoms

When you use Volume Shadow Copy Services (VSS) based applications to back up your SQL Server databases, the backup operation may fail if the database name contains either leading or trailing spaces or non-printable characters.

The same problem may also occur when you try to back up a volume that contains one of these databases.

Cause

VSS based backup applications use SQLServerWriter (SQLWriter) to query Writer Metadata Component information to determine which database files need to be backed up. The Writer Metadata Component is created by SQLWriter using VSS API and contains three sets of data:

  • Writer identification and classification information
  • Writer-level specifications
  • Component data

When a database name contains leading or trailing spaces or non-printable characters, this document may not be created successfully. As a result, VSS-based applications will not be able to back up these databases or any volumes that contain these databases.

Resolution

Rename all databases that contain either leading or trailing spaces or unprintable characters in their names. You can use the following query to locate the presence of such characters in front or at end of the names:

SELECT database_id AS DatabaseID, '##'+name+'##' AS DatabaseName FROM sys.databases  

Example output:

DatabaseID         DatabaseName
8                  ##AdventureWorks##          -- DB name is fine
15                 ## DBWithLeadingSpace##     -- DB name contains leading spaces
17                 ##DBWithTrailingSpace ##    -- DB name contains trailing spaces  

Note: In the preceding query, if the database name contains unprintable characters they may either be printed out as spaces or some junk.

More information

Writers (like SQL Writer) add components using IVssCreateWriterMetadata::AddComponent, specifying the following component information:

  • Type
  • Name
  • Logical path (if any)
  • Supported feature
  • Selectability
  • Metadata to be used by the writer during restore
  • Display information
  • Notification information

C (Volume Shadow Copy Service) are collections of files that form a logical unit for purposes of backup and restore. All files in a component (except those explicitly excluded) must be backed up and restored as a unit.

For more information, see VSS Metadata.

You can use one or more of the following methods to identify if you are running into this issue:

  • Various backup applications may raise custom messages about SqlServerWriter (or SQLWriter) not being found.

  • When you execute from a command prompt on the target SQL Server machine, you will not see SqlServerWriter in the output.

    vssadmin list writers

Source: Microsoft Learn / IT Pro troubleshooting by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / IT Pro troubleshooting
适用范围
See source applicability · Source date 09/19/2022
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。