SQL HyperBac - 5.4

SQL HyperBac

Worked examples: restoring a compressed or encrypted backup

Overview

These examples show you how to restore a database that was backed up using SQL HyperBac's compression or encryption. The examples use the compressed or encrypted "AdventureWorks" sample database from Worked examples: backing up with compression or encryption, but you can substitute any database of your own that has been compressed or encrypted by SQL HyperBac.

SQL HyperBac is very easy to use; you don't need to make substantial changes to your existing restore jobs to restore compressed or encrypted backup files. Provided the backup file extensions are registered with SQL HyperBac, decompression or decryption processing is applied automatically.

By default, SQL HyperBac automatically recognizes backup files on any path with the following extensions, and applies the processing shown:

Extension (applies to all paths)

Processing applied by SQL HyperBac

*.hbc

Compression (standard)

*.hbe

Encryption (AES-256)

*.hbc2

Compression (fast)

Note that fast compression uses less CPU resource, but also results in larger compressed files than SQL HyperBac's standard or ZIP-compatible compression.

If your system is I/O-bound (for example, while writing to disk) "fast" compression may actually take longer than the other compression options.

*.zip or *.rar

Compression (ZIP-compatible)

ZIP-compatible compression creates backup files that you can decompress using many popular 3rd-party tools (for example, WinZip or WinRAR).

Note that any tool you use for decompression must support ZIP64.

For restore jobs, SQL HyperBac will automatically decompress or decrypt the backup data as appropriate.

You can add, modify, and delete extensions and associated processing options using HyperBac Configuration Manager. For example, you might choose to create a new ".bak" extension to use SQL HyperBac with your existing backup jobs. See Working with file paths, extensions, and processing options for further information.

For these examples, we'll use the backup files that were created in Worked examples: backing up with compression or encryption.

Worked example: restoring a SQL HyperBac compressed backup file

First, consider the T-SQL command that was used to back up the "AdventureWorks" database using SQL HyperBac compression:

BACKUP DATABASE [AdventureWorks] TO DISK = 'D:\Backups\AdventureWorks_backup.hbc'

To restore a backup file that uses SQL HyperBac standard compression:

Simply run a RESTORE DATABASE command as you usually would:

RESTORE DATABASE [AdventureWorks] FROM DISK = 'D:\Backups\AdventureWorks_backup.hbc'

That's all you need to do. SQL HyperBac will automatically decompress the backup data during the restore operation.

Exactly the same applies when restoring backup files that use SQL HyperBac fast compression or ZIP-compatible compression. Just use one of the following RESTORE DATABASE commands, and SQL HyperBac will automatically decompress the backup data during the restore operation:

RESTORE DATABASE [AdventureWorks] FROM DISK = 'D:\Backups\AdventureWorks_backup.hbc2'

or,

RESTORE DATABASE [AdventureWorks] FROM DISK = 'D:\Backups\AdventureWorks_backup.zip'

or,

RESTORE DATABASE [AdventureWorks] FROM DISK = 'D:\Backups\AdventureWorks_backup.rar'

Whether you run T-SQL statements from SQL Server Management Studio (either by explicitly typing the statement, or using the GUI options), using SQLCMD, or with any other tool, SQL HyperBac will automatically intercept the backup data, and decompress it.

Worked example: restoring a SQL HyperBac encrypted backup file

First, consider the T-SQL command that was used to back up the "AdventureWorks" database using SQL HyperBac encryption:

BACKUP DATABASE [AdventureWorks] TO DISK = 'D:\Backups\AdventureWorks_backup.hbe'

To restore a backup file that uses SQL HyperBac AES-256 encryption:

Simply run a RESTORE DATABASE command as you usually would:

RESTORE DATABASE [AdventureWorks] FROM DISK = 'D:\Backups\AdventureWorks_backup.hbe'

That's all you need to do. SQL HyperBac will automatically decrypt the backup data during the restore operation.

Note that the key file that was used to encrypt the backup data must be available to SQL HyperBac on the system you are restoring to. By default, SQL HyperBac looks for key files in "C:\Program Files\Red Gate\HyperBac\keys".

Read Managing key files for encrypted backups for important information about managing and backing up key files.

See also

Working with file paths, extensions, and processing options

Technical overview

Managing key files for encrypted backups

Worked examples: backing up with compression or encryption

Was this article helpful?

Search support
Forums
Visit the SQL HyperBac forum.