DOCUMENTATION: How to use the bplist command to manually create an SQL restore script.

Article:TECH23166  |  Created: 2009-01-28  |  Updated: 2013-10-24  |  Article URL http://www.symantec.com/docs/TECH23166
Article Type
Technical Solution

Product(s)

Environment

Issue



DOCUMENTATION: How to use the bplist command to manually create an SQL restore script.

Solution



Manual:
Veritas NetBackup for Microsoft SQL Server Administrator's Guide Windows Release 6.5, Page 107
Veritas NetBackup 6.0 for Microsoft SQL Server System Administrator's Guide for Windows, Page 102
Veritas NetBackup 5.1 for Microsoft SQL Server System Administrator's Guide, Page: 103
Veritas NetBackup 5.0 for Microsoft SQL Server System Administrator's Guide, Page: 126
Veritas NetBackup 4.5 for Microsoft SQL Server System Administrator's Guide, Page: 128
Veritas NetBackup 3.4 for Microsoft SQL Server System Administrator's Guide, Page: 126

Modification Type: Addition

Modification:
The basic outline of the script is shown below. Two pieces of information are required for a successful restore using a manually created script, the database name and the image name.  

=====SCRIPT====

OPERATION RESTORE
OBJECTTYPE DATABASE
DATABASE "<database_name>"
NBIMAGE "<image_name>"
MAXTRANSFERSIZE 0
BLOCKSIZE 0
DBMS MSSQL
ENDOPER TRUE

===============

NOTE: This restore script places the database back into the original location on the original SQL server.  If the database needs to be moved to a different server or different location, please see the technotes shown under related below.

From the Microsoft SQL server that backed up the database (in this example, SERVER1), execute the following command from the <install_path>\veritas\netbackup\bin directory:

    bplist -C SERVER1 -t 15 -R \

This generates a list of images which looks like the following:

server1.MSSQL7.SERVER1.db.pubs.~.0.001of001.20021129160216..C:\
server1.MSSQL7.SERVER1.db.Northwind.~.0.001of001.20021129160159..C:\
server1.MSSQL7.SERVER1.db.pubs.~.0.001of001.20021122160934..C:\
server1.MSSQL7.SERVER1.db.Northwind.~.0.001of001.20021122160917..C:\
server1.MSSQL7.SERVER1.db.pubs.~.0.001of001.20021115160303..C:\
server1.MSSQL7.SERVER1.db.Northwind.~.0.001of001.20021115160246..C:\

Note that the image name is composed of a variety of information drawn from the server, including the server name, the database name, and the date and time of the backup. The final string of numbers is the date and time, in the following format: YYYYMMDDhhmmss. For example, in the first image in the list (server1.MSSQL7.SERVER1.db.pubs.~.0.001of001.20021129160216..C:\), the image was created on November 29, 2002, at 4:02:16 PM.

Copy the entire image name into the above sample script, replacing the <image_name> with the name of the image to be restored.  Be sure to eliminate the trailing backslash from the image name or the restore will fail. Replace the <database_name> with the name of the database, which is also the image name of the backup. For this example, use Northwind.

Please note the database name and the image name need to be inside quotation marks. Once the script has been modified, save it with a .bch extension, since that is the required extension for the SQL agent. The final script is shown below:

OPERATION RESTORE
OBJECTTYPE DATABASE
DATABASE "Northwind"
NBIMAGE "server1.MSSQL7.SERVER1.db.Northwind.~.0.001of001.20021129160159..C:"
MAXTRANSFERSIZE 0
BLOCKSIZE 0
DBMS MSSQL
ENDOPER TRUE

This script, when executed, restores the Northwind database which was backed up on November 29th, 2002, at 4:01:59 PM.

NOTE: With versions of NetBackup 4.5 GA and older, the use of a user DSN is required.  It is necessary to be logged into the computer as the NT user account that starts the VERITAS NetBackup Client Service in order to see the DSN (since it is a user DSN).  Once correctly logged into the computer, go to Control Panel | ODBC Datasources, and find the ODBC datasource name that was used for the SQL backups.  Enter this name into the script before the "ENDOPER TRUE" line.  Note the DSN name should be within quotation marks.  An example is shown below, with the DSN name of "VERITAS".

OPERATION RESTORE
OBJECTTYPE DATABASE
DATABASE "Northwind"
NBIMAGE "server1.MSSQL7.SERVER1.db.Northwind.~.0.001of001.20021129160159..C:"
MAXTRANSFERSIZE 0
BLOCKSIZE 0
DBMS MSSQL
DSN "VERITAS"
ENDOPER TRUE




Legacy ID



252378


Article URL http://www.symantec.com/docs/TECH23166


Terms of use for this information are found in Legal Notices