backup types in sql server

Following are the Backup types in SQL Server 2008:

    Full backup
    Differential backup
    Partial backup
    Differential partial backup
    File backup
    Differential file backups
    Transaction Log Backups
    Copy-Only Backups

More details here

Identify SQL Server Database Backup Version

table.hovertable {
font-family: verdana,arial,sans-serif;
font-size:11px;
color:#333333;
border-width: 1px;
border-color: #999999;
border-collapse: collapse;
}
table.hovertable th {
background-color:#c3dde0;
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #a9c6c9;
}
table.hovertable tr {
background-color:#d4e3e5;
}
table.hovertable td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #a9c6c9;
}

How to Identify SQL Server Database Backup Version.

Following is the query:
[sql]
RESTORE HEADERONLY FROM DISK=’C:\DatabaseBackups\DatabaseBackup.bak’
[/sql]

Specify the correct path of the backup file.

When this query is executed read the values of the columns SoftwareVersionMajor,SoftwareVersionMinor and SoftwareVersionBuild.

The version of the SQL Server backup can be found by concatinating the values in three columns.
version of backup = SoftwareVersionMajor.SoftwareVersionMinor.SoftwareVersionBuild

If the output is
SoftwareVersionMajor = 10
SoftwareVersionMinor = 50
SoftwareVersionBuild = 2500

Then the version of database backup is 10.50.2500

SoftwareVersionMajor also gives an idea of the major version of SQL Server.
It helps to determine if the database backup is of SQL Server 2005 or SQL Server 2008.

Identify Database Backup Version
SoftwareVersionMajor = 9 backup is of SQL Server 2005
SoftwareVersionMajor = 8 backup is of SQL Server 2000
SoftwareVersionMajor = 10 and SoftwareVersionMinor = 0 backup is of SQL Server 2008
SoftwareVersionMajor = 10 and SoftwareVersionMinor = 50 backup is of SQL Server 2008 R2

Related posts:
Verify SQL Server Database Backup
restore higher version database backup on lower version sql server – restore problem
The media family on device is incorrectly formed. SQL Server cannot process this media family Error: 3241

Verify SQL Server Database Backup

Today I wanted to share on this blog a simple but yet very powerfull SQL Server command RESTORE VERIFYONLY.

Syntax:
[sql]
RESTORE VERIFYONLY FROM DISK = ‘<<location of database backup>>’
[/sql]

This command can be used to check weather your database backup is corrupted.

In order to explain this, I have taken backup of one of my database.
I also made another copy of database backup and I intentionally corrupted it.

DatabaseBackup.BAK is the perfect database backup.
DatabaseBackupCorrupted.BAK is the corrupted database backup.

So First I issued RESTORE VERIFYONLY command on the perferct database backup.
Following is the Query:
[sql]
RESTORE VERIFYONLY FROM DISK = ‘C:\DatabaseBackups\DatabaseBackup.BAK’
[/sql]

Output:
The backup set on file 1 is valid.

There were no errors and this made me confirm that the database backup is perfect.

Now I issued the same command on the corrupted database backup.
[sql]
RESTORE VERIFYONLY FROM DISK = ‘C:\DatabaseBackups\DatabaseBackupCorrupted.BAK’
[/sql]

As we expect the command errored out with the following error.

Output:

Msg 3242, Level 16, State 2, Line 1
The file on device ‘C:\DatabaseBackups\DatabaseBackupCorrupted.BAK’ is not a valid Microsoft Tape Format backup set.
Msg 3013, Level 16, State 1, Line 1
VERIFY DATABASE is terminating abnormally.

There this error output confirms me that the database backup is corrupted.

When ever restoration of a database backup is failing we can use the RESTORE VERIFYONLY command on the back up set and verify it.

Note:
You get the error Operating system error 2(The system cannot find the file specified) when the file cannot be found on the file system. In order to fix it give the correct file name and file path.

Msg 3201, Level 16, State 2, Line 1 Cannot open backup device
‘C:\DatabaseBackups\DatabaseBackupCorrupted1.BAK’. Operating system error 2(The system cannot find the file specified.).
Msg 3013, Level 16, State 1, Line 1
VERIFY DATABASE is terminating abnormally.

I got the above error when I issued the following command:
[sql]
RESTORE VERIFYONLY FROM DISK = ‘C:\DatabaseBackup.BAK’
[/sql]
As the file C:\DatabaseBackup.BAK does not exists.

Hope this posts helps!!!

Related post:
The media family on device is incorrectly formed. SQL Server cannot process this media family Error: 3241

The media family on device is incorrectly formed. SQL Server cannot process this media family Error: 3241

When you try to restore a backup of the database you get the following error:


The media family on device ” is incorrectly formed. SQL Server cannot process this media family.
RESTORE HEADERONLY is terminating abnormally. (Microsoft SQL Server, Error: 3241)

This error occurs due to the following problems:

Fix:

  • If you feel backup could be corrupted take the backup again
  • If you are using FTP then use it in binary mode to copy the backup file into local drive
  • If the versions are different then update the SQL Server on the system into which the backup has to be restored
  • Verify the database backup to check what the issue is.
    Following post helps you verify your database backup: Verify SQL Server Database Backup
  • More about using restore verify only this option in SQL Server can be found here