Creating batch files for the policy that protects the preferred replica
This topic describes how to create batch files for the backup policies that protect the availability group (AG). These batch files also use the PREFERREDREPLICA keyword so that NetBackup protects the SQL Server preferred replica.
To create the batch files for an AG, you must log on to each node separately. Then use the NetBackup MS SQL Client to create the batch files on each node.
To create batch files for the policy that protects the preferred replica
- This procedure assumes that you already created a separate policy for each type of backup that you want to perform.
- Perform steps 3 to 14 in this procedure on each node in the AG.
You must log on to each node separately and create the batch files from that node. This way the batch files have the correct settings for each node. Backups may fail if you create a batch file on one node and copy it to the other nodes in the AG.
- Log on to one of the nodes in the AG.
- Open the NetBackup MS SQL Client.
- Select File > Set SQL Server connection properties.
- From the Instance drop-down list, select the instance that hosts the AG.
- Select File > Backup SQL Server objects.
- Select the objects you want to backup in one of the following ways:
Select one or more databases, filegroups, or files.
To back up all databases, including the system databases (DATABASE $ALL), select the instance. From the Back up group, select All.
- Select the Type of Backup and any other settings.
- In the NetBackup Policy field, enter the name of the MS-SQL Server policy that you created.
- From the Backup script group, select Save.
- Click Backup and open the batch file.
- For each operation in the batch file, add the keyword PREFERREDREPLICA TRUE.
This keyword instructs NetBackup to perform the backup only on the preferred replica and not all the nodes in the AG.
- Save and close the batch file.
Note the location of the batch file. Save the batch file for each node to the same file location. This way you only need to enter one file location for the batch file in the Backup Selections list.
- Repeat steps 7 to 14 for any other types of backups that you want to perform. For example, full, full differential, or transaction log.
More information is available on how to create batch files.
- Repeat the steps in this procedure (steps 3 to 15) to create batch files for the other AG nodes.
- When you have created batch files for all the nodes in the AG, add the batch files to the policies that you created previously.
See Adding the batch files to the policy that protects the preferred replica.