Steps to attach .MDF and .LDF files of MSSQL databases to convert it to .bak format

KB Tags associated with this article:
Use any one tag
KB Tags
Body

The MSSQL databases have to be in the .bak format in-order to restore it via the Plesk panel. However, the database backups which we keep on our backup servers are in the format of ".MDF" and ".LDF". So you need to attach these files to convert it to .bak format file. You can do this by following the steps:

Step 1: Attach .MDF and .LDF files.

  1. Login to the MSSQL server installed in your local machine using MSSQL management studio tool (version 2012).
  2. Right-click Databases and then click Attach.mdf conversion 1
  3. Click Add and browse the .MDF and .LDF files.mdf conversion 2
  4.  After adding the .MDF and .LDF files click OK.mdf conversion 3
  5. The database is locally restored in the MSSQL server installed on your local machine.

Step 2: Generate the .bak file for backup.

  1. If you want to restore this database via the Plesk panel, you need to take the database backup in .bak format using the following steps:
  2. Log in to the same MSSQL management studio tool where you have locally restored it using .MDF and .LDF files.
  3. Right click on the database shown under Databases list.
  4. Click tasks and then click Backup.
  5. Note down the backup file location and name and click OKmdf-conversion 4
  6. You can see the database backup in .bak format (in the same location where it was listed in point 3).