Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server 2012: Backup restore from a compressed backup

I am trying to restore a database from the backup (.bak) file which is [saved] inside a ZIP file, but not been successful so far. However, I am able to restore it after extracting from the ZIP file.

This MS page says every edition of SQL Server 2008 and later can restore a compressed backup with the following restrictions.

Restrictions: The following restrictions apply to compressed backups:

  1. Compressed and uncompressed backups cannot co-exist in a media set.
  2. Previous versions of SQL Server cannot read compressed backups.
  3. NTbackups cannot share a tape with compressed SQL Server backups.

I do not clearly understand the first restriction. Could someone please clarify/elaborate this?

I have done the following steps:

  1. Taken a backup on a staging SQL Server [MyTestDB.bak]; Compressed it (by Right Click > Send To - Compressed(zipped) folder); Now, named it as MyTestDB.ZIP

  2. FTP'd the ZIP file to local development SQL Server and trying to restore it from the ZIP file. But the database name is not available to backup.

Both SQL Server versions are exactly same.

SQL Servers Version: Microsoft SQL Server 2012 - 11.0.5058.0 (X64)-Standard Edition (64-bit)

When tried to restore from ZIP file

Would the usage of term 'compressed backup' for the backup files saved inside ZIP files is correct or Is this need to be backed up in a different way so it can be called as a compressed backup?

  1. However, if I select the .bak file after extracting it from the ZIP file it all works fine.

When tried to restore from .bak file

I am not sure where I am going wrong? I can simply extract the backup and restore it without any problem, but would like to know the cause why it is not working, as it would have been a much better solution to just back up it from the ZIP itself.

like image 583
Sathish Avatar asked Feb 13 '15 16:02

Sathish


People also ask

How do I restore a SQL Server database from a zip file?

Import compressed file data into SQL Server. We want to load data from ZIP file into SQL Server table, therefore, add a Data Flow Task and connect it with the File Unzip Task. Rename Data Flow Task to Import Excel into SQL Server. Double click on the Import Excel into SQL Server.

Which SQL Server supports restoring compressed backups?

Every edition of SQL Server 2008 and later can restore a compressed backup.

Does SQL Server 2012 Standard Edition support backup compression?

Nope. SQL Server 2012 doesn't support compressed backups in Web Edition (for example).


1 Answers

Backup compression is something different.

You specify this when you configure or start the backup and you then get a backup file that contains compressed data, as opposed to it containing uncompressed data if you don't enable compression.

SQL Server is not able to use a zip file, while the backup file is certainly compressed, it is not a "compressed backup" that this refers to.

So yes, you need to extract the backup file before restoring from it.

If you want to learn how to make compressed backups correctly, check out this page full of links to related material:

  • Configure Backup Compression
like image 80
Lasse V. Karlsen Avatar answered Oct 16 '22 10:10

Lasse V. Karlsen