X hits on this document

593 views

0 shares

0 downloads

0 comments

196 / 200

196

Sample batch files Sample 12 - Using environment variables to exclude instances and databases from backup

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, separated by semi-colons.

For example, use the value #DEFAULT#;ABC-PRODUCTS;

to indicate that you want to exclude the default SQL Server instance and the instance named ABC-PRODUCTS from backup. 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 by creating 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/value pair EXCLUDE <database>. If both variables are used they augment each other to determine which databases to exclude.

Document info
Document views593
Page views593
Page last viewedTue Jan 17 07:56:35 UTC 2017
Pages200
Paragraphs4189
Words49499

Comments