Thursday, February 12, 2009

Move Sharepoint 3.0 Databases to a different folder

WSS 3.0 ships with a new Windows Internal Database based on SQL Server 2005. Its code name was wYukon.

You will see it as a running service called MSSQL$MICROSOFT##SSEE

When referring to the database server name in any stsadm commands, you should use this name:

ServerName\Microsoft##SSEE

It has many advantages over the previous WMSDE that shipped with WSS 2.0 but there are 2 downsides:

  1. no database admin tools are install. The only options are the sqlcmd command line utility (replaces the old osql utility) or Management Studio Express (both must be run on the server as no remote connections to WID are allowed).
  2. you can't specify the install location of WID when you install WSS

If you don't have another SQL Server 2005 product installed on the WSS server then you will have to download sqlcmd from here... (also install the Native Client from the same link). After installation, you will find the utility installed in the following location:

C:\Program Files\Microsoft SQL Server\90\Tools\binn

Run the following command from this directory to connect to the WID instance:

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

If you have installed SQL Management Studio Express then the connection string is \\.\pipe\mssql$microsoft##ssee\sql\query

All the SharePoint database files will default to being in the C:\WINDOWS\SYSMSI\SSEE\MSSQL.2005\MSSQL\Data directory. To move them to another partition you should stop all WSS services and IIS to release any locks on the databases, Find the name of the content database from the Central Admin site or stsadm command, then use the following sqlcmd commands...

EXEC sp_detach_db @dbname = 'Content_Database_name'
Go

You will find the db and log files in the following location

WINDIR%\SYSMSI\SSEE\MSSQL.2005\MSSQL\Data\.mdf' and _log.ldf

Now copy the files to the new location and run the following command

EXEC sp_attach_db @dbname = 'Content_Database_name', @filename1 = 'drive:\path\Data\.mdf', @filename2 = 'drive:\path\Data \_log.ldf'
Go

Now you can restart the services and web sites.

There are 3 other SharePoint databases you may want to move to another location. The largest of these will be for search. To list them, use the following sqlcmd command:

select name from sysdatabases
go

Which should give you something like this (GUID's may be different):

SharePoint_Config_c464b7ce-59ef-4820-9f75-f46a0937c08e
SharePoint_AdminContent_451452bf-9dc0-40c9-be18-14f14bc23007
WSS_Search_NETSERVER_86a140c5958d4a5d97c8c2cbee745424

Before trying to move these you should stop IIS and all the Windows SharePoint Services. Then you can use the same steps as above.

If you have attached the databases to a full SQL Server instance , you can remove the SSEE SQL Instance using the following command:

X86 - msiexec /x {CEB5780F-1A70-44A9-850F-DE6C4F6AA8FB} CALLERID=ocsetup.exe

X64 - msiexec /x {BDD79957-5801-4A2D-B09E-852E7FA64D01} CALLERID=ocsetup.exe


Original posting in http://www.wssdemo.com/Pages/db.aspx


No comments: