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:


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