638
Part V: Enterprise Data Management
read-only database. After you create a snapshot, it can be queried the same way as regular
databases. You cannot perform updates, inserts, or deletions on the data or make schema
changes (adding or removing tables and columns).
You can use snapshots to revert a database to a specific point in time using similar syntax
to what you would use to RESTORE the database from a database backup.
The following sections describe database snapshot operations in more detail.
Creating a Database Snapshot
You can create database snapshots only using the Transact-SQL command
CREATE DATABASE <. ..> ON <. ..> AS SNAPSHOT OF <. ..>.
SQL Server Management Studio does not have any graphical interface to create database snapshots. You must use
Transact-SQL.
Following are the step-by-step instructions to create a database snapshot of the
AdventureWorks2012 sample database:
- Find the information about the files in the source database. Use the following com-
mand to find the information about the files in the AdventureWorks2012 database.
USE AdventureWorks2012;
GO
EXECUTE sp_helpfile;
GO
The results of this query are shown in Figure 24-2.
FIGURE 24-2
Database fi le information.
The logical name of the data files appears under the name column and their current
file size under the size column. The preceding example has only one data file with
the logical name AdventureWorks2012_Data and size 188160KB (or 183MB).
c24.indd 638c24.indd 638 7/31/2012 9:25:48 AM7/31/2012 9:25:48 AM
http://www.it-ebooks.info