SQLServerCentral Editorial

DBCC CLONEDATABASE is Semi-Discontinued

,

I saw a tweet that DBCC CLONEDATABASE was being discontinued for production databases, which both scared me and didn't make sense. I've used this a few times for a quick copy of a database and like how it works. Discontinuing it seemed strange to me.

Then I read the blog post, which notes that it's not being supported for production deployments. The post doesn't explain why, but I'm guessing this is because all the stats and other metadata moves, and this might mess up the optimizer if different data is added. I don't know who deploys production databases like this, but I could see people who have federated or sharded databases using this to create a new blank copy and then uploading data into it. Or maybe people who need new databases that are distributed onto remote office/edge devices used it? If you use this to create production dbs, let me know.

This command will still be used for generating schema-copies for diagnostic and troubleshooting purposes, which is what it's there for. I assume this means Microsoft Support will support you using this to investigate strange query issues or if you create a database at their request. However, there isn't a mention of this being used for development and test environments, which is where I use it.

Specifically, I've used it quite a bit lately with Redgate's subsetter utility. I need a target that's shaped like the source, and dbcc clonedatabase gives me that. I don't really care about stats or anything else, I just need schema set up to move data around. It's useful there. It's also useful for a quick test of a deployment, where I can ensure I get the latest production schema and then run a deployment against it (hopefully using Flyway), looking for errors.

If you use this command, don't worry. The tool isn't going away, and the restriction against production copies doesn't take place until March 1, 2025. That's nearly a year from now to change your process. If you've never used it, well, I don't have a good reason to start using it, but you ought to be aware of how it works. Learning about new features is handy, as you might discover a problem the knowledge can solve. However, if you don't know it exists, it will never enter your mind as a solution.

Be curious and try things. It's easy, and it's fun.

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating