Changing the Location of the SQL Server Data (MDF) and Transaction Log (LDF) Files.

September 27, 2004 | KB: 1000510
Laserfiche 6, Plus 6

Summary

This article details how to specify where you want the SQL Server data and log files to be located.

Cause

The data and log files for your Laserfiche repository will be created in a default location set by Laserfiche. The Laserfiche user interface does not currently give you the option of specifying where you want to create the files.

Note: Laserfiche version 7 will allow you to specify where to create the SQL database data and log files.

Resolution

You can manually move the SQL database files to a desired location by taking the following steps:

  1. Use the OSQL command-line utility to detach the SQL database.
  2. Move the data and log files to the desired location.
  3. Reattach the database using OSQL.

To detach, move, and reattach the SQL database:

  1. Click Start and click Run.
  2. Open a command prompt window by typing in the following in the Run dialog box:

    cmd

  3. In the command prompt window, type the following:

    osql -E -S ComputerName\Laserfiche

    Note: If you are using Laserfiche United (Standard\Enterprise), then you should only specify the name of the computer where the SQL server resides.

  4. Type the following to use the sp_helpfile stored procedure to find out the names and location of the data and log files:

    USE DatabaseName
    GO
    EXEC sp_helpfile
    GO

  5. Take note of the names and location of the MDF and LDF files.
  6. Type the following to first detach the database:

    USE master
    GO
    EXEC sp_detach_db 'DatabaseName'
    GO

    Note: The Laserfiche for Microsoft SQL Server service must be stopped. Otherwise, the database files will be in use and cannot be detached.

  7. Now, copy the data and log files to the new desired location.
  8. Type the following to reattach the database:

    USE master
    GO
    EXEC sp_attach_db 'DatabaseName','DirectoryPath\MDF_filename.mdf','DirectoryPath\LDF_filename.ldf'
    GO

    Note: The database files are attached in Microsoft SQL Server. However, you will also have to update where Laserfiche is expecting the database to be. Use the Laserfiche Administration Console and reattach the Laserfiche repository.

More Information

  • For more information on where Laserfiche will create the data and log files, click the article below:

    1000511 Default Data and Log File Locations for newly created databases

  • For more information on moving SQL Server database files, click the Microsoft Knowledge Base article below:

    224071 Moving SQL Server databases to a new location with Detach/Attach