{"id":545,"date":"2011-07-26T10:59:00","date_gmt":"2011-07-26T10:59:00","guid":{"rendered":"\/blogs\/paul\/post\/Using-database-snapshots.aspx"},"modified":"2017-04-13T11:41:17","modified_gmt":"2017-04-13T18:41:17","slug":"using-database-snapshots","status":"publish","type":"post","link":"https:\/\/www.sqlskills.com\/blogs\/paul\/using-database-snapshots\/","title":{"rendered":"Using database snapshots"},"content":{"rendered":"<p><span style=\"font-family: verdana, geneva; font-size: small;\">Three weeks ago I kicked off a survey about using database snapshots &#8211; see <\/span><a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/survey-do-you-use-database-snapshots\/\" target=\"_blank\"><span style=\"font-family: verdana, geneva; font-size: small;\">here<\/span><\/a><span style=\"font-family: verdana, geneva; font-size: small;\">\u00a0&#8211; because I don&#8217;t really know how much they&#8217;re used or not out in the wild. Here are the results:<\/span><\/p>\n<p><span style=\"font-family: verdana, geneva; font-size: small;\">\u00a0<img decoding=\"async\" src=\"\/blogs\/paul\/wp-content\/uploads\/2011\/7\/snapshots.jpg\" alt=\"\" \/> <\/span><\/p>\n<p><span style=\"font-family: verdana, geneva; font-size: small;\">The &#8220;Other&#8221; values are: <\/span><\/p>\n<ul>\n<li>\n<div><span style=\"font-family: verdana, geneva; font-size: small;\">13 x &#8220;No &#8211; not at the moment.&#8221; <\/span><\/div>\n<\/li>\n<li>\n<div><span style=\"font-family: verdana, geneva; font-size: small;\">10 x &#8220;In our test environment for reverting to the original database state after a test. Much faster than restoring every time.&#8221; <\/span><\/div>\n<\/li>\n<li>\n<div><span style=\"font-family: verdana, geneva; font-size: small;\">6 x &#8220;For development, to be able to go back to a previous known state after trying out new scripts and stuff.&#8221; <\/span><\/div>\n<\/li>\n<li>\n<div><span style=\"font-family: verdana, geneva; font-size: small;\">5 x &#8220;Haven&#8217;t really looked at using them.&#8221; <\/span><\/div>\n<\/li>\n<li>\n<div><span style=\"font-family: verdana, geneva; font-size: small;\">5 x &#8220;No &#8211; just read about them recently and have yet to determine usefulness.&#8221; <\/span><\/div>\n<\/li>\n<li>\n<div><span style=\"font-family: verdana, geneva; font-size: small;\">3 x &#8220;Yes &#8211; every time\u00a0I do a\u00a0DBCC CHECKDB\u00a0(okay, it&#8217;s hidden, but still a snapshot).&#8221; <\/span><\/div>\n<\/li>\n<li>\n<div><span style=\"font-family: verdana, geneva; font-size: small;\">2 x &#8220;During application installation in order to do an easy rollback if smoke testing fails.&#8221; <\/span><\/div>\n<\/li>\n<li>\n<div><span style=\"font-family: verdana, geneva; font-size: small;\">2 x &#8220;For rollback of code\/data releases.&#8221; <\/span><\/div>\n<\/li>\n<li>\n<div><span style=\"font-family: verdana, geneva; font-size: small;\">2 x &#8220;Never used, but did recommend once as a pre-deployment option so that there was a faster rollback in case a developer&#8217;s script broke once in Prod. Recommendation was not implemented.&#8221; <\/span><\/div>\n<\/li>\n<li>\n<div><span style=\"font-family: verdana, geneva; font-size: small;\">1 x &#8220;As failsafe for monthly production deployments.&#8221; <\/span><\/div>\n<\/li>\n<li>\n<div><span style=\"font-family: verdana, geneva; font-size: small;\">1 x &#8220;For EOM reporting copies of the production database.&#8221; <\/span><\/div>\n<\/li>\n<li>\n<div><span style=\"font-family: verdana, geneva; font-size: small;\">1 x &#8220;No. Had performance issues so we turned them off.&#8221; <\/span><\/div>\n<\/li>\n<li>\n<div><span style=\"font-family: verdana, geneva; font-size: small;\">1 x &#8220;Not supported in SQL2000.&#8221; <\/span><\/div>\n<\/li>\n<li>\n<div><span style=\"font-family: verdana, geneva; font-size: small;\">1 x &#8220;When adding articles in replication.&#8221; <\/span><\/div>\n<\/li>\n<li>\n<div><span style=\"font-family: verdana, geneva; font-size: small;\">1 x &#8220;Yes &#8211; For quick rollback during production changes.&#8221; <\/span><\/div>\n<\/li>\n<li>\n<div><span style=\"font-family: verdana, geneva; font-size: small;\">1 x &#8220;Yes for ETL, and via a linked server connection since snapshot isolation isn&#8217;t an option.&#8221; <\/span><\/div>\n<\/li>\n<li>\n<div><span style=\"font-family: verdana, geneva; font-size: small;\">1 x &#8220;Yes, for instantaneous restore of development environment.&#8221; <\/span><\/div>\n<\/li>\n<li>\n<div><span style=\"font-family: verdana, geneva; font-size: small;\">1 x &#8220;Yes, rarely &#8211; for investigating issues on copy of production DB, way faster than restore.&#8221;<\/span><\/div>\n<\/li>\n<\/ul>\n<p><span style=\"font-family: verdana, geneva; font-size: small;\">Very interesting! More than 60% of respondents don&#8217;t or can&#8217;t use database snapshots. I&#8217;ve always thought that database snapshots are an under-utilized feature, I&#8217;m not entirely sure why though (apart from the obvious Enterprise Edition restriction &#8211; lifted in 2016 SP1). It could be some of the limitations of them, such as:<\/span><\/p>\n<ul>\n<li><span style=\"font-family: verdana, geneva; font-size: small;\">You can&#8217;t refresh one without all connections to it being dropped (and then dropping and recreating it)<\/span><\/li>\n<li><span style=\"font-family: verdana, geneva; font-size: small;\">You can&#8217;t back up a snapshot (would require some interesting plumbing in the Storage Engine, as currently backups don&#8217;t use the buffer pool, and it&#8217;s the buffer pool that manages what&#8217;s in a database snapshot)<\/span><\/li>\n<li><span style=\"font-family: verdana, geneva; font-size: small;\">You can&#8217;t modify a snapshot (i.e. like having a base VM with various diff disks)<\/span><\/li>\n<li><span style=\"font-family: verdana, geneva; font-size: small;\">They can have a performance impact on the production\/mirror workload depending on how heavily they&#8217;re used<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: verdana, geneva; font-size: small;\">I&#8217;m really glad that no-one confessed\u00a0to using database snapshots as an alternative to log backups! See <\/span><a href=\"https:\/\/technet.microsoft.com\/en-us\/library\/ff679223.aspx\" target=\"_blank\"><span style=\"font-family: verdana, geneva; font-size: small;\">this TechNet Magazine Q&amp;A column<\/span><\/a><span style=\"font-family: verdana, geneva; font-size: small;\"> I wrote last year that explains why not.<\/span><\/p>\n<p><span style=\"font-family: verdana, geneva; font-size: small;\">Rather than repeat what&#8217;s already been said about why database snapshots can be useful, I&#8217;m going to provide you with some links to further reading:<\/span><\/p>\n<ul>\n<li><span style=\"font-family: verdana, geneva; font-size: small;\">Top-level of Books Online on <\/span><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/ms175158.aspx\" target=\"_blank\"><span style=\"font-family: verdana, geneva; font-size: small;\">database snapshots<\/span><\/a><\/li>\n<li><a href=\"http:\/\/download.microsoft.com\/download\/d\/9\/4\/d948f981-926e-40fa-a026-5bfcf076d9b9\/DBSnapshotPerf.docx\" target=\"_blank\"><span style=\"font-family: verdana, geneva; font-size: small;\">Whitepaper<\/span><\/a><span style=\"font-family: verdana, geneva; font-size: small;\"> on performance implications of using database snapshots<\/span><\/li>\n<li><a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/misconceptions-around-database-snapshots-and-transaction-rollbacks\/\" target=\"_blank\"><span style=\"font-family: verdana, geneva; font-size: small;\">Blog post<\/span><\/a><span style=\"font-family: verdana, geneva; font-size: small;\"> on what happens to a database snapshot when a transaction rolls back<\/span><\/li>\n<li><a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/issues-around-dbcc-checkdb-and-the-use-of-hidden-database-snapshots\/\" target=\"_blank\"><span style=\"font-family: verdana, geneva; font-size: small;\">Blog post<\/span><\/a><span style=\"font-family: verdana, geneva; font-size: small;\"> on some of the problems you can see from DBCC CHECKDB using database snapshots under the covers<\/span><\/li>\n<li><a href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/database-snapshots-when-things-go-wrong\/\" target=\"_blank\"><span style=\"font-family: verdana, geneva; font-size: small;\">Blog post<\/span><\/a><span style=\"font-family: verdana, geneva; font-size: small;\"> on a bunch of potential problems when a database snapshot fills up or becomes corrupt<\/span><\/li>\n<li><a href=\"http:\/\/sqlmag.com\/blog\/surprising-memory-usage-database-snapshots\" target=\"_blank\"><span style=\"font-family: verdana, geneva; font-size: small;\">Blog post<\/span><\/a><span style=\"font-family: verdana, geneva; font-size: small;\"> about memory usage from a database snapshot<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: verdana, geneva; font-size: small;\">Enjoy!<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Three weeks ago I kicked off a survey about using database snapshots &#8211; see here\u00a0&#8211; because I don&#8217;t really know how much they&#8217;re used or not out in the wild. Here are the results: \u00a0 The &#8220;Other&#8221; values are: 13 x &#8220;No &#8211; not at the moment.&#8221; 10 x &#8220;In our test environment for reverting [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33,91],"tags":[],"class_list":["post-545","post","type-post","status-publish","format-standard","hentry","category-database-snapshots","category-surveys"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Using database snapshots - Paul S. Randal<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.sqlskills.com\/blogs\/paul\/using-database-snapshots\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using database snapshots - Paul S. Randal\" \/>\n<meta property=\"og:description\" content=\"Three weeks ago I kicked off a survey about using database snapshots &#8211; see here\u00a0&#8211; because I don&#8217;t really know how much they&#8217;re used or not out in the wild. Here are the results: \u00a0 The &#8220;Other&#8221; values are: 13 x &#8220;No &#8211; not at the moment.&#8221; 10 x &#8220;In our test environment for reverting [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.sqlskills.com\/blogs\/paul\/using-database-snapshots\/\" \/>\n<meta property=\"og:site_name\" content=\"Paul S. Randal\" \/>\n<meta property=\"article:published_time\" content=\"2011-07-26T10:59:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-04-13T18:41:17+00:00\" \/>\n<meta name=\"author\" content=\"Paul Randal\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Paul Randal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/using-database-snapshots\/\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/using-database-snapshots\/\",\"name\":\"Using database snapshots - Paul S. Randal\",\"isPartOf\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\"},\"datePublished\":\"2011-07-26T10:59:00+00:00\",\"dateModified\":\"2017-04-13T18:41:17+00:00\",\"author\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/using-database-snapshots\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.sqlskills.com\/blogs\/paul\/using-database-snapshots\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/using-database-snapshots\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using database snapshots\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#website\",\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/\",\"name\":\"Paul S. Randal\",\"description\":\"In Recovery...\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce\",\"name\":\"Paul Randal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g\",\"caption\":\"Paul Randal\"},\"sameAs\":[\"http:\/\/3.209.169.194\/blogs\/paul\"],\"url\":\"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using database snapshots - Paul S. Randal","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.sqlskills.com\/blogs\/paul\/using-database-snapshots\/","og_locale":"en_US","og_type":"article","og_title":"Using database snapshots - Paul S. Randal","og_description":"Three weeks ago I kicked off a survey about using database snapshots &#8211; see here\u00a0&#8211; because I don&#8217;t really know how much they&#8217;re used or not out in the wild. Here are the results: \u00a0 The &#8220;Other&#8221; values are: 13 x &#8220;No &#8211; not at the moment.&#8221; 10 x &#8220;In our test environment for reverting [&hellip;]","og_url":"https:\/\/www.sqlskills.com\/blogs\/paul\/using-database-snapshots\/","og_site_name":"Paul S. Randal","article_published_time":"2011-07-26T10:59:00+00:00","article_modified_time":"2017-04-13T18:41:17+00:00","author":"Paul Randal","twitter_misc":{"Written by":"Paul Randal","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/using-database-snapshots\/","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/using-database-snapshots\/","name":"Using database snapshots - Paul S. Randal","isPartOf":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website"},"datePublished":"2011-07-26T10:59:00+00:00","dateModified":"2017-04-13T18:41:17+00:00","author":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce"},"breadcrumb":{"@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/using-database-snapshots\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.sqlskills.com\/blogs\/paul\/using-database-snapshots\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/using-database-snapshots\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.sqlskills.com\/blogs\/paul\/"},{"@type":"ListItem","position":2,"name":"Using database snapshots"}]},{"@type":"WebSite","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#website","url":"https:\/\/www.sqlskills.com\/blogs\/paul\/","name":"Paul S. Randal","description":"In Recovery...","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.sqlskills.com\/blogs\/paul\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/ffcec826c18782e1e0adf173826a7fce","name":"Paul Randal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.sqlskills.com\/blogs\/paul\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0b6a266bba2f088f2551ef529293001bd73bf026bc1908b9866728c062beeeb6?s=96&d=mm&r=g","caption":"Paul Randal"},"sameAs":["http:\/\/3.209.169.194\/blogs\/paul"],"url":"https:\/\/www.sqlskills.com\/blogs\/paul\/author\/paul\/"}]}},"_links":{"self":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/545","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/comments?post=545"}],"version-history":[{"count":0,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/posts\/545\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/media?parent=545"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/categories?post=545"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sqlskills.com\/blogs\/paul\/wp-json\/wp\/v2\/tags?post=545"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}