Locating the Database Files

Archived content. No warranty is made as to technical accuracy. Content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

Each database, including the configuration database, isidentified by two files: the database file , which has a .mdf filename extension, and the transaction logfile , which has a .ldf extension. Before moving eachdatabase, you must get the paths to these two files for thatdatabase. If you have a default Windows SharePoint Servicesinstallation, the database files are in the \Program FilesMicrosoft SQL Server\MSSQL$SHAREPOINT\Data directory. You will findthe following files in that directory:

  • STS_Config.mdf

  • STS_Config_log.LDF

  • STS_ Computer_Name _1.mdf

  • STS_ Computer_Name _1_log.LDF

If your database files are not in the default location, use thefollowing procedure to get the full database filenames.

Note: This procedure uses theOSQL command line utility, which lets you run SQLstatements, system procedures, and script files.

Locate database files

  1. Open the SharePoint Central Administration Pages.

    On the Start menu, point to All Programs , click Administrative Tools , and then click SharePoint Central Administration .

  2. To find the name of your configuration database, in the Server Configuration section, click Set configuration database server .

  3. On the Set Configuration Database Server page, in the SQL Server database name field, note the database name.

  4. To find the names of your content databases, go back to thehome page of the SharePoint Central Administration pages. In the Virtual Server Configuration section, click Configure virtual server settings .

    For each virtual server that is listed in the VirtualServer List page, do the following:

    1. Click the virtual server name.

    2. On the Virtual Server Settings page, in the Virtual Server Management section, click Manage content databases .

      Note the database names that are listed.

    3. If there are more virtual servers, go back to the VirtualServer List page and repeat steps 1 and 2.

  5. Start the OSQL utility. At a Windows command prompt, type thefollowing:

    osql E S %computername%\SharePoint
  6. To get the filenames for your configuration database, type thefollowing three steps at the OSQL prompt, pressing ENTER after eachline:

    USE Configuration_Database_NameSELECT filename FROM sysfilesGO

    The prompt will increment in value as you enter eachcommand. Write down the two paths that are displayed.

  7. For each content database, type the following three steps atthe OSQL prompt, pressing ENTER after each line:

    USE Content_Database_NameSELECT filename FROM sysfilesGO

    The prompt will increment in value as you enter eachcommand. Write down the two paths that are displayed for eachcontent database.

  8. Exit the OSQL utility by pressing CTRL+C.