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:
Sqlcmd utility (https://go.microsoft.com/fwlink/?LinkId=132815&clcid=0x409)
Net Stop (https://go.microsoft.com/fwlink/?LinkId=132816&clcid=0x409)
Net Start (https://go.microsoft.com/fwlink/?LinkId=132817&clcid=0x409)
![]() |
---|
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
Stop all SharePoint services.
Type the following command, and then press ENTER:
stsadm –o enumservices
A list of all the services appears.
For each service listed in the previous step, type the following command, and then press ENTER:
net stop <service name>
Detach the databases.
On the drive on which SharePoint Products and Technologies is installed, change to the following directory: %Program Files%\Microsoft SQL Server\90\Tools\binn.
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.
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>
On the next query line, type GO, and then press ENTER.
Repeat steps c and d for each database you want to move.
Exit the Sqlcmd command-line tool.
On the first query line, type EXIT, and then press ENTER.
On the second query line, type GO, and then press ENTER.
Move the database files to the new location.
Reattach the databases and log files.
On the drive on which SharePoint Products and Technologies is installed, change to the following directory: %Program Files%\Microsoft SQL Server\90\Tools\binn.
Type the following command, and then press ENTER:
sqlcmd -S \\.\pipe\mssql$microsoft##ssee\sql\query -E
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).
On the next query line, type GO, and then press ENTER.
Repeat steps c and d for each database you moved.
Exit the Sqlcmd command-line tool.
On the first query line, type EXIT, and then press ENTER.
On the next query line, type GO, and then press ENTER.
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)