Share via


Move Windows Internal Databases to a different drive (Windows SharePoint Services 3.0)

Applies To: Windows SharePoint Services 3.0

 

Topic Last Modified: 2008-11-03

You can move the Windows SharePoint Services 3.0 content database and configuration database from one disk or server to another without losing data. This may be necessary if you run out of space on the current disk or if the disk drive becomes unreliable. Windows Internal Database uses SQL Server technology as a relational data store for Windows roles and features only, such as Windows SharePoint Services, Active Directory Rights Management Services, UDDI Services, Windows Server Update Services, and Windows System Resources Manager. Windows Internal Database is also known as Microsoft SQL Server Express Embedded Edition.

Important

This article only covers moving content and configuration databases. It does not provide information about moving other databases that are associated with Windows SharePoint Services 3.0.

Important

If you detach and reattach a content database, be aware that the next time the content within that content database is crawled, a full crawl will occur even if an incremental crawl is requested. Because a full crawl recrawls all content that the crawler encounters, regardless of whether that content has been previously crawled, full crawls can take significantly more time to complete than incremental crawls.

Move content and configuration databases to a different drive

There are five main steps to the process of moving a database within Windows Internal Database:

  • Stop the affected services.

  • Detach the databases from Windows SharePoint Services 3.0.

  • Move the database files.

  • Reattach the databases.

  • Restart the services.

Before you begin the following procedure, be sure to review the options and requirements for the following command-line tools:

Note
Memberships in the Administrators group on the local computer that is hosting the SharePoint Central Administration Web site and in the dbowner fixed database role in Microsoft SQL Server 2005 Express Edition are the minimum memberships required to complete this procedure.

Move databases to a different drive by using command-line tools

  1. Stop all SharePoint services.

    1. Type the following command, and then press ENTER:

      stsadm –o enumservices

      A list of all the services appears.

    2. For each service listed in the previous step, type the following command, and then press ENTER:

      net stop <service name>

  2. Detach the databases.

    1. On the drive on which SharePoint Products and Technologies is installed, change to the following directory: %Program Files%\Microsoft SQL Server\90\Tools\binn.

    2. Type the following command, and then press ENTER:

      sqlcmd -S \\.\pipe\mssql$microsoft##ssee\sql\query -E

      The Sqlcmd command-line tool enables you to enter SQL queries in the command line.

    3. On the first query line, type the following query, and then press ENTER:

      EXEC sp_detach_db @dbname = '<database name>'

      Where <database name> is the name of the database you want to move.

      The names of the configuration database, the Central Administration content database, and the search database are composed of a prefix plus the database GUID, as shown in the following examples:

      • The database name of the configuration database has the following format: SharePoint_Config_<database GUID>

      • The name of the Central Administration content database has the following format: SharePoint_AdminContent_<database GUID>

      • The name of the search database has the following format: WSS_Search_NETSERVER_<database GUID>

    4. On the next query line, type GO, and then press ENTER.

    5. Repeat steps c and d for each database you want to move.

    6. Exit the Sqlcmd command-line tool.

      1. On the first query line, type EXIT, and then press ENTER.

      2. On the second query line, type GO, and then press ENTER.

  3. Move the database files to the new location.

  4. Reattach the databases and log files.

    1. On the drive on which SharePoint Products and Technologies is installed, change to the following directory: %Program Files%\Microsoft SQL Server\90\Tools\binn.

    2. Type the following command, and then press ENTER:

      sqlcmd -S \\.\pipe\mssql$microsoft##ssee\sql\query -E

    3. On the first query line, type the following query, and then press ENTER:

      EXEC sp_attach_db @dbname = '<database name>', @filename1 = '<UNC path><database name>.mdf', @filename2 = '<UNC path><database name>_log.ldf'

      You must include the file names for the database file (.mdf) and the associated log file (.ldf).

    4. On the next query line, type GO, and then press ENTER.

    5. Repeat steps c and d for each database you moved.

    6. Exit the Sqlcmd command-line tool.

      1. On the first query line, type EXIT, and then press ENTER.

      2. On the next query line, type GO, and then press ENTER.

  5. For each service stopped in step 1, type the following command, and then press ENTER:

    net start <service name>

See Also

Concepts

Maintaining databases (Windows SharePoint Services 3.0)
Planning and Monitoring SQL Server Storage for Windows SharePoint Services: Performance Recommendations and Best Practices (white paper)
Add, split, and merge content databases (Windows SharePoint Services 3.0)
Move content databases (Windows SharePoint Services 3.0)
Move all databases (Windows SharePoint Services 3.0)