If you want to move your WSSv2 MSDE DB to WSSv3, these steps and scripts are just what you need.

Microsoft KB 925190 explains just that. I have adopted that to script some of the steps.

This is very similiar to WSSv3 Database move from default location to another location as explained in this post.

When you move the WSS database to the WSS 3.0 server, the WSS database is upgraded to WSS 3.0. This occurs when you attach a WSS 3.0 Web application.

To move a WMSDE content database that resides on a WSS server to a WSS 3.0 server, follow these steps:

Use the Prescan.exe tool to scan the WMSDE content database on the WSS server. Note You must run the Prescan.exe tool on the WSS database to prepare the database to be added to the WSS 3.0 Web application.

1. To use the Prescan.exe tool to scan the WSS database, follow these steps:

  • Use an account that has administrative permissions to log on to the WSS server.
  • Copy the Prescan.exe tool on the WSS 3.0 server to a folder on the WSS server.
    Note The Prescan.exe tool is located on the WSS 3.0 server in the following folder: Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN
  • Click Start, click Run, type cmd, and then click OK.
  • Locate the folder to which you copied the Prescan.exe tool.
  • At the command prompt, type the following command to scan the database: prescan /all

2. On the WSS 3.0 server, create the following folder structure under the Windows folder:

SYSMSISSEEMSSQL.2005MSSQLData

3. Use the Osql command to connect to the WSS database. To do this, follow these steps:

  • At the command prompt, type the following command, and then press ENTER:

Osql –S Servernamesharepoint -E

Note In this command, Servername is the name of the WSS server.

  • At the 1> prompt, type the following command, and then press ENTER:

EXEC sp_detach_db contentDB name

Note In this command, contentDB name is the name of the content database.

  • At the 2> prompt, type Go, and then press ENTER.

Note You may receive a message that resembles the following:

database is in use and cannot be detached

  • If you receive this error message, type the following commands at the command prompt in the order in which they are presented.

net pause mssql$sharepoint

net continue mssql$sharepoint

4. Copy all the .mdf and .ldf files that are located in the WSS database to following folder on the WSS server:

WINDOWSSYSMSISSEEMSSQL.2005MSSQLData

5. Use an account that has administrative permissions to log on to the WSS 3.0 server.

6. On the WSS 3.0 server, download and install the Microsoft SQL Server Native Client and the Sqlcmd utility.

7. On the WSS 3.0 server, run the following command at the command prompt:

sqlcmd -S \.pipemssql$microsoft##sseesqlquery -E

8. At the 1> prompt, type the following command, and then press ENTER:

EXEC sp_attach_db @dbname = N’contentDB name‘, @filename1 = N’D:WINDOWSSYSMSISSEEMSSQL.2005MSSQLDatacontentDB name_1.mdf’, @filename2 = N’D:WINDOWSSYSMSISSEEMSSQL.2005MSSQLData contentDB name_1_log.ldf’

Note In this command, contentDB name is the name of the content database.

9. At the 2> prompt, type Go, and then press ENTER:

10. On the WSS 3.0 server, create a Web application to attach to the database.
If you have already created a new Web application, you must use the Manage Content Databases page to remove the content database from the Web application. This lets you add the migrated database from the WSS server. To do this follow these steps:

  • On the WSS 3.0 server, click Start, point to Administrative Tools, and then click SharePoint 3.0 Central Administration.
  • On the Central Administration page, click Application Management.
  • On the Application Management page, click Content Databases.
  • On the Manage Content Databases page, click the Web application that you want.
  • Click the name of the new database that was created when you created the Web application.
  • On the Manage Content Database Settings page, click to select the Remove content database check box, and then click OK.

11. Use the Stsadm.exe command-line tool to attach the WSS database to the Web application. Windows SharePoint Services does not support using the Manage Content Databases page to add a WSS database to a Web application. Therefore, you must use the Stsadm.exe command-line tool to add the Windows SharePoint 2.0 database to the Web application.
To do this, follow these steps:

a. At the command prompt, locate the following folder:

Program FilesCommon FilesMicrosoft Sharedweb server extensions12BIN

b. At the command prompt, type the following command for more information about how to use the Stsadm.exe command-line tool.

stsadm -help addcontentdb

The following output is generated:

stsadm.exe -o addcontentdb
           -url url
           -databasename <database name>
           [-databaseserver <database server name>]
           [-databaseuser <database username>]
           [-databasepassword <database password>]
           [-sitewarning <site warning count>]
           [-sitemax <site max count>]

Note In this text, url is the url of the WSS 3.0 Web application to which you want to add the database.

Note: If you want to script steps 3 and 4 and 7 through to 9, then create 3 scripts as follows, after you have done step 7.

All installation files will be in C:WSSV3 for reference from now on.

Script to install the Microsoft SQL Server Native Client and the Sqlcmd utility.

c:wssv3sqlncli.msi /qn

c:wssv3sqlserver2005_sqlcmd.msi /qn

After installation, you will find the utility installed in the following location:

C:Program FilesMicrosoft SQL Server90Toolsbinn

Remember you have done step 2 of creating Data folder, which should be

%windir%sysmsisseeMSSQL.2005MSSQLData

Script to stop MSSQL$sharepoint, copy, detach, move and attach database

net pause mssql$sharepoint

copy <your wssv2 database files> c:SharePointv3Database*.*

net continue mssql$sharepoint

sqlcmd -S \.pipemssql$microsoft##sseesqlquery -E -i c:s2.sql

If you see there is another scipt that is s2.sql. This script is to actually detach and attach the database. I am making an assumption that, this database name is WSS_Content.

Script to detach and attach WSS database

EXEC sp_detach_db @dbname = ‘WSS_Content’

go

EXEC sp_attach_db @dbname = ‘WSS_Content’, @filename1 = ‘%windir%sysmsisseeMSSQL.2005MSSQLDataWSS_Content.mdf’, @filename2 = ‘%windir%sysmsisseeMSSQL.2005MSSQLDatawss_content_log.ldf’

go

That’s it! If you have migrated from WSSv2 to WSSv3, I would like to hear from you!

%d bloggers like this: