Database Research & Development

  • Home
  • NoSQL
    • NoSQL
    • Cassandra
  • Databases
    • Database Theory
    • Database Designing
    • SQL Server Coding Standards
    • SQL Server
    • PostgreSQL
    • MySQL
    • Greenplum
    • Linux
  • Interviews
    • SQL Server Interviews
    • MySQL Interviews
    • SQL Puzzles
  • DBA Scripts
    • SQL Server DBA Scripts
    • PostgreSQL DBA Scripts
    • MySQL DBA Scripts
    • Greenplum DBA Scripts
  • Home
  • Blog Archives !
  • (: Laugh@dbrnd :)
  • Contact Me !
sqlserverinterviews
Home 2018 January SQL Server 2014: Introduced DBCC CLONEDATABASE TO generate only Schema and Statistics

SQL Server 2014: Introduced DBCC CLONEDATABASE TO generate only Schema and Statistics

SQL Server Clone Database

This article is half-done without your Comment! *** Please share your thoughts via Comment ***

SQL Server 2014 introduced DBCC CLONEDATABASE for creating a blank database with only Schema and Statistics.

SQL Server 2016 added support of the Query Store in DBCC CLONEDATABASE.

This feature is very helpful in certain conditions.
For example, Your production database size is around 800 GB, and You faced some performance related issues because the problem of outdated Statistics or Indexes issue.

Now the situation is, you can do a test and trial in your Production Database, so DBA takes a copy of Production Database and restore it in different server for further investigation.

Do you think, this is the only one solution because Its require additional time and infrastructure.

In this kind of situation, you can use the DBCC CLONEDATABASE feature of SQL Server 2014.

It creates a blank database copy with the only Schema, Statistics and Query Store information. It is not copying the data, so it does not require any additional space.

You can find the same statistical information in the new clone database which generates the same execution plan for your investigation.

A Query Execution Plan is prepared to base on Database Statistics so If Database Statistics are same then you check your query execution plan without data.

Once you are finished with your task with Clone Database, you can delete it.

How internally SQL Server creates a Clone Database?

It validates the source database and acquires the shared lock on the source database

It creates a snapshot of the source database (Include only: Schema, Statistics, Query Store)

Create Clone Database and acquires an exclusive lock on it

Copy the metadata, schema, statistics, query store information from the source database to clone database

Release all locks from Clone Database

How to create a Clone Database?

Use DBCC CLONEDATABASE command to create a Clone Database.

1
DBCC CLONEDATABASE (MyDatabase,MyDatabase_Clone);
Jan 2, 2018Anvesh Patel
SQL Server: How to get the Table Column Differences?SQL Server 2014: Monitor Memory Optimized Tables which stored in Memory

Leave a Reply Cancel reply

CAPTCHA
Refresh

*

Anvesh Patel
Anvesh Patel

Database Engineer

ImageJanuary 2, 2018 SQL ServerAnvesh Patel, database, database research and development, dbcc, DBCC CLONEDATABASE, dbrnd, Query Store, schema, SNAPSHOT, SQL Query, SQL Server, SQL Server 2014, SQL Server 2016, SQL Server Administrator, SQL Server Monitoring, SQL Server Performance Tunning, SQL Server Tips and Tricks, Statistics, TSQL
About Me!

I'm Anvesh Patel, a Database Engineer certified by Oracle and IBM. I'm working as a Database Architect, Database Optimizer, Database Administrator, Database Developer. Providing the best articles and solutions for different problems in the best manner through my blogs is my passion. I have more than six years of experience with various RDBMS products like MSSQL Server, PostgreSQL, MySQL, Greenplum and currently learning and doing research on BIGData and NoSQL technology. -- Hyderabad, India.

About DBRND !

dbrnd

This is a personal blog (www.dbrnd.com).

Any views or opinions represented in this blog are personal and belong solely to the blog owner and do not represent those of people, institutions or organizations that the owner may or may not be associated with in professional or personal capacity, unless explicitly stated.

Feel free to challenge me, disagree with me, or tell me I’m completely nuts in the comments section of each blog entry, but I reserve the right to delete any comment for any reason whatsoever (abusive, profane, rude, or anonymous comments) - so keep it polite.

The content of this website is protected by copyright. No portion of this website may be copied or replicated in any form without the written consent of the website owner.

Recent Comments !
  • Anvesh Patel { Sure will do... } – May 27, 12:43 PM
  • Anvesh Patel { Great... } – May 27, 12:41 PM
  • Anvesh Patel { Great... } – May 27, 12:39 PM
  • Anvesh Patel { Great... } – May 27, 12:36 PM
  • Anvesh Patel { Great... } – May 27, 12:28 PM
  • Anvesh Patel { Great... } – May 27, 12:27 PM
  • Anvesh Patel { Great... } – May 27, 12:16 PM
  • Older »
Follow Me !
  • facebook
  • linkedin
  • twitter
  • youtube
  • google
  • flickr
© 2015 – 2019 All rights reserved. Database Research & Development (dbrnd.com)
Posting....