Skip to content

Latest commit

 

History

History
64 lines (43 loc) · 3.46 KB

File metadata and controls

64 lines (43 loc) · 3.46 KB
title Piecemeal restore: simple recovery model
description This example shows a piecemeal restore in SQL Server of a database to a new computer using the simple recovery model.
author MashaMSFT
ms.author mathoma
ms.date 12/17/2019
ms.service sql
ms.subservice backup-restore
ms.topic how-to
helpviewer_keywords
piecemeal restores [SQL Server], simple recovery model
restore sequences [SQL Server], piecemeal
simple recovery model [SQL Server], RESTORE examples

Example: Piecemeal Restore of Database (Simple Recovery Model)

[!INCLUDE SQL Server]

A piecemeal restore sequence restores and recovers a database in stages at the filegroup level, starting with the primary and all read/write, secondary filegroups.

In this example, database adb is restored to a new computer after a disaster. The database is using the simple recovery model. Before the disaster, all the filegroups are online. Filegroups A and C are read/write, and filegroup B is read-only. Filegroup B became read-only before the most recent partial backup, which contains the primary filegroup and the read/write secondary filegroups, A and C. After filegroup B became read-only, a separate file backup of filegroup B was taken.

Restore Sequences

  1. Partial restore of the primary and filegroups A and C.

    RESTORE DATABASE adb FILEGROUP='A',FILEGROUP='C'   
       FROM partial_backup   
       WITH PARTIAL, RECOVERY;  
    
    

    At this point, the primary and filegroups A and C are online. All files in filegroup B are recovery pending, and the filegroup is offline.

  2. Online restore of filegroup B.

    RESTORE DATABASE adb FILEGROUP='B' FROM backup WITH RECOVERY;  
    
    

    All filegroups are now online.

Additional Examples

See Also

Online Restore (SQL Server)
BACKUP (Transact-SQL)
RESTORE (Transact-SQL)
Piecemeal Restores (SQL Server)