Home > Ask the SQL Server Experts > Adam Machanic - SQL Server 2005 Questions & Answers > Database Snapshots: Creating read-only copies of a database
Ask The SQL Server Expert: Questions & Answers
EMAIL THIS

Database Snapshots: Creating read-only copies of a database

Adam Machanic EXPERT RESPONSE FROM: Adam Machanic

Pose a Question
Other SQL Server Categories
Meet all SQL Server Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 25 July 2006
I'm interested in using SQL Server 2005's Database Snapshot feature offered by the Enterprise Edition. I want to create a read-only copy of a database at a point-in-time for reporting purposes. I've read that for unchanged data, reads are transparently redirected to the primary database and for changed data the reads hit a sparse file.
My question is related to locking. One of the primary reasons we want to have a separate database for read-only reporting is that we do not want reads to be going directly against our production database. When reading unchanged data from a snapshot, are read locks placed on the primary database? If so, are these locks the same as the locks placed if I had directly read from the primary database? If the locking is the same for unchanged data, using snapshots in my eyes may result in similar locking issues. If this is the case, the feature has lost some of its luster.

>
EXPERT RESPONSE
When querying a database snapshot, there are no locks taken in the source database. It is quite easy to test this in order to verify. First, create a snapshot of a large database on your system. Next, run a complex and time-consuming query against the snapshot -- the kind of query that you definitely do not want holding locks! While the query is running, you can monitor locking using the sp_lock system stored procedure. You should notice that locks are taken in the snapshot database, but not in the source database.


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
SQL Server replication
SQL Server replication methods: Snapshot, merge or transactional
Licensing a standby server for SQL Server replication
Upgrade live applications to SQL Server 2005 for high availability
Tool to synchronize two SQL Server databases
Synchronize databases on two separate active servers
SQL Server Blog Watch
Simplify SQL Server replication
Replication techniques in SQL Server
Podcast: SQL Server high availability options
Managing identity columns with replication in SQL Server

Adam Machanic - SQL Server 2005
Stored procedure concurrency problems in SQL Server 2005
SQL vs. T-SQL
Determining number of servers needed for large member site
Upgrading SQL Servers
SQL Server 2005 Enterprise Edition vs. Standard Edition
Encryption failures when upgrading to SQL Server 2005
Upgrading to SQL Server 2005 while maintaining .adp access
Modifying a query to show navigation path
Viewing SQL Server 2005 data via Windows Forms
SQL Server 2005 upgrade issues

RELATED GLOSSARY TERMS
Terms from Whatis.com − the technology online dictionary
replication  (SearchSQLServer.com)

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



SQL Solutions - SQL Database Design
HomeNewsTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersIT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides enterprise IT professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective IT purchase decisions and managing their organizations' IT projects - with its network of technology-specific Web sites, events and magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




All Rights Reserved, Copyright 2005 - 2008, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts