By default, restoring a backup returns files to their original directory. This is due to the fact that file paths are included as part of the filenames in the transaction logs.
To change this default behavior, it is possible to “redirect” the destination of files during a dynamic dump restore.
The dynamic dump script used during restore may contain one or more of the following redirection directives:
!REDIRECT <old path> <new path>
Note: To specify an empty string for one of the !REDIRECT arguments use a pair of double quotes (‘’).
The !REDIRECT keyword substitutes the <new path> for <old path> when found for all file that are restored. !REDIRECT should not be used with a destination path per se, but rather with a find and replace pattern that is used to modify paths from the !FILES lines to produce new paths to restore to.
This is often necessary when the restored directory is no longer the same as the original file environment. Consider the case of moving files from one server to another with a slightly different directory structure, notably the case in Windows with a different drive identifier, for example C: to D:. It is also useful for developers to obtain a live “snapshot” of a customer’s database and restore it to an alternative destination for testing, debugging or other purposes.
Keep in mind that FairCom DB SQL includes relative paths as part of the filename as referenced in the transaction logs making this necessary when moving date between FairCom DB SQL database directories.
If you find that files are missing after a restore operation, you should retry the restore with the !REDIRECT directive in place to a known good directory location.
The following directives cause files that were backed up using absolute names to be restored into the directory temp (relative to the current directory during restore) and files that were backed up from the directory local (relative to the server working directory) to be restored into the absolute directory \temp\local:
!REDIRECT \ temp\
!REDIRECT local\ \temp\local\
The following will add temp\ to the path name of all restored files:
!REDIRECT " " temp\
The following will strip d: from any restored files starting with d: (or D:):
!REDIRECT d: ""
The following redirects files from one volume mount to another.
Given original files defined as this:
!REDIRECT /mnt/data01/ /mnt/data02/
Note: The !REDIRECT keyword only affects the restore operation and is ignored when the script is used for the backup process.