Database Reference
In-Depth Information
Listing 30-22.
Partial backup: Piecemeal restore of read-write filegroups
RESTORE DATABASE [OrderEntryDB]
FILEGROUP='Primary',FILEGROUP='Entities',FILEGROUP='OperationalData'
FROM DISK = N'V:\OrderEntryDB-rw.bak' WITH FILE = 1,
MOVE N'OrderEntryDB' TO N'M:\OrderEntryDB.mdf',
MOVE N'OrderEntryDB_Entities' TO N'N:\OrderEntryDB_Entities.ndf',
MOVE N'OrderEntryDB_Operational' TO N'N:\OrderEntryDB_Operational.ndf',
MOVE N'OrderEntryDB_log' TO N'L:\OrderEntryDB_log.ldf',
NORECOVERY, PARTIAL, STATS = 5;
RESTORE DATABASE [OrderEntryDB]
FROM DISK = N'V:\OrderEntryDB-rw.bak' WITH FILE = 1,
NORECOVERY, STATS = 5;
RESTORE LOG [OrderEntryDB]
FROM DISK = N'V:\OrderEntryDB.trn'
WITH FILE = 1, NORECOVERY, STATS = 5;
RESTORE DATABASE [OrderEntryDB] WITH RECOVERY;
Now the
Primary
,
Entities,
and
OperationData
filegroups are online and the
HistoricalData
filegroup is in
RECOVERY_PENDING
state, as shown in Figure
30-9
.
Figure 30-9.
Partial backup: Data files state after piecemeal restore of read-write filegroups
You can bring the
HistoricalData
filegroup online by performing a restore of the original filegroup backup file,
as shown in Listing 30-23.
Listing 30-23.
Partial backup: Read-only filegroup restore
RESTORE DATABASE [OrderEntryDB]
FILEGROUP='HistoricalData'
FROM DISK = N'V:\OrderEntryDB-hd.bak' WITH FILE = 1,
MOVE N'OrderEntryDB_Historical' TO N'S:\OrderEntryDB_Historical.ndf',
RECOVERY, STATS = 5;
Backup to Windows Azure
You can perform a database backup and store the backup files in the Windows Azure Blob Storage. There are two
different ways to implement this:
1.
In SQL Server 2012 SP1 CU2 and above, you can backup directly to or restore from Azure
Blob Storage by specifying the URL location as part of the
BACKUP
and
RESTORE
commands.
Listing 30-24 shows an example of this process.