SQL Server Source Control on a $0 Budget

The Source Control Dilemma

Every DBA has been there. Trying to keep track of database schema changes while developers have their fancy Git repositories and version control workflows. Meanwhile, database changes are often handled through a mix of manual scripts, backups, and maybe a SharePoint folder full of “final_final_v2.sql” files.

Did you know that SQL Server already has a built-in tool that can help you track your database schema changes, without spending a dime on third-party tools? Enter DBCC CloneDatabase, the secret weapon for DBAs who want version control without the price tag.

  • What it does: Creates a schema-only copy of a database.
  • Why it’s great for source control: Captures object definitions, indexes, statistics, etc. all without data.
  • No third-party tools, no extra licensing costs.

How to Use DBCC CloneDatabase

  • Step 1: Run DBCC CloneDatabase (SourceDB, CloneDB)
  • Step 2: Script out the cloned database.
  • Step 3: Commit the script to Git (or another VCS).
  • Step 4: Or, skip steps 2 and 3, and let the clone sit there. But put that db in read-only.

Benefits Over Other Methods

  • No need for expensive 3rd party software licensing.
  • Fast, lightweight, and built into SQL Server.
  • Keeps a clean history of schema changes, assuming you keep the script and/or backups elsewhere

Bonus Tips

  • Automate the process: Set up a job to create clones regularly and back them up
  • Use in disaster recovery scenarios to validate schema integrity. Compare the clone to the prod database using SQL Server Data tools.

The Bottom Line: SQL Source Control Without the Price Tag

DBAs can manage versions like developers, without breaking the budget. Simple, effective, and already included in SQL Server.

Look how easy this is:

Thanks for reading!

–Kevin

Get a Free Health Check for your most important SQL Server today from Dallas DBAs.

Leave a Comment

Sign up for our Newsletter

%d bloggers like this: