SharePoint 2007 pre upgrade check fails

2017-12-11T09:20:03+00:00 April 19th, 2011|Sharepoint|

We were running through an upgrade from SharePoint 2003 to SharePoint 2007 in our test environment and came across this error when trying to attach a content database in 2007:

The pre-upgrade scan tool has not yet been run on this database SPContentDatabase Name=DATABASENAME Parent=SPDatabaseServiceInstance. 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 FilesCommon FilesMicrosoft SharedWeb Server Extensions12binprescan.exe.

We had already run the prescan.exe tool on the database and we thought that we had resolved the errors that it produced.

What we had to do is use an SQL query on the affected database in query analyser to find any sites that the prescan.exe tool could not successfully scan or access:

SELECT FullUrl, Id FROM Sites WHERE bitflags NOT LIKE ‘262144’

In our case it only listed one personal site of a user that was no longer in use. We then ran the following command to delete the entry:

DELETE FROM Sites WHERE bitflags NOT LIKE ‘262144’

After the record had been deleted we re-ran the stsadm.exe to attach the database and it did it successfully.