I created a full backup with SQL Server 2014 Management Studio. After that I removed it and created Differential backup, everything worked with no errors. How the server knows against what differential backup needs to be done if original full backup was removed?
SQL Server creates a differential backup bitmap in all databases.
This bitmap contains a bit for each extent (8 pages) in the database.
Upon completion of a full backup, SQL Server clears the contents of each bit in the bitmap.
When pages are written to (ie rows are updated, deleted, inserted, etc, etc), the differential bitmap is updated to reflect the modified pages.
When SQL Server takes a differential backup, it uses the differential backup bitmap to determine what pages need to be backed up.
If you delete the full backup upon which the differential backup is based, the differential backup becomes useless.
To prove this, you can use the following test-bed:
USE master; GO CREATE DATABASE [Test]; GO
Backup the database:
BACKUP DATABASE [Test] TO DISK = 'D:\SQLServer\Backups\Test_Full_Backup.bak' WITH FORMAT , INIT , SKIP , STATS = 1; GO
Add something to the database:
USE Test; GO CREATE TABLE dbo.SomeDDL ( ID INT NOT NULL ); GO
Take a differential backup:
USE master; GO BACKUP DATABASE [Test] TO DISK = 'D:\SQLServer\Backups\Test_Diff_Backup.bak' WITH DIFFERENTIAL , STATS = 1;
Delete the full backup (this requires xp_cmdshell to be enabled):
EXEC xp_cmdshell 'DEL D:\SQLServer\Backups\Test_Full_Backup.bak';
Attempt to restore the differential backup:
RESTORE DATABASE [test] FROM DISK = 'D:\SQLServer\Backups\Test_Diff_Backup.bak' WITH RECOVERY;
Several errors occur:
Msg 3117, Level 16, State 1, Line 9
The log or differential backup cannot be restored because no files are ready to rollforward.
Msg 3013, Level 16, State 1, Line 9
RESTORE DATABASE is terminating abnormally.
For details about how differential backups work, see this MSDN page.