Saturday, March 29, 2025

๐Ÿš€ How to Copy a SQL Server Database Using a .bacpac File (Schema + Data) || Clone DB

#Clone Database 
Need to duplicate a full SQL Server database — including tables, views, stored procedures and data — without writing complex scripts?

Let me show you a simple, reliable method: Exporting and Importing a Data-tier Application (.bacpac). It’s perfect for backups, migrations, and creating dev/test clones.


 Step 1: Export the Source Database

  1. Open SQL Server Management Studio (SSMS).

  2. Right-click your source database → Tasks → Export Data-tier Application.

  3. Choose "Save to local disk", then pick a file path and name (YourDatabase.bacpac).

  4. Click Next through the wizard and generate the .bacpac file.


 Step 2: Import into Target Server

  1. In SSMS, right-click DatabasesImport Data-tier Application.

  2. Select the .bacpac file you exported.

  3. Give the new database a name.

  4. Complete the wizard. ๐ŸŽ‰ Done!


๐Ÿงฉ Diagram

[ Source DB ] | | Export as .bacpac ↓ [ YourFile.bacpac ] | | Import on Target Server ↓ [ New DB Clone ]

Why Use This?

  • ๐Ÿ”„ Migrate databases between environments (dev, staging, prod).

  • ๐Ÿ› ️ Create dev/test clones without risking production.

  • ๐Ÿ“ฆ Archive snapshots with both schema and data.

No comments:

Post a Comment

How to Do Cross-Browser Testing on Windows — Including Safari via Playwright

To test follow few steps: Step 1. Install node Step 2. create Folder and run these commands commands Copy Code ...