Softrade Digital Pty Limited - Home Page / Knowledge Base / Databases: How do you move the "Windows Internal Database" (embedded SQL Server 2005 Express) to a different drive than C:

Databases: How do you move the "Windows Internal Database" (embedded SQL Server 2005 Express) to a different drive than C:

Sylvain Dinel shared with us his solution to this.

1) Download and install Microsoft SQL Server Native Client and Microsoft SQL Server 2005 Command Line Query Utility

2) Identify the Sharepoint DB you want to move (look under
%SystemRoot%\SYSMSI\SSEE\MSSQL.2005\MSSQL\Data)

3) Close the SharePoint services.

4) Open a command prompt

5) Go to the Microsoft SQL Server 2005 Command Line Query Utility folder
(under C:\Program Files\Microsoft SQL Server\90\Tools\binn)

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

7) Type EXEC sp_detach_db <Database_Name_to_be_moved> and press Enter

8) Type GO and press Enter

9) Move db files (.mdf and .ldf) from the Sharepoint DB previously detached to the new location.

10) Type

EXEC sp_attach_db @dbname = N'<Database_Name_to_be_moved>',
@filename1 = N'<New_Location_Path>\ <Database_File_to_be_moved>.mdf',
@filename2 = N' <New_Location_Path>\ <Database_Log_File_to_be_moved>.ldf’
(Ex:EXEC sp_attach_db @dbname =
N'SharePoint_AdminContent_f9e992d3-3d22-4117-8725-26ce0dd0f652', @filename1 =
N'E:\SharepointDB\SharePoint_AdminContent_f9e992d3-3d22-4117-8725-26ce0dd0f652.mdf',
@filename2 =
N'e:\SharepointDB\SharePoint_AdminContent_f9e992d3-3d22-4117-8725-26ce0dd0f652_log.ldf’)

11) Press Enter

12) Type GO and press Enter

13) Repeat steps 7 to 12 for each DB to be moved.

13) Type Exit and press Enter to exit SQLCMD

14) Type Exit and press Enter to close the Command Prompt.

15) Start the Sharepoint services previously stopped.

Thanks, Sylvain!
Ian Morrish has a blog item on moving the Windows Internal Database files from the C:\WINDOWS\SYSMSI\SSEE\MSSQL.2005\MSSQL\Data directory here
http://www.wssdemo.com/Pages/db.aspx
he seems to take a similar approach there to the above. Note however that although Ian says you only need to stop all Windows SharePoint Services before removing the databases he mentions at the end of his piece, I found it necessary to stop all WSS Services before doing anything with the database (as also Sylvain says) - even the WSS Content Database - and I found it necessary to stop IIS - which Sylvain includes - before moving one of the config databases.