Veritas NetBackup™ for Microsoft SQL Server Administrator's Guide
- Introducing NetBackup for SQL Server
- Installing NetBackup for SQL Server
- Managing SQL Server objects for use with SQL Server Intelligent Policies
- About autodiscovery of SQL Server objects
- About registering SQL Server instances and availability group replicas
- Registering instances or availability replicas with an instance group
- Configuring SQL Server backups with SQL Server Intelligent Policy
- Configuring NetBackup for SQL Server
- Performing restores of SQL Server
- Redirecting a SQL Server database to a different host
- Restoring multistreamed SQL Server backups
- Protecting SQL Server data with VMware backups
- About protecting SQL Server data with VMware backups
- Using NetBackup for SQL Server with Snapshot Client
- Using copy-only snapshot backups to affect how differentials are based
- About SQL Server agent grouped backups (legacy SQL Server policies)
- Protecting SQL Server availability groups
- Protecting SQL Server availability groups with intelligent policies
- Protecting SQL Server availibility groups with legacy policies
- About protecting the preferred replica in a SQL Server availability group (legacy backup policies)
- About protecting a specific node in a SQL Server availability group (legacy backup policies)
- About protecting the preferred replica in a SQL Server availability group (legacy backup policies)
- Protecting SQL Server in a cluster environment
- Configuring backups with legacy SQL Server policies using clients and batch files
- About using batch files with NetBackup for SQL Server
- About schedule properties
- Performing user-directed backups of SQL Server databases
- Performing user-directed backups of read-only filegroups
- Using NetBackup for SQL Server with multiple NICs
- Protecting SQL Server a log-shipping configuration
- SQL Server backups and restores in an SAP environment (legacy SQL Server policies)
- About SQL Server backups and restores in an SAP environment
- Backup and recovery concepts
- Overview of SQL Server backup and recovery concepts
- About recovery factors for SQL Server
- Troubleshooting
- About debug logging for SQL Server troubleshooting
- Disaster recovery of a SQL Server
- Appendix A. Sample batch files
- About sample backup batch files for legacy SQL Server policies
- About sample restore batch files
- About sample backup batch files for legacy SQL Server policies
- Appendix B. Multiplexed backups
- Appendix C. Register authorized locations
Script that uses environment variables to exclude instances and databases from backup
You can use SQLINSTANCE $ALL in your batch file to designate that all SQL Server instances on your host be backed up. For example, the following batch file backs up the master, model, and msdb databases. These databases are backed up on all instances of SQL Server on the host on which the batch file is run.
SQLINSTANCE $ALL OPERATION BACKUP DATABASE "master" NBSERVER "BEARING" MAXTRANSFERSIZE 6 BLOCKSIZE 7 NUMBUFS 2 ENDOPER TRUE OPERATION BACKUP DATABASE "msdb" NBSERVER "BEARING" MAXTRANSFERSIZE 6 BLOCKSIZE 7 NUMBUFS 2 ENDOPER TRUE OPERATION BACKUP DATABASE "model" NBSERVER "BEARING" MAXTRANSFERSIZE 6 BLOCKSIZE 7 NUMBUFS 2 ENDOPER TRUE
To exclude SQL Server instances on your host from backup, create the Windows environmental variable NB_SQL_INSTANCE_EXCLUDE. Specify a list of instances names that you want to exclude. The list should consist of one or more names that are separated by semi-colons.
For example, use the following value to indicate that you want to exclude the default SQL Server instance and the instance named ABC-PRODUCTS from backup:
#DEFAULT#;ABC-PRODUCTS;
Note that the default SQL Server instance for the local host is designated as #default#.
You can also exclude individual databases from backup by creating a Windows environmental variable NB_SQL_DATABASE_EXCLUDE. For the value of the variable, specify a list of database names.
For example, consider the following batch file:
SQLINSTANCE $ALL OPERATION BACKUP DATABASE $ALL NBSERVER "BEARING" MAXTRANSFERSIZE 6 BLOCKSIZE 7 NUMBUFS 2 ENDOPER TRUE
You can exclude the databases "master," "accounting," and "pubs" with the NB_SQL_DATABASE_EXCLUDE environmental variable. For the value of the variable, indicate the databases you want to exclude. Separate the database names with semi-colons.
MASTER;ACCOUNTING;PUBS
The NB_SQL_DATABASE_EXCLUDE variable is applicable only for a batch file that has DATABASE $ALL. It performs the same function as the keyword and value pair EXCLUDE <database>. If both variables are used, they augment each other to determine which databases to exclude.