SQL Virtual Restore - 2.4
Working with key files for encrypted backups - SQL Virtual Restore
SQL Virtual Restore works with encrypted backup files created by SQL HyperBac and SQL Backup (version 6.0 and above). These encrypted backup file formats are handled differently by SQL Virtual Restore.
About SQL HyperBac encryption and key files
When SQL Virtual Restore detects a request from a SQL Server instance to read from or write to a SQL HyperBac encrypted backup file or data file, it will first check the 'keys' directory on the SQL Server (located at 'C:\Program Files\Red Gate\HyperBac\keys' by default) to look for a valid key file:
- If SQL Virtual Restore finds a key file, it uses this key file to encrypt and decrypt the data as it passes through the Windows file system
- If a key file does not exist, or the wrong key file is present, the SQL Server instance will report an error accessing the associated backup files or data files.
You can think of the key file as equivalent to a password for accessing the encrypted backup data. If you lose the key file associated with a SQL HyperBac encrypted backup, the original backup data cannot be recovered, or used to virtually restore the database.
About SQL Backup encryption and passwords
When you virtually restore a database from encrypted SQL Backup backup files, SQL Virtual Restore uses an extended stored procedure ('xp_validate_sqb_backup') to associate the backup files with a password that you provide.
If you use the SQL Virtual Restore Wizard to create your virtual database, you will be given the option to allow the wizard to install or upgrade the stored procedure for you, and then to enter the password that was used to encrypt your backup file:

If you use native T-SQL commands to script the creation of your virtual database, you may first have to manually install or upgrade the 'xp_validate_sql_backup' stored procedure.
Manually installing or upgrading the 'xp_validate_sql_backup' stored procedure
- Check whether an earlier version of 'xp_validate_sql_backup' is already installed on your SQL Server instance.
You can do this using the Object Explorer in SQL Server Management Studio, by browsing to the Databases > System Databases > master > Programmability > Extended Stored Procedures folder.

- If the 'xp-validate_sql_backup' stored procedure is listed, delete it. If the stored procedure isn't listed, go to step 4.
- Run the following command to unload the stored procedure DLL from memory:
DBCC xpHyperBac (FREE); - In Windows Explorer, browse to the Red Gate HyperBac installation directory (for example, C:\Program Files\Red Gate\HyperBac\bin), and find the 'xpHyperBac.dll' file.
Copy this file to the installation directory of your SQL Server instance (for example C:\Program Files\Microsoft SQL Server\MSSQL10\MSSQL\Binn, for SQL Server 2008).
- Run the following command to install the new stored procedure :
EXEC dbo.sp_addextendedproc N'xp_validate_sqb_backup', '<path to DLL>';where <path to DLL> is the location of the 'xpHyperBac.dll' file that you copied in step 4.
The stored procedure is now installed on your SQL Server instance
Using the 'xp_validate_sql_backup' stored procedure
Once you have installed the 'xp_validate_sql_backup' stored procedure on your SQL Server instance, you can use it in scripts to associate a password with each encrypted SQL Backup backup file you want to use with SQL Virtual Restore:
EXEC master..xp_validate_sqb_backup
@filename = 'C:\MSSQL\Backup\encrypted_sql_backup_file.sqb',
@password = 'PASSWORD';
Was this article helpful?
SQL Virtual Restore
- Upgrading the HyperBac engine components
- SQL Virtual Restore Error Checking Service Configuration - VirtualDiskSize setting required
all SQL products
- Compatibility of Red Gate tools in 64-bit environments
- Application has encountered an error and needs to close
- Error message after installing SQL Toolbelt - The description for Event ID ( 1 ) in Source ( nview_info ) cannot be found.
- Changing the temporary directory used by the installer
- Toolbelt Installer "hanging" while "scanning volumes"
- Login failing with "trusted SQL Server connection" error when using RunAs
all products
- Some Red Gate products identified as containing a trojan by Anti-Virus software
- Activation may fail with Unknown Error -1
- Product uses web help although a CHM file is available locally
- Argument exception resulting from missing environment variable
- Check for updates may fail when used through proxies
- 'Unidentified Publisher' error when repairing or uninstalling
- Licensing activates product as standard edition
- Moving Red Gate software products to another machine
- Red Gate tools log locations
- The application UI opening slowly when there is no internet access
SQL Virtual Restore
all SQL products
all products
- Red Gate product acknowledgements
- Activating your products
- Activating your products
- Red Gate bundle history
- Check for updates
- Troubleshooting Check for Updates errors
- Current versions
- Deactivating your products
- Installing Red Gate products from the .msi file
- Requesting additional activations
- Serial numbers for bundles
- Reactivating using a different serial number
- Extending your trial
- Finding your serial numbers
- Moving a serial number from one computer to another
- No response received for manual activation
- Licensing and activation resources
- Licensing and activation resources
- Troubleshooting licensing and activation errors
- Licensing and activation FAQs
- Red Gate tools log file locations
- Download old versions of products
- Download product prerequisites & utilities
- Support & upgrades
- Upgrading your software
- Upgrading FAQs

Using SQL Virtual Restore