Wednesday, December 30, 2009

Upgrading SharePoint Portal Server 2003 to Microsoft Office SharePoint Server 2007 (MOSS 2007) using Database Migration

Assumptions

This post assumes that you are currently running Microsoft SharePoint Portal Server 2003 (SPS 2003) and that you want to upgrade to Microsoft Office SharePoint Server 2007 (MOSS 2007). I assume you are running in a pretty simple configuration such that you have a separate database server, and the rest of your SPS2003 installation is on one server.

One thing that I have that many people may not have that I have is two installations and versions of SharePoint on one server. I have SPS 2003 and MOSS 2007 on the same server. There are separate urls for both instances of SharePoint. I don’t want to do anything to the existing MOSS 2007 installation, but I DO want to upgrade SPS 2003 to MOSS 2007. In the end, my goal is to have one instance of MOSS 2007 with two different web applications (one that already existed and one that was converted from SPS2003) and no instances of SPS2003. FYI, this is all because I inherited the MOSS 2007 instance after I already had SPS2003, and I only had the one server to run both instances.

You should be running Service Pack 3 for SPS2003 and WSS 2.0. Click here for instructions.

The biggest assumption is that you want to do a database migration. The advantage is that you can work at the upgrade and still have your old installation available. Read this page before you decide if this strategy meets your needs:

If you don’t want to do a database migration, I read that you can use psconfig –upgrade to do an inplace or side by side (gradual) upgrade. You can use stsadm –o upgrade to force the the upgrade again from where it left of (assuming it fails) and I assume if you didn’t start it yet also. In my case I am doing a database migration and need to make it run again. I think this is the same as doing an inplace and giving it the new url that points to MOSS site we create (later). 

NOTE: Once a site definition has been converted you need to start the conversion over again on a virgin SPS2003 content database. It doesn’t reconvert the site definitions. In other words any custom mapping file you created can only be applied once before you have to start over. For more information on migrating Custom Site Definitions, see my other blog entry.

.

Summary of Actions

Below is a quick overview of what you need to do. Please see the sections after this section for more details on pre-requisites, more details, etc for each of these steps

On SharePoint Server

Run PRESCAN

cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>

PRESCAN.EXE /c preupgradescanconfig.xml /ALL

Review log / summary generated by it. Search for word error and review end of file for summary counts.

On Database Server (or any SQL Server Management Studio)

Backup content database

Restore content database under another name (i.e. CompanyName_WSS_Content)

On MOSS 2007 Central Administration

Create new web application in MOSS

WARNING: Do NOT specify the content database as the one from above (i.e. CompanyName_WSS_Content)

WARNING: Do NOT click on the Create the Site Collection link

On SharePoint Server

Install Custom Site Definitions, Mapping files, etc

Make sure the following paths have your necessary files

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\MyCustomSiteDefinition

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML\WEBTEMPMyCustomSiteDefinition.xml

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG\UPGRADE\MyCustomSiteDefinitionWssUpgrade.xml

Add Content Database

cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN

stsadm.exe -o addcontentdb -url http://hostname:port -databasename CompanyName_WSS_Content -databaseserver host\instancename

Review C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS\Upgrade.log for errors, exceptions, warnings, etc. These are good keywords to search on

Remove Temp Content Database

Pre-upgrade requirements

Since I am running MOSS 2007 already, I by definition have the .NET Framework 3.0 and ASP.NET 2.0 enabled in IIS. For more information on how to install these, see here.

According to this page you also should make sure that the minimum permissions for the account that you use to run Setup and the SharePoint Products and Technologies Configuration Wizard are:

  • Member of the Administrators group on the local computer that runs Office SharePoint Server 2007.

  • In SQL Server, the account must be:

  • Authorized to access all SharePoint Products and Technologies databases.

  • Granted the Database Creators (dbcreator) fixed server role.

  • Granted the Security Administrators (securityadmin) fixed server role.

I would also recommend reviewing  this: http://technet.microsoft.com/en-us/library/cc303417.aspx for more details on pre-upgrade steps.

If you are doing this on a production system, PLEASE backup your stuff; at least the databases. Please understand, I can’t begin to explain everything in one blog post that takes Microsoft 238 pages in this ebook. This is just what I did.

Backing up your Content database

NOTE: This step is optional, but is always a good idea. Backup up your content database BEFORE you run the Prescan tool since it does change your content database a little.

The content database in SharePoint Portal Server typically end in _SITE. For example, SPS2003_SITE. Just use the typical database tools (For example Enterprise Manager or MS SQL Server Management Studio) to do the backup.

Install Custom Site Definitions, Mapping files, etc

Make sure the following paths have your necessary files

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\SiteTemplates\MyCustomSiteDefinition

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\XML\WEBTEMPMyCustomSiteDefinition.xml

C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG\UPGRADE\MyCustomSiteDefinitionWssUpgrade.xml

Run Prescan

If you didn’t do this, do it now. Open a command prompt and execute the following (assuming you installed MOSS 2007 in the default location, otherwise you’ll need to adjust the path to your location).

cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN>

PRESCAN.EXE /c preupgradescanconfig.xml /ALL

NOTE: The /c preupgradescanconfig.xml must be used if you are upgrading from SPSS 2003 like we are.

Running it with the /ALL will not affect your MOSS 2007 installation. It only scans the older versions of SharePoint (SPS2003) from what I can tell. At least that is all it did for me.

You can also use the /V to specify the path. Use /? switch to get all the command line options

Search the generated file for the word error to see if you have any big errors

I recommend keeping the command prompt open. We’ll need it later.

Set the previous version databases to be read-only

Be sure you capture all of the data in your backup so that you are restoring and upgrading the current state of your environment. Therefore, set the previous version databases to read-only so that users cannot add or change information in the sites. With the databases set to read-only, users can continue to view content, but they are not able to add or change content.

clip_image001Important:

Before you perform these procedures, be sure that you have run the pre-upgrade scan tool on the sites stored in the databases. If you do not run the pre-upgrade scan tool on the data before you back the databases up, you will not be able to upgrade the data on your new server farm.

clip_image002Set a database to read-only in SQL Server 2000

1. In Microsoft SQL Server Enterprise Manager, right-click the name of the database that you want to set to read-only, and then click Properties.

2. In the Properties dialog box, click the Options tab.

3. Under Access, select the Read-only check box, and then click OK.

clip_image002[1]Set a database to read-only in SQL Server 2005

1. In SQL Server Management Studio, right-click the name of the database that you want to set to read-only, and then click Properties.

2. In the Select a page section, click Options.

3. In the right pane, under Other options, in the State section, next to Database Read-Only, click the down arrow, and then select True.

NOTE: This section was taken directly from age 138 of Upgrading to Office SharePoint Server 2007 (Free eBook).

 

Backing up your Content database

NOTE: This backup is a MUST because it will be used to restore from. Run prescan BEFORE you do this backup. You will now have one or two back ups depending if you did the optional backup or not. This is the backup you will use for the restore and upgrade. The other backup is just incase you need to rollback to SharePoint Portal Server 2003.

The content database in SharePoint Portal Server typically end in _SITE. For example, SPS2003_SITE. Just use the typical database tools (For example Enterprise Manager or MS SQL Server Management Studio) to do the backup.

NOTE: While backing up the database the web front end will likely fail when loading a page.

Restore your Content Database

Use the typical database tools (For example Enterprise Manager or MS SQL Server Management Studio) to restore the database you just backed up. Be sure to restore it as a different name from the database name. This will change the filename as well, which is good. Be sure to uncheck the Overwrite the existing database checkbox so you don’t accidentally forget to change the database name and overwrite the original or other database.

You will want to give some thought as to what the name of this will be since it will be your new content database. I like CompanyName_WSS_Content.

NOTE: Be sure to change the database (that you just restored) from read-only to read write again. Otherwise the upgrade probably won’t work too well.

Create a new web application in MOSS 2007

NOTE: If you want to save yourself some steps later, you can stop your SharePoint Portal Server 2003 IIS web application (using IIS). Then when you create your application, you can use the old url that you had for SPS2003. Be aware that this has the downside of everyone seeing the new site immediately, and the old site being down longer. If you have scheduled downtime and good communication this method may be acceptable, but it does pose the opportunity for users to make change when you are not ready for it to go live yet.

Go to SharePoint Central Administration | Application Management tab | SharePoint Web Application Management section | Create or extend Web application link. Click that link. Now, click the Create a new Web application link. Set the url to a new url (it can’t be the existing one).  Set the Database Name to Temp_WSS_Content or something since we won’t keep it for long. In particular, do not set it to what the name of the database we restored above. After filling in all the fields, click OK.

When the web application is finished being created, you will see a page like the following:

image

Do NOT create a new Site Collection! This is VERY important. In other words do NOT click the Create Site Collection link shown above

Add Content Database

Now we need to add the Content database ( the one we restored) to SharePoint so it knows about it. This is also the point where the database is converted from SPS2003 content database to a MOSS2007 content database. This step may take a while since this is were the actual conversion takes place. To see the status of the conversion you can check the log file (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\LOGS\Upgrade.log)

You MUST use stsadm to add the content database. The UI will let you try but tell you it can’t because the operation could timeout if you are using a browser and that you should use stsadm instead.

Be sure to specify the Web Application is the one you just created above when you created the web application!

Be sure you specify the information to the database that we restored.

cd C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN

stsadm.exe -o addcontentdb -url http://hostname:port -databasename CompanyName_WSS_Content -databaseserver host\instancename

NOTE: \instance name for the databaseserver parameter is optional and only needed if your database is not on the default instance of SQL Server. This is common for a Clustered environment or where you have more than one SQL Server installed on one ser

The databaseuser and databasepassword are for SQL database users only. If you are using Windows Authentication, you don’t need these parameters since they will be passed from the context that you execute stsadm. So, make sure that user has the correct permissions.

Depending on the size of your content database the addcontentdb command may take a while. I have a 10GB on a low end server and it took well over 35 minutes (I had to leave while it was processing after 35, so I don’t know how long it actually took). Your mileage may vary.

For more info see here.

Remove the Content database

Now we need to remove the temporary Content database that was created in the above step from SharePoint and also delete it. You can use stsadm to do this, but I like the UI. Your choice, to use the UI do the following. Go to SharePoint Central Administration | Application Management tab | SharePoint Web Application Management section | Content databases link.

Be sure to change the Web Application to the one you just created above!

Click the Content database that you specified (Temp_WSS_Content ) when you created the web application above.

Click the Remove content database checkbox. This won’t delete the database from SQL Server though. You will need to do that once you have removed it. You may also want to wait until you are finished with the upgrade.

Estimated Time

There is no real way for me to say how long it will take you, but my test server is fairly old and my content database is 10GB. It roughly took me 1 hr 43 minutes to do it. Below is the breakdown of the time per step. Don’t forget to leave time to review the conversion. Also, the content will need to be indexed again so make sure customers are aware of it.

Prescan - 5 minutes
Review prescan - 3 minutes
Backup db (11GB) - 7 minutes
Restore db (11GB) - 10 minutes
Web App Creation - 8 minutes
Install Site Definitions - 8 minutes (approximately)
Add Content DB - 60 minutes (approximately)
Delete Temp Content DB - 2 minutes

Troubleshooting

I did run the prescan tool, but it says I didn’t.

Q: I get the following message:

The pre-upgrade scan tool has not yet been run on this database SPContentDatabase Name=CompanyName_WSS_Content Parent=SPDatabaseServiceInstance Name=dbhostname. You must run the pre-upgrade scan tool before you can continue with the upgrade process. Run the tool from the following path: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\bin\prescan.exe.

Troubleshoot issues with Windows SharePoint Services.

A: I got this problem when I applied MOSS 2007 Service Pack 3 then backed up and restored the database. I guess Service Pack 3 changes the database. It is also possible I forgot to run prescan.exe on the database before I backed it up.

 

References

1 comment:

harry said...

Hi,

This artical is very useful for me. I am a Share Point developer and always looking to learn something new. I would like to introduce another good SharePoint blog, Have a look.

http://SharePointBank.com
Harry