You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Umbraco新手咨询:如何将生产环境内容反向同步至本地数据库?

Reverse Sync Production Umbraco Content to Local Database

Hey there! I totally get where you're coming from—when you're new to Umbraco, figuring out environment sync workflows can feel tricky. Let's walk through the most reliable ways to pull content from your production instance back to your local database:

1. Use Umbraco's Built-In Export/Import Tool (Best for Selective Content)

This is great if you don't need to sync the entire database, just specific content nodes, media, or members:

  • Step 1: Export from Production
    Log into your production Umbraco backoffice, navigate to the Content section. Right-click the root content node (or any specific node you want to sync) and select Export.
    • Check the boxes for content types, media, members, or other data you want to include in the export.
    • Generate and download the .udt (Umbraco Data Transfer) file.
  • Step 2: Import to Local
    In your local Umbraco backoffice, go to Settings > Data Transfer > Import.
    • Upload the .udt file you downloaded, then follow the on-screen prompts to map any content types or properties if needed.
  • Bonus: Sync Media Files
    Don't forget to copy the wwwroot/media folder from your production server to your local project's corresponding directory—this ensures all images/documents show up correctly.

2. Full Database Backup & Restore (Best for Complete Sync)

If you need an exact copy of your production database locally, this method is straightforward:

  • Step 1: Backup Production Database
    Use your database management tool (like SSMS for SQL Server) to create a full backup of your production Umbraco database. Save the .bak file locally.
  • Step 2: Restore to Local Database
    In your local database server, restore the .bak file. Make sure to adjust the database file paths (MDF/LDF) to point to your local storage to avoid conflicts with existing databases.
  • Step 3: Update Local Configuration
    • Replace your local project's wwwroot/media folder with the one from production.
    • Update your local appsettings.json to use the connection string for the restored database (if you didn't overwrite your existing local database).
  • Quick Fix: Reset Admin Password
    After restoring, you might not know the production admin password. Run this SQL query on your local database to reset it (replace YOUR_NEW_HASH with a valid Umbraco password hash—you can generate one by creating a test user locally and copying its hash from the umbracoUser table):
    UPDATE umbracoUser SET userPassword = 'YOUR_NEW_HASH' WHERE id = 1;
    

3. Umbraco Deploy (Best for Team/Incremental Sync)

If you're using Umbraco's official deployment tool (Umbraco Deploy, included with Umbraco Cloud or available as a paid license), you can set up reverse sync for incremental updates:

  • Step 1: Verify Deploy Setup
    Ensure Umbraco Deploy is configured on both production and local environments. In the production backoffice, every content node should have a Deploy identifier (check the top-right corner of the content editor).
  • Step 2: Pull Content to Local
    In your local Umbraco backoffice, open the Deploy panel. Select Pull from Remote, choose your production environment as the source, then pick the content nodes you want to sync.
    • This method only pulls changes made since your last sync, which is perfect for ongoing development.

Key Notes to Avoid Headaches

  • Always make sure your local Umbraco version matches the production version—version mismatches can break content sync or cause unexpected errors.
  • Before syncing, double-check that custom content types, data types, and templates are identical on both environments. If local is missing a type, imports/restore will fail.
  • For media sync, tools like robocopy (Windows) or rsync (Mac/Linux) can automate copying the media folder, saving you manual work.

内容的提问来源于stack exchange,提问作者Maarten Kieft

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:19:10