{"id":3196,"date":"2015-12-04T04:26:50","date_gmt":"2015-12-04T09:26:50","guid":{"rendered":"https:\/\/academy.sqlbak.com\/?p=3196"},"modified":"2023-10-17T05:22:31","modified_gmt":"2023-10-17T09:22:31","slug":"partial-backup","status":"publish","type":"post","link":"https:\/\/academy.sqlbak.com\/partial-backup\/","title":{"rendered":"Partial Backup"},"content":{"rendered":"
The peculiarity\u00a0of partial backup is that it does not contain read-only filegroups. So it’s a good choice if your database has a read-only filegroup and there is no need to backup it all of the time. Though\u00a0all recovery models in SQL Server support partial backup, it\u00a0was primarily\u00a0designed for use under the simple recovery model as it makes backup of huge databases, containing one or\u00a0more read-only filegroups, more flexible.<\/p>\n
A\u00a0partial backup can be applied\u00a0both to\u00a0full or differential backups, though it is not applicable to transaction log backup. As far as differential partial backup is concerned,\u00a0only the data extents that have changed in the filegroups since the previous partial backup are recorded into it. Please note\u00a0that differential partial backups can be applied only with partial backups.<\/p>\n
Let’s consider the picture below to understand how\u00a0partial backup and differential partial backup work:<\/p>\n
<\/p>\n
Below I’ll explain what is shown in the picture. Take a huge database that uses a simple recovery model, where the full database backup was made at 12:00:<\/p>\n
BACKUP DATABASE<\/span>\u00a0your_database<\/em>\u00a0TO DISK<\/span>\u00a0= 'full.bak'<\/span><\/pre>\nBecause the size of the database is large, and it takes more time to make backup, a decision was made to create a partial database backup, which includes the primary filegroup and read-write secondary filegroup:<\/p>\n
BACKUP DATABASE<\/span>\u00a0your_database<\/em>\u00a0READ_WRITE_FILEGROUPS TO DISK<\/span>\u00a0= 'partial_backup_full.bak'<\/span><\/pre>\n<\/div>\n<\/div>\n<\/div>\nThis backup takes less time than a full database backup. Following that some changes were made in the primary filegroup and the read-write secondary filegroup. These changes were stored in the following differential partial backup that was created at 14:00:<\/p>\n
BACKUP DATABASE<\/span>\u00a0your_database <\/em>READ_WRITE_FILEGROUPS TO DISK<\/span> = 'partial_backup_diff.bak'<\/span> WITH DIFFERENTIAL<\/span><\/pre>\nNote that SQL Server Management Studio does not support partial backups.<\/p>\n
Here is another, more interesting case. Assume that the database was changed from read-only to read-write after a partial backup was made. In this case, perhaps, some secondary read-write filegroups will not be included in the partial backup, therefore, when the time comes to make a differential partial backup the following error occurs:<\/p>\n
Msg 233, Level 20, State 0, Line 2<\/span>\r\nA transport-level error has occurred when sending the request to the server.<\/span><\/pre>\nTo avoid\u00a0this error, make another partial backup before\u00a0a differential partial backup. Following this operation, the new\u00a0partial backup\u00a0will contain every read-write secondary filegroup.<\/p>\n
Restore Process<\/h3>\n
The commands for the database restore process from the example above should be executed in the following order:<\/code><\/p>\nRESTORE<\/span> DATABASE<\/span><\/span> your_database <\/em>FROM<\/span> DISK<\/span><\/span> = <\/span>'full.bak'<\/span>, <\/span>WITH<\/span> NORECOVERY<\/span><\/span><\/code> GO<\/span><\/code> \r\nRESTORE<\/span> DATABASE<\/span><\/span> your_dataabse <\/em>FROM<\/span> DISK<\/span><\/span> = <\/span><\/code>'partial_backup_full.bak', <\/span>WITH<\/span> NORECOVERY <\/span><\/span> GO <\/span>RESTORE<\/span> DATABASE<\/span><\/span> your_database<\/em> FROM<\/span> DISK<\/span><\/span> = <\/span>'partial_backup_diff.bak',<\/span> WITH<\/span> RECOVERY<\/span> <\/span> GO<\/span><\/pre>\n","protected":false},"excerpt":{"rendered":"The peculiarity\u00a0of partial backup is that it does not contain read-only filegroups. So it’s a good choice if your database has a read-only filegroup and there is no need to backup it all of the time. Though\u00a0all recovery models in SQL Server support partial backup, it\u00a0was primarily\u00a0designed for use under the simple recovery model as […]<\/p>\n","protected":false},"author":10,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[157],"tags":[],"yoast_head":"\n
Partial Backup - Sql Server Backup Academy<\/title>\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\n\t\n\t\n