DBCC CLONEDATABASE – Another DBCC command in the List

Hello Friends,

As the part of SQL Server DBA world, we have used many DBCC commands in our workplace like DBCC CHECKDB(), DBCC TRACEON(), DBCC SQLPERF() etc. All these commands make DBA life easier and help us to troubleshooting issues, alerting etc. In the same row, with the announcement of SQL Server 2014 service pack 2 Microsoft announced the another command i.e. DBCC CLONEDATABASE().

This DBCC CLONEDATABASE takes two parameters, first as the source database name while the second will be the destination database name. Keep in mind the there should not be any database exist already with the specified destination database name. Destination database will be created and all the new database file settings will be inherited from model database. After that the schema and statistics from the source database will be copied to destination database. We can use this destination database to troubleshoot performance issues which require statistics. This might be helpful for the database testing professionals to test the query execution and data insertion etc.

Syntax for DBCC CLONEDATABASE is mentioned below:


USE [master]
DBCC CLONEDATABASE([PartitionTruncate],[PartitionTruncate_CLONE]);

Output under message tab is self explanatory:

Database cloning for ‘PartitionTruncate’ has started with target as ‘PartitionTruncate_CLONE’.

Database cloning for ‘PartitionTruncate’ has finished. Cloned database is ‘PartitionTruncate_CLONE’.

Database ‘PartitionTruncate_CLONE’ is a cloned database. A cloned database should be used for diagnostic purposes only and is not supported for use in a production environment.

DBCC execution completed. If DBCC printed error messages, contact your system administrator.


If you will check in Object Explorer then you will find out that by default destination database is in Read-Only Mode. Schema and Statistics have been copied to clone database.


PS: There are some limitations about which types of object schema can be copied. For detail list of that you can click here.


Prince Kumar Rastogi

Like us on FaceBook | Join the fastest growing SQL Server group on FaceBook

Follow Prince Rastogi on Twitter | Follow Prince Rastogi on FaceBook


About Prince Rastogi

Prince Rastogi is working as Database Administrator at Elephant Insurance, Richmond. He is having more than 8 years of experience and worked in ERP Domain, Wealth Management Domain. Currently he is working in Insurance domain. In the starting of his career he was working on SQL Server, Internet Information Server and Visual Source Safe. He is post graduate in Computer Science. Prince is ITIL certified professional. Prince likes to explore technical things for Database World and Writing Blogs. He is Technical Editor and Blogger at SQLServerGeeks.com. He is a regular speaker at DataPlatformDay events in Delhi NCR. He has also presented some in depth sessions about SQL Server in SQL Server Conferences in Bangalore.

View all posts by Prince Rastogi →

Leave a Reply

Your email address will not be published.