Thursday, August 30, 2007

SharePoint Tips

SharePoint Portal Server Data Backup and Restore Utility Understanding the files generated by utility "SharePoint Portal Server Data Backup and Restore" is a utility that comes with SharePoint Portal Server 2003 used to backup all SharePoint sites. This includes the Portal and Windows SharePoint Sites. The .SPB backup files created by the utility are really just backup files that you could have created using Enterprise Manager. The utility also creates a XML file as well that lists the three databases: *_PROF means PROFILE *_SITE means SITE *_SERV means Services NOTE: There is a bug when using "Full-text search and index component" and SQL 2005 as your backend. The SharePoint Backup and Restore utility errors out because the index and the datafile both try to restore to the same location. This KB article tells you how to enable (and you can see how to disable) the "Full-text search and index component" if you are having this problem. If you are trying to restore a backup and must have this feature enabled, then you can get a hotfix by contacting Microsoft (no direct download link) as described in the KB article: I have not verified it, but I think if you use MS SQL to restore the backup files directly and then Use the Create / Restore Portal in the SharePoint Central Administration web page to add the databases to the configuration database, then this should work fine. NOTE: I was able to use Enterprise Manager to restore files. However, this does not add a Portal. I tried restoring from the Create Portal page, but it didn't work. I think if I had the configuration database backed up also, this would have worked. The configuration database is NOT backed by the utility. Enterprise Manager or similar tool must be used. Where are the log files? C:\Program Files\SharePoint Portal Server\Logs Look for a file similar to SPS_00003364_SPSBACKUP.LOG NOTE: This is the location of many other logs such as the Portal Creation log which is something like: SPS_SiteCreation_<site name>.Log Version of SharePoint Must match In order for the utility to succeed, make sure you have the EXACT same version of SharePoint Portal Server 2003 and Windows SharePoint Services. This includes Service Packs and Hotfixes. If an restore fails typically you don't need to backup and restore again, you just need to restore once you have made the version the same. If version are different, you may get a message like:
Portal creation failed Microsoft.SharePoint.SPException: The database schema is too old to perform this operation in this SharePoint cluster. Please upgrade the database and try again. ---> System.Runtime.InteropServices.COMException (0x81070571): The database schema is too old to perform this operation in this SharePoint cluster. Please upgrade the database and try again.
Restoring a Database Using MS SQL Server You can use MS Enterprise Manger for SQL Server 2000 or MS SQL Server Management Studio to restore the 3 .SPB files. 1. Restore .SPB files (they are really just standard MS SQL backup files) into the database of your choice. NOTE: The configuration database can and should be recreated when moving to a new machine and thus does not need to be backed manually (SharePoint Portal Server Data Backup and Restore doesn't back it up either) and does not need to be restored either. 2. Go to the SharePoint Central Administration web page and choose "Create a portal site" under the "Portal Site and Virtual Server Configuration" section. 3. Click the Restore radio button, and fill in the names of the databases you restored. 4. If this is a new server that you restored to, you will need to modify some of the data in the database. This of course is not support by Microsoft. I have not had any issues doing this, but I cannot be held responsible if it does cause any errors as any database changes to SharePoint is not supported by Microsoft (or me for that matter). 5. At this point, the SharePoint portal should come up without errors. You should be able to create a new Windows SharePoint Services site without errors. If you have Site Definitions, themes, etc defined specifically for your purposes, you will most likely need to install and configure them before existing WSS sites will come up without error. 6. If you are using SharePoint Portal Server to keep a listing of your sites through its Sites page, you will need to update each reference to the since they are stored in the database and still point to the old server. You can always type them in the browser directly, but it is probably best to correct this to avoid accidentally hitting the production or old server. If you have a few sites, you can change this by hand, if you have a lot of sites I recommend a SQL update statement. The easiest way I have found to do this is to do a global search in replace in all three databases (not config, just Profile, Services, Site). I use something like SearchAndReplaceAllTAbles '', '' SearchAndReplaceAllTAbles '', '' SearchAndReplaceAllTAbles 'http://sharepoint', ''
SearchAndReplaceAllTAbles '', '' SearchAndReplaceAllTAbles '', ''
SearchAndReplaceAllTAbles 'sharepoint', ''
Here is the source code for this SearchAndReplaceAllTables stored procedure: I recommend looking at what will be replaced first, I recommend using SearchAllTables first. Here is the source: The url is not always fully qualified, some have ports, http, sts, etc so you may need to be strategic in the order and what you replace. The above should get most of it though. Please remember, this is a very big change. I highly recommend you look at what is being replaced and test, test, test the first time you do it to make sure nothing broke. When you are done, searches and site directory should be accurate again. You may find some images on particular sites still point old server and / or don't load. You may need to change them manually.

No comments: