tailieunhanh - SQL Server MVP Deep Dives- P13

SQL Server MVP Deep Dives- P13: Each year Microsoft invites all the MVPs from every technology and country to Redmond for an MVP Summit—all top secret—“don’t tweet what you see!” During the MVP Summit, each product team holds a series of presentations where they explain their technologies, share their vision, and listen to some honest feedback. | 436 Chapter 33 Efficient backups without indexes CREATE NONCLUSTERED INDEX ncix_Table1 ON Col1 WITH DROP_EXISTING -- ONLINE ON ON NCIX_FG The DROP_EXISTING option causes the newly created index to be created as the replacement of the existing index without needing to explicitly drop the existing index which could damage query performance for queries that might be in flight while the index is dropped . The ONLINE option can be used to further reduce concurrency impact with SQL Server 2005 or 2008 Enterprise Edition. The ON NCIX_FG clause is the main focus of our attention in this statement which defines the new location for the nonclustered index. Backing up only the PRIMARY filegroup Now that we ve successfully separated our nonclustered indexes one only from the PRIMARY filegroup into a separate filegroup it s now possible to perform a tables-only filegroup backup. Instead of issuing a standard BACKUP DATABASE command add a filegroup specification to back up only the PRIMARY filegroup. For example BACKUP DATABASE BackupTest FILEGROUP PRIMARY TO DISK E SQL Server will then perform a filegroup backup of the PRIMARY filegroup only without copying any contents from the newly created NCIX_FG to the backup set. NOTE Although no data is backed up from NCIX_FG the backup still contains definitions of nonclustered indexes because index metadata information is stored in system tables which are located in the PRIMARY filegroup and so on . This means that we can recreate the nonclustered indexes in the restore process from their definitions even though we don t have their allocated data structures in our backup file. Restoring the PRIMARY filegroup backup The process required to restore the database from the PRIMARY filegroup backup differs depending on whether you re restoring only to perform data extraction purposes re-creation of indexes not required or whether you intend to bring the database fully online .