Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

MSSQLFUN

I, Rohit Garg, am working as Consultant in IT Company. I am having an around 5 years of experience in MSSQL server & other Microsoft technologies. I am working as DBA in Microsoft SQL Server from last 5 years in e-Commerce, Telecom, Finance domain. In this tenure, I got a chance of working as Database administrator, Developer and trainer on SQL server 2000 to SQL Server 2012. I am holding Master’s degree in Computer Science along with certification in SQL Server & .Net. I like to learn new things by hand-on experience on regular basis. This journey is so far is delightful & valuable with the addition of wonderful friends.

SQL Server || Compress & UnComprees Backups in one Media\File

Today, We try to check of SQL server when trying to take Compress & UnCcomprees Backups in one Media\File.

Query No. 1

BACKUP DATABASE DB2

TO DISK = ‘D:\DB2_FULL.BAK’ WITH COMPRESSION

GO

BACKUP DATABASE DB2

TO DISK = ‘D:\DB2_FULL.BAK’ WITH NOINIT

Result : Run Successfully

Explanation : Backup file is formatted to take compressed backup. So without mention COMPRESSION keyword. SQL server process this backup request as COMPRESSED backup.

Query No. 2

BACKUP DATABASE DB2

TO DISK = ‘D:\DB2_FULL2.BAK’ WITH COMPRESSION

GO

BACKUP DATABASE DB2

TO DISK = ‘D:\DB2_FULL2.BAK’ WITH INIT

Result : Run Successfully

Explanation : Backup set is overwritten but file header is intact. Due to which without mention COMPRESSION keyword, SQL server process this backup request as COMPRESSED backup.

Query No. 3

BACKUP DATABASE DB2

TO DISK = ‘D:\DB2_FULL3.BAK’

GO

BACKUP DATABASE DB2

TO DISK = ‘D:\DB2_FULL3.BAK’ WITH INIT,COMPRESSION

Result : Failed

Msg 3098, Level 16, State 2, Line 1

The backup cannot be performed because ‘COMPRESSION’ was requested after the media was formatted with an incompatible structure. To append to this media set, either omit ‘COMPRESSION’ or specify ‘NO_COMPRESSION’. Alternatively, you can create a new media set by using WITH FORMAT in your BACKUP statement. If you use WITH FORMAT on an existing media set, all its backup sets will be overwritten.

Msg 3013, Level 16, State 1, Line 1

BACKUP DATABASE is terminating abnormally.

Explanation : Backup file is formatted to take Uncompressed backup but backup is mention to take in compressed form.

Query No. 4

BACKUP DATABASE DB2

TO DISK = ‘D:\DB2_FULL4.BAK’

GO

BACKUP DATABASE DB2

TO DISK = ‘D:\DB2_FULL4.BAK’ WITH NOINIT,COMPRESSION

Result : Failed

Msg 3098, Level 16, State 2, Line 1

The backup cannot be performed because ‘COMPRESSION’ was requested after the media was formatted with an incompatible structure. To append to this media set, either omit ‘COMPRESSION’ or specify ‘NO_COMPRESSION’. Alternatively, you can create a new media set by using WITH FORMAT in your BACKUP statement. If you use WITH FORMAT on an existing media set, all its backup sets will be overwritten.

Msg 3013, Level 16, State 1, Line 1

BACKUP DATABASE is terminating abnormally.

Explanation : Backup set is overwritten but file header is intact. Due to COMPRESSION keyword, SQL server tried to process this backup request as COMPRESSED backup in Uncompressed file format & got failed.


Comments

Leave a comment on the original post [mssqlfun.com, opens in a new window]

Loading comments...