Move operation for a SQL Server database fails with Status Code 5, or Error (-1), when the host name of the SQL Server, the SQL Server database name, or the database logical name has trailing spaces
Problem
If the SQL Server host name, database name, or database logical name has one or more trailing spaces, a move operation fails with Status Code 5 or Error (-1).Applies to:
SQL Server 2005 and above
All supported Windows versions
Error Message
In the Activity Monitor, the job details show a Status code 5 error. In the NetBackup MS SQL Client, the progress log shows Error (-1).ERR - Error in VxBSAQueryObject: 17.CONTINUATION: - No object matched the specified predicate.
Cause
When a SQL Server host name, a database name or a database logical name has trailing spaces, NetBackup does not generate the move template correctly. The template is missing several lines, including the MOVE and the TO lines that indicate where to move the database or logical files. Also, the trailing space in the SQL Server host name, database name, or database logical name is truncated in the script.
For example, assume that the server host name is “ACCT ”, you use the default instance, the database name is “DatabaseA ”. Also assume that there is a full text catalog with the logical name of “sysft_FT-Catalog ”. Notice the trailing spaces in the server host name, the database name, and the catalog name.
NetBackup generates the following move template:#
# This is a template for the database MOVE command.
# OPERATION RESTOREOBJECTTYPE DATABASERESTORETYPE MOVE
#
# Replace the database name in the following line with the name of the database # that you want to move to. Also remove the hash mark <#> which precedes the # keyword <DATABASE>.
#
#DATABASE "DatabaseA"
#
# Replace the full text catalog directory path# <C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\FTData\FT-Catalog>
# with a new directory path. Also remove the hash mark <#> which precedes the
# keyword <TO>.
# The target of the MOVE keyword must be "sysft_FT-Catalog-Customers".
#MOVE " sysft_FT-Catalog "#TO "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\FTData\FT-Catalog"
#
# The following image is type: Full NBIMAGE "acct.MSSQL7.ACCT.db.DatabaseA.~.7.001of001.20151118121736..C "SQLHOST "acct.domain.COM"NBSERVER "MASTER.DOMAIN.COM" BROWSECLIENT "ACCT.DOMAIN.COM" MAXTRANSFERSIZE 6 BLOCKSIZE 7 RESTOREOPTION REPLACE RECOVEREDSTATE RECOVERED NUMBUFS 2 ENDOPER TRUE
Solution
Make the following changes to the move template:- Add the trailing spaces to the database name.
- Add the MOVE and the TO lines for the database and the database log file. Be sure that the MOVE line includes the trailing spaces in the database name and the database log name.
TO "E:\Program Files\Microsoft SQL Server\MSSQL11 \MSSQL\DATA\DatabaseB.mdf"
TO "E:\Program Files\Microsoft SQL Server\MSSQL11\MSSQL\DATA\DatabaseB_Log.mdf"
- If you have a full text catalog, also add MOVE and the TO lines for the catalog. Be sure that the MOVE line includes the trailing spaces in the catalog name.
TO "C:\Program Files\Microsoft SQL Server\MSSQL11\MSSQL\FTData\NewFT-Catalog"
- Edit the NBIMAGE name to include the trailing spaces for the server host name and the database name: