
Rudi Bruchez EI · www.pachadata.com · rudi@pachadata.com · +33 6 22 48 76 99
Consulting, audit, performance tuning, solutions, training
SQL Server OLTP and BI / NoSQL
Version of November 30, 2026 (d3a32c4e) · https://www.pachadata.com/en/services/client-instructions/database-clone/
Sending a database clone with no data
Categories:
3 minute read
DBCC CLONEDATABASE creates a copy of a database that holds its
schema, the statistics and the Query Store (query text, execution plans, runtime
statistics), without any data. It is what will let me analyze the query history
of a database without seeing its contents. With it, I have everything I need for
a first performance analysis pass on the database.
Creating the clone
Run this as a member of the sysadmin role, on the instance that hosts the
database. The example uses the PachaDataFormation database: replace its name
with yours, in both places, and keep the _Clone suffix for the clone.
USE master;
-- Write to disk the Query Store statistics still held in memory
EXEC PachaDataFormation.sys.sp_query_store_flush_db;
-- Clone with no data, backed up in one go
DBCC CLONEDATABASE (PachaDataFormation, PachaDataFormation_Clone)
WITH BACKUP_CLONEDB;
Do not add the VERIFY_CLONEDB option. It removes the statistics and the Query
Store from the clone, like NO_STATISTICS, NO_QUERYSTORE
(Microsoft’s documentation): only the
schema is left, with nothing to analyze. BACKUP_CLONEDB already verifies the
backup.
The command creates the PachaDataFormation_Clone database on the instance,
backs it up to the instance’s default backup directory and verifies the backup.
The last message gives the file name:
Clone backup succeeded and is stored in 'PachaDataFormation_Clone_807744542.bak'.
Once the backup is written, drop the clone from the instance: Microsoft does not support a clone used in production.
DROP DATABASE PachaDataFormation_Clone;
The .bak file is what I need. It holds no table rows and is usually a few tens
of megabytes.
You can also zip it to save a little space.
To send it, I can give you an upload link on transfer.pachadata.com, my file
transfer service: open it in a browser and drop the file, with no account to
create. The link only lets you send me files, nobody else can download them,
and it expires after a few days.
What the clone contains
| Content | In the clone |
|---|---|
| Table rows | no |
| Schema (tables, indexes, procedures, views) | yes |
| Query Store: query text, plans, runtime statistics | yes |
| Statistics, histograms included | yes |
Statistics are what the optimizer reads to estimate row counts: without them, the plans cannot be reproduced on the clone. A histogram holds up to 200 real values from the column it describes.
The Query Store text and plans can also hold values: literals written into the queries and the parameter values at compile time.
The clone holds only what the Query Store holds when the clone is made. The Query Store keeps 30 days of history by default, less if it reaches its maximum size.
Further reading
- DBCC CLONEDATABASE, Microsoft’s documentation.
- Analyzing the Query Store with an AI agent, section “Working on a clone”: restoring the clone and its pitfalls.
Contact
I have been an independent SQL Server consultant since 2006. I help when an application slows down, when a server costs too much in storage or licenses, or when a migration must not stop production: audit and diagnosis, query and index tuning, migrations, high availability, training. On site, or as a remote audit delivered in five working days.
rudi@pachadata.com · +33 6 22 48 76 99 · www.pachadata.com/en/contact/