Attach Database Tool

The Attach Database Tool is a premium feature available only on Ultimate and Power hosting plans.
This tool allows you to attach an existing SQL Server MDF data file to a database on your site.

Where to Find the Attach Database Tool

You can access the Attach Database Tool from your Control Panel:
Control Panel → Sites → Select Your Site → MS SQL Manager → Manage
On the Tools row, click Attach to begin.

Important Notes Before You Begin

  • The file you attach must be an .mdf file.
  • Any existing data in the target SQL database will be permanently overwritten.
  • The MDF file must be uploaded to your site’s App_Data directory.
  • The MDF file must be renamed exactly as specified in the attach tool before uploading.

Step 1: Properly Copy the MDF Data File

Before attaching the database, you must create a clean, usable copy of the MDF file from the source SQL Server.

Recommended Method (SQL Server Management Studio)

  1. Open SQL Server Management Studio (SSMS) on the source server.
  2. Locate the database you want to move.
  3. Detach the database:
    • Right-click the database
    • Select Tasks → Detach
  4. Navigate to the database data directory (usually under MSSQL\Data).
  5. Copy the .mdf file (and .ldf if present, though only the .mdf is required).
  6. After copying, you may re-attach the database on the source server if needed.
Detaching the database ensures the MDF file is not locked and prevents corruption.

Alternative (If Detach Is Not Possible)

If detaching is not an option:
  • Ensure the database is offline or SQL Server service is stopped before copying the MDF file.
  • Do not copy an MDF file while the database is actively in use.

Step 2: Rename the MDF File

  1. In the Attach Database Tool, locate the field labeled “MDF File to Attach”.
  2. Rename your MDF file exactly to match the name shown in that field.
The attach process will fail if the file name does not match exactly.

Step 3: Upload the MDF File

  1. Connect to your site with an FTP client.
  2. Navigate to your site’s App_Data directory.
  3. Upload the renamed .mdf file to this folder.

Step 4: Attach the Database

  1. Return to MS SQL Manager → Manage → Attach.
  2. Confirm the MDF file name is correct.
  3. Click Attach to complete the process.
Once finished, the MDF file will be attached to the database and ready for use.

Warning About Data Overwrite

⚠️ Using the Attach Database Tool will overwrite all existing data in the target SQL database.
If you need to preserve current data, make sure you create a backup before proceeding.