Options

Wrong tag translation

BokaBoka Posts: 32 Silver 3
edited December 20, 2019 8:21AM in SQL Backup
File location tags in backup command looks like this:
 TO DISK = '\\SomeServer\ShareName\<CLUSTER>\<SERVER>\SystemDB\<AUTO>.sqb' 
SQL Backup does wrong translation and <CLUSTER> tag is replaced with server name instead of cluster name. Log file confirm that backup is done at:
\\SomeServer\ShareName\ServerName\ServerName\...
On the same server, second backup job written like:
 TO DISK = '\\SomeServer\ShareName\<CLUSTER>\<AVAILABILITYGROUP>\...
is working fine!

First job is used to backup system databases and the second one for user databases that are in AG.

Environment:
Windows Server 2016, Cluster with 2 nodes
SQL Backup 10

Any idea how to solve this?

Tagged:

Best Answer

  • Options
    petey2petey2 Posts: 87 Silver 3
    It is by design that the <CLUSTER> tag returns the server name if the database that is being backed up does not belong to an availability group.  E.g. say for the msdb database (not part of an availability group) for both instances, it would be confusing if the backups of that database from both instances have the same name but are contextually different.  

    While for availability groups, the databases are usually identical, and also users would have a preferred backup node, so it would make sense that the naming convention (using the <CLUSTER> tag) is identical from whichever node the backup is taken from.

    If you really want to use the cluster name as part of the file name, one option would be to hardcode the value in the naming convention instead of using the <CLUSTER> tag.
    SQL Backup - beyond compression

Answers

  • Options
    BokaBoka Posts: 32 Silver 3
    Hi Petey,

    My idea was to create simple tree structure per cluster like this:

    └─ Cluster_1
        ├─ AG_1
        ├─ AG_2
        ├─ ...
        ├─ AG_n
        ├─ Node_1 
        ├─ Node_2
        ├─ ...
        └─ Node_n 

    where in AG_x folders we will backup databases that belong to AG. And in Node_x folders databases like system db.
    Accepting your answer I will hardcode this part of the file name.
    Thanks.
Sign In or Register to comment.