Support Center

About: Inline Tokens

Last Updated: Sep 29, 2017 05:14PM CDT
Minion’s Inline Tokens allow you use defined patterns to use and create dynamic names and paths. These tokens are stored in the Minion.DBMaintInlineTokens table.

For example, MB comes with the predefined tokens “Server” and “DBName”. To create a dynamic backup path for all backups, we update the path table:
​ UPDATE Minion.BackupSettingsPath
 SET    BackupPath = 'SQLBackups\%Server%\%DBName%\';
 
From then on, the backup path on “YourServer” for database “DB1” will be created as “…\SQLBackups\YourServer\DB1\”.

MB recognizes %Server% and %DBName% as Inline Tokens, and refers to the Minion.DBMaintInlineTokens table for the definition.
 

Create and use a custom Inline Token

To create a custom token, insert a new row to the Minion.DBMaintInlineToken table. Guidelines:
  • DynamicName: Use a unique DynamicName.
  • ParseMethod: For tokens that use date in some way, we recommmend using @ExecutionDateTime instead of GetDate or other system date methods.
  • IsCustom: Mark IsCustom = 1.
  • Definition: Provide a descriptive definition, for the use of you and your DBA team.

For example, we can use the following statement to create an Inline Token to represent the full day name (like Monday, etc.):
INSERT  INTO Minion.DBMaintInlineTokens
        ( DynamicName
        , ParseMethod
        , IsCustom
        , Definition
        , IsActive
        )
VALUES  ( 'DayNameFull'
        , 'DATENAME(dw, @ExecutionDateTime)'
        , 1
        , 'Returns the full name of the current day (e.g. Monday, Tuesday, etc.).'
        , 1
        );
 
IMPORTANT: The syntax for using this custom Inline Token is “|DayNameFull|”. Notice that default tokens (like Server) use percent signs (“%Server%”), while custom tokens use pipe delimiters (“|DayNameFull|”).

You can now use this custom token in fields that accept them. See the following section for more information.

Fields that accept Inline Tokens

You can use Inline Tokens in specific fields, in specific tables.

Minion.BackupSettingsPath:
  • BackupPath
  • FileName
  • FileExtension 

Note that Inline Tokens reference the Minion.BackupSettingsPath field ServerLabel, but ServerLabel may not itself contain an Inline Token. (The dynamic part ‘SoSL’ will use the server label if one exists, or the server name if it doesn’t.)

Minion.BackupRestoreSettingsPath:
  • RestorePath*
  • RestoreFileName
  • RestoreFileExtension
  • RestoreDBName

*IMPORTANT: Minion Backup’s restore functionality cannot yet create folders; the restore module only creates T-SQL statements for you to run manually on the target system. We recommend that you either set RestorePath to a static value (e.g., “SQLData\”), or use a rarely-changing Inline Token and create all the folders in advance (e.g., “SQLData\%Year%” and create SQLData\2017\, SQLData\2018\, etc.).
In Minion CheckDB, the table Minion.CheckDBSettingsDB:
  • PreferredDBName
  • RemoteJobName

Custom Inline Tokens

We do have a few guidelines for creating your own tokens:
  • Naming DynamicName: We recommend you do not include any special symbols – only alphanumeric characters. We also recommend against using the underscore symbol.
  • Defining ParseMethod: To be consistent and avoid anomalies, use @ExecutionDateTime instead of GetDate() (or SYSDATETIME(), or CURRENT_TIMESTAMP, or any of the others).
  • Uniqueness: Be aware that there is a unique constraint on DynamicName and IsActive; so you can only have one active “Date”, and one inactive “Date” (as an example).
  • IsCustom: Set IsCustom = 1 for your custom dynamic names.

IMPORTANT: Custom inline tokens must be surrounded by pipes, not percent signs.

Inline Token Internals

The shorthand for this section looks like this: Tokens in settings tables -> MB stored procedures -> Minion.DBMaintInlineTokenParse stored procedure -> Minion.DBMaintInlineTokens table.

Multiple tables have fields that accept Inline Tokens. As a part of normal (or manual) backup operations, stored procedures in the following list must access these fields and have the tokens translated:
  • Minion.BackupDB
  • Minion.BackupFileAction
  • Minion.BackupRestoreDB
  • Minion.BackupRestoreMoveLocationsGet
  • Minion.BackupStmtGet

Each of these uses the stored procedure Minion.DBMaintInlineTokenParse to parse the token into its value. The DBMaintInlineTokenParse, of course, gets the token definition from the table Minion.DBMaintInlineTokens. 
 
556ca399015f31edc97a62de2771be1a@minionware.desk-mail.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete