William's Blog Just another VSPUG – Virtual SharePoint User Group weblog

22Jun/073

MOSS Usage Log Processing File parsing

Parsing STS logs in SharePoint 2003 was fairly well documented. However, that is not the case yet in 2007. There is now some content about log parsing in 2007. It is written in C++, so this should still be useful. Given the number of libraries I've seen on the net referencing this code, I assume that is the case.

First, there is an additional 300 bytes added to the head of each log file. The additional 300 bytes contains the text "Windows SharePoint Services HTTP log file" followed by space characters making up the difference. You can simply ignore these.

Secondly, the header of the each entry appears to have grown as well, including the ordering of the definition.

Header Data (50 bytes)

Field Bytes Type

Unused

11 bytes

?

Site Url (length)

2 bytes

ushort

Web (length)

2 bytes

ushort

Doc (length)

2 bytes

ushort

Unknown

2 bytes

?

Bytes (data)

4 bytes

uint

HTTP Status (data)

2 bytes

ushort

Username (length)

2 bytes

ushort

QueryString (length)

2 bytes

ushort

Referral (length)

2 bytes

ushort

User Agent (length)

2 bytes

ushort

Command / Search Query (length)

2 bytes

ushort

Unused

15 bytes

?

Total

50 bytes

It also appears that the actual data has changed ordering a bit as well:

  1. Site GUID
  2. Timestamp
  3. Site Url
  4. Web
  5. Doc
  6. User
  7. QueryString
  8. Referral
  9. User Agent
  10. New GUID (don't know what this represents... anyone?)
  11. Command / Search Query

I've created a parser in C#:

using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Text;
using System.Runtime.InteropServices;
using System.ComponentModel;

namespace MOSS2007LogParser
{
    public class Parser
    {
        private const int FILEHEADERLENGTH = 300;
        private const int RECORDHEADERLENGTH = 50;

        private List<LogRecord> _logRecords = new List<LogRecord>();
        private void ReadLogFile(string logFilePath)
        {
            _logRecords.Clear();

            // Open a stream to the log file
            // I recommend using a Memory-mapped file here, as the files can grow quite large.
            // http://www.winterdom.com/dev/dotnet/ shows a fairly good implementation [see: FileMap]
            using (Stream s = File.OpenRead(logFilePath))
            {
                BinaryReader br = new BinaryReader(s);

                // Read the file header
                byte[] fileHeaderData = br.ReadBytes(FILEHEADERLENGTH);

                while (s.Position < s.Length)
                {
                    // Read the record header array
                    byte[] recordHeader = br.ReadBytes(RECORDHEADERLENGTH);
                    LogRecordHeader headerData = new LogRecordHeader(recordHeader);

                    // Get the length of the current record and read the array
                    int recordLength = headerData.RecordLength();
                    byte[] recordData = br.ReadBytes(recordLength);

                    _logRecords.Add(new LogRecord(headerData, recordData));
                }

                br.Close();
                s.Close();
            }
        }

        public DataSet GetLogDataSet(string logFilePath)
        {
            ReadLogFile(logFilePath);

            DataSet dsSTSLogs = new DataSet("dsSTSLogs");
            DataTable dtSTSLogs = new DataTable("dtSTSLogs");

            DataColumn dcTimeStamp = new DataColumn("TimeStamp");
            DataColumn dcSiteGuid = new DataColumn("SiteGUID");
            DataColumn dcSiteUrl = new DataColumn("SiteUrl");
            DataColumn dcWeb = new DataColumn("Web");
            DataColumn dcDocument = new DataColumn("Document");
            DataColumn dcUserName = new DataColumn("UserName");
            DataColumn dcQueryString = new DataColumn("QueryString");
            DataColumn dcReferral = new DataColumn("Referral");
            DataColumn dcUserAgent = new DataColumn("UserAgent");
            DataColumn dcCommand = new DataColumn("Command");
            DataColumn dcHttpStatus = new DataColumn("HttpStatus");
            DataColumn dcBytesSent = new DataColumn("BytesSent");

            dtSTSLogs.Columns.Add(dcTimeStamp);
            dtSTSLogs.Columns.Add(dcSiteGuid);
            dtSTSLogs.Columns.Add(dcSiteUrl);
            dtSTSLogs.Columns.Add(dcWeb);
            dtSTSLogs.Columns.Add(dcDocument);
            dtSTSLogs.Columns.Add(dcUserName);
            dtSTSLogs.Columns.Add(dcQueryString);
            dtSTSLogs.Columns.Add(dcReferral);
            dtSTSLogs.Columns.Add(dcUserAgent);
            dtSTSLogs.Columns.Add(dcCommand);
            dtSTSLogs.Columns.Add(dcHttpStatus);
            dtSTSLogs.Columns.Add(dcBytesSent);

            dsSTSLogs.Tables.Add(dtSTSLogs);

            foreach (LogRecord record in _logRecords)
            {
                DataRow drRecord = dtSTSLogs.NewRow();

                drRecord["TimeStamp"] = record.TimeStamp;
                drRecord["SiteGUID"] = record.SiteGUID;
                drRecord["SiteUrl"] = record.SiteUrl;
                drRecord["Web"] = record.Web;
                drRecord["Document"] = record.Document;
                drRecord["UserName"] = record.UserName;
                drRecord["QueryString"] = record.QueryString;
                drRecord["Referral"] = record.Referral;
                drRecord["UserAgent"] = record.UserAgent;
                drRecord["Command"] = record.Command;
                drRecord["HttpStatus"] = record.Status;
                drRecord["BytesSent"] = record.BytesSent;

                dtSTSLogs.Rows.Add(drRecord);
            }

            return dsSTSLogs;
        }
        public void ConvertToCSVFile(string logFilePath)
        {
            string defaultPath = Path.Combine(
                Path.GetDirectoryName(logFilePath),
                Path.GetFileNameWithoutExtension(logFilePath)) + ".csv";

            ConvertToCSVFile(logFilePath, defaultPath);
        }

        public void ConvertToCSVFile(string logFilePath, string csvFilePath)
        {
            ReadLogFile(logFilePath);

            string recordLineFormat = "{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11}";

            using (StreamWriter sw = File.CreateText(csvFilePath))
            {
                foreach (LogRecord record in _logRecords)
                {
                    sw.WriteLine(String.Format(recordLineFormat,
                        record.TimeStamp,
                        record.SiteGUID,
                        record.SiteUrl,
                        record.Web,
                        record.Document,
                        record.UserName,
                        record.QueryString,
                        record.Referral,
                        record.UserAgent,
                        record.Command,
                        record.BytesSent,
                        record.Status));
                }

                sw.Close();
            }
        }
    }

    public class LogRecordHeader
    {
        public const int STANDARD_GUID_LENGTH = 36;
        public const int STANDARD_TIMESTAMP_LENGTH = 8;

        private byte[] _recordHeader;

        private int _siteUrlLength;
        public int SiteUrlLength
        {
            get { return _siteUrlLength; }
        }

        private int _webLength;
        public int WebLength
        {
            get { return _webLength; }
        }

        private int _docLength;
        public int DocLength
        {
            get { return _docLength; }
        }

        private int _userNameLength;
        public int UserNameLength
        {
            get { return _userNameLength; }
        }

        private long _bytesSent;
        public long BytesSent
        {
            get { return _bytesSent; }
        }

        private int _httpStatus;
        public int HttpStatus
        {
            get { return _httpStatus; }
        }

        private int _queryStringLength;
        public int QueryStringLength
        {
            get { return _queryStringLength; }
        }

        private int _referralLength;
        public int ReferralLength
        {
            get { return _referralLength; }
        }

        private int _userAgentLength;
        public int UserAgentLength
        {
            get { return _userAgentLength; }
        }

        private int _commandLength;
        public int CommandLength
        {
            get { return _commandLength; }
        }

        public LogRecordHeader(byte[] recordHeader)
        {
            this._recordHeader = recordHeader;
            this._siteUrlLength = BitConverter.ToUInt16(recordHeader, SITEURL_OFFSET);
            this._webLength = BitConverter.ToUInt16(recordHeader, WEB_OFFSET);
            this._docLength = BitConverter.ToUInt16(recordHeader, DOC_OFFSET);
            this._bytesSent = BitConverter.ToUInt32(recordHeader, BYTESSENT_OFFSET);
            this._httpStatus = BitConverter.ToUInt16(recordHeader, HTTPSTATUS_OFFSET);
            this._userNameLength = BitConverter.ToUInt16(recordHeader, USERNAME_OFFSET);
            this._queryStringLength = BitConverter.ToUInt16(recordHeader, QUERYSTRING_OFFSET);
            this._referralLength = BitConverter.ToUInt16(recordHeader, REFERRAL_OFFSET);
            this._userAgentLength = BitConverter.ToUInt16(recordHeader, USERAGENT_OFFSET);
            this._commandLength = BitConverter.ToUInt16(recordHeader, COMMAND_OFFSET);
        }

        private const int SITEURL_OFFSET = 12;
        private const int WEB_OFFSET = 14;
        private const int DOC_OFFSET = 16;
        private const int BYTESSENT_OFFSET = 20;
        private const int HTTPSTATUS_OFFSET = 24;
        private const int USERNAME_OFFSET = 26;
        private const int QUERYSTRING_OFFSET = 28;
        private const int REFERRAL_OFFSET = 30;
        private const int USERAGENT_OFFSET = 32;
        private const int COMMAND_OFFSET = 34;

        public int RecordLength()
        {
            return  STANDARD_GUID_LENGTH + 1 +
                    STANDARD_TIMESTAMP_LENGTH + 1 +
                    SiteUrlLength + 1 +
                    WebLength + 1 +
                    DocLength + 1 +
                    UserNameLength + 1 +
                    QueryStringLength + 1 +
                    ReferralLength + 1 +
                    UserAgentLength + 1 +
                    STANDARD_GUID_LENGTH + 1 +
                    CommandLength + 1;
        }
    }

    public class LogRecord
    {
        private string _siteGuid;
        public string SiteGUID
        {
            get { return _siteGuid; }
        }

        private string _timeStamp;
        public string TimeStamp
        {
            get { return _timeStamp; }
        }

        private string _siteUrl;
        public string SiteUrl
        {
            get { return _siteUrl; }
        }

        private string _web;
        public string Web
        {
            get { return _web; }
        }

        private string _document;
        public string Document
        {
            get { return _document; }
        }

        private string _userName;
        public string UserName
        {
            get { return _userName; }
        }

        private string _queryString;
        public string QueryString
        {
            get { return _queryString; }
        }

        private string _referral;
        public string Referral
        {
            get { return _referral; }
        }

        private string _userAgent;
        public string UserAgent
        {
            get { return _userAgent; }
        }

        private string _command;
        public string Command
        {
            get { return _command; }
        }

        private int _status;
        public int Status
        {
            get { return _status; }
        }

        private long _bytesSent;
        public long BytesSent
        {
            get { return _bytesSent; }
        }

        public LogRecord(LogRecordHeader headerData, byte[] recordData)
        {
            int timeStampOffset = LogRecordHeader.STANDARD_GUID_LENGTH + 1;
            int siteUrlOffset = timeStampOffset + LogRecordHeader.STANDARD_TIMESTAMP_LENGTH + 1;
            int webOffset = siteUrlOffset + headerData.SiteUrlLength + 1;
            int documentOffset = webOffset + headerData.WebLength + 1;
            int userNameOffset = documentOffset + headerData.DocLength + 1;
            int queryStringOffset = userNameOffset + headerData.UserNameLength + 1;
            int referralOffset = queryStringOffset + headerData.QueryStringLength + 1;
            int userAgentOffset = referralOffset + headerData.ReferralLength + 1;
            int commandOffset = userAgentOffset + headerData.UserAgentLength + LogRecordHeader.STANDARD_GUID_LENGTH + 2;

            Encoding enc = UTF8Encoding.Default;

            _siteGuid = enc.GetString(recordData, 0, LogRecordHeader.STANDARD_GUID_LENGTH);
            _timeStamp = enc.GetString(recordData, timeStampOffset, LogRecordHeader.STANDARD_TIMESTAMP_LENGTH);
            _siteUrl = enc.GetString(recordData, siteUrlOffset, headerData.SiteUrlLength);
            _web = enc.GetString(recordData, webOffset, headerData.WebLength);
            _document = enc.GetString(recordData, documentOffset, headerData.DocLength);
            _userName = enc.GetString(recordData, userNameOffset, headerData.UserNameLength);
            _queryString = enc.GetString(recordData, queryStringOffset, headerData.QueryStringLength);
            _referral = enc.GetString(recordData, referralOffset, headerData.ReferralLength);
            _userAgent = enc.GetString(recordData, userAgentOffset, headerData.UserAgentLength);
            _command = enc.GetString(recordData, commandOffset, headerData.CommandLength);
            _status = headerData.HttpStatus;
            _bytesSent = headerData.BytesSent;
        }
    }
}
Filed under: Uncategorized 3 Comments
2Jun/070

Event ID 202 – SharePoint Portal Administration Service

We were seeing the following error in the Event Log on our MOSS WFE every 30 seconds:
 
Event Type: Error
Event Source: SharePoint Portal Administration Service
Event Category: None
Event ID: 202
Date: 2/22/2007
Time: 11:43:10 AM
User: N/A
Computer: REMOVED
Description:
Synchronization exception occurred For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp
Data:
0000: 41 00 70 00 70 00 44 00   A.p.p.D.
0008: 6f 00 6d 00 61 00 69 00   o.m.a.i.
0010: 6e 00 3a 00 20 00 73 00   n.:. .s.
0018: 70 00 73 00 61 00 64 00   p.s.a.d.
0020: 6d 00 69 00 6e 00 2e 00   m.i.n...
0028: 65 00 78 00 65 00 0d 00   e.x.e...
0030: 0a 00 53 00 79 00 73 00   ..S.y.s.
0038: 74 00 65 00 6d 00 2e 00   t.e.m...
0040: 44 00 61 00 74 00 61 00   D.a.t.a.
0048: 2e 00 53 00 71 00 6c 00   ..S.q.l.
0050: 43 00 6c 00 69 00 65 00   C.l.i.e.
0058: 6e 00 74 00 2e 00 53 00   n.t...S.
0060: 71 00 6c 00 45 00 78 00   q.l.E.x.
0068: 63 00 65 00 70 00 74 00   c.e.p.t.
0070: 69 00 6f 00 6e 00 3a 00   i.o.n.:.
0078: 20 00 53 00 79 00 73 00    .S.y.s.
0080: 74 00 65 00 6d 00 2e 00   t.e.m...
0088: 44 00 61 00 74 00 61 00   D.a.t.a.
0090: 2e 00 53 00 71 00 6c 00   ..S.q.l.
0098: 43 00 6c 00 69 00 65 00   C.l.i.e.
00a0: 6e 00 74 00 2e 00 53 00   n.t...S.
00a8: 71 00 6c 00 45 00 78 00   q.l.E.x.
00b0: 63 00 65 00 70 00 74 00   c.e.p.t.
00b8: 69 00 6f 00 6e 00 3a 00   i.o.n.:.
00c0: 20 00 43 00 6f 00 75 00    .C.o.u.
00c8: 6c 00 64 00 20 00 6e 00   l.d. .n.
00d0: 6f 00 74 00 20 00 66 00   o.t. .f.
00d8: 69 00 6e 00 64 00 20 00   i.n.d. .
00e0: 73 00 74 00 6f 00 72 00   s.t.o.r.
00e8: 65 00 64 00 20 00 70 00   e.d. .p.
00f0: 72 00 6f 00 63 00 65 00   r.o.c.e.
00f8: 64 00 75 00 72 00 65 00   d.u.r.e.
0100: 20 00 27 00 64 00 62 00    .'.d.b.
0108: 6f 00 2e 00 70 00 72 00   o...p.r.
0110: 6f 00 63 00 5f 00 67 00   o.c._.g.
0118: 65 00 74 00 56 00 65 00   e.t.V.e.
0120: 72 00 73 00 69 00 6f 00   r.s.i.o.
0128: 6e 00 27 00 2e 00 0d 00   n.'.....
0130: 0a 00 20 00 20 00 20 00   .. . . .
0138: 61 00 74 00 20 00 4d 00   a.t. .M.
0140: 69 00 63 00 72 00 6f 00   i.c.r.o.
0148: 73 00 6f 00 66 00 74 00   s.o.f.t.
0150: 2e 00 53 00 68 00 61 00   ..S.h.a.
0158: 72 00 65 00 50 00 6f 00   r.e.P.o.
0160: 69 00 6e 00 74 00 2e 00   i.n.t...
0168: 50 00 6f 00 72 00 74 00   P.o.r.t.
0170: 61 00 6c 00 2e 00 44 00   a.l...D.
0178: 61 00 74 00 61 00 2e 00   a.t.a...
0180: 61 00 2e 00 63 00 28 00   a...c.(.
0188: 53 00 71 00 6c 00 43 00   S.q.l.C.
0190: 6f 00 6d 00 6d 00 61 00   o.m.m.a.
0198: 6e 00 64 00 20 00 41 00   n.d. .A.
01a0: 5f 00 30 00 2c 00 20 00   _.0.,. .
01a8: 42 00 6f 00 6f 00 6c 00   B.o.o.l.
01b0: 65 00 61 00 6e 00 20 00   e.a.n. .
01b8: 41 00 5f 00 31 00 29 00   A._.1.).
01c0: 0d 00 0a 00 20 00 20 00   .... . .
01c8: 20 00 61 00 74 00 20 00    .a.t. .
01d0: 4d 00 69 00 63 00 72 00   M.i.c.r.
01d8: 6f 00 73 00 6f 00 66 00   o.s.o.f.
01e0: 74 00 2e 00 53 00 68 00   t...S.h.
01e8: 61 00 72 00 65 00 50 00   a.r.e.P.
01f0: 6f 00 69 00 6e 00 74 00   o.i.n.t.
01f8: 2e 00 50 00 6f 00 72 00   ..P.o.r.
0200: 74 00 61 00 6c 00 2e 00   t.a.l...
0208: 44 00 61 00 74 00 61 00   D.a.t.a.
0210: 2e 00 61 00 2e 00 63 00   ..a...c.
0218: 28 00 53 00 71 00 6c 00   (.S.q.l.
0220: 43 00 6f 00 6d 00 6d 00   C.o.m.m.
0228: 61 00 6e 00 64 00 20 00   a.n.d. .
0230: 41 00 5f 00 30 00 2c 00   A._.0.,.
0238: 20 00 42 00 6f 00 6f 00    .B.o.o.
0240: 6c 00 65 00 61 00 6e 00   l.e.a.n.
0248: 20 00 41 00 5f 00 31 00    .A._.1.
0250: 29 00 0d 00 0a 00 20 00   )..... .
0258: 20 00 20 00 61 00 74 00    . .a.t.
0260: 20 00 4d 00 69 00 63 00    .M.i.c.
0268: 72 00 6f 00 73 00 6f 00   r.o.s.o.
0270: 66 00 74 00 2e 00 53 00   f.t...S.
0278: 68 00 61 00 72 00 65 00   h.a.r.e.
0280: 50 00 6f 00 69 00 6e 00   P.o.i.n.
0288: 74 00 2e 00 50 00 6f 00   t...P.o.
0290: 72 00 74 00 61 00 6c 00   r.t.a.l.
0298: 2e 00 44 00 61 00 74 00   ..D.a.t.
02a0: 61 00 2e 00 61 00 2e 00   a...a...
02a8: 62 00 28 00 53 00 71 00   b.(.S.q.
02b0: 6c 00 43 00 6f 00 6d 00   l.C.o.m.
02b8: 6d 00 61 00 6e 00 64 00   m.a.n.d.
02c0: 20 00 41 00 5f 00 30 00    .A._.0.
02c8: 29 00 0d 00 0a 00 20 00   )..... .
02d0: 20 00 20 00 61 00 74 00    . .a.t.
02d8: 20 00 4d 00 69 00 63 00    .M.i.c.
02e0: 72 00 6f 00 73 00 6f 00   r.o.s.o.
02e8: 66 00 74 00 2e 00 53 00   f.t...S.
02f0: 68 00 61 00 72 00 65 00   h.a.r.e.
02f8: 50 00 6f 00 69 00 6e 00   P.o.i.n.
0300: 74 00 2e 00 50 00 6f 00   t...P.o.
0308: 72 00 74 00 61 00 6c 00   r.t.a.l.
0310: 2e 00 44 00 61 00 74 00   ..D.a.t.
0318: 61 00 2e 00 61 00 2e 00   a...a...
0320: 62 00 28 00 53 00 71 00   b.(.S.q.
0328: 6c 00 43 00 6f 00 6d 00   l.C.o.m.
0330: 6d 00 61 00 6e 00 64 00   m.a.n.d.
0338: 20 00 41 00 5f 00 30 00    .A._.0.
0340: 29 00 0d 00 0a 00 20 00   )..... .
0348: 20 00 20 00 61 00 74 00    . .a.t.
0350: 20 00 4d 00 69 00 63 00    .M.i.c.
0358: 72 00 6f 00 73 00 6f 00   r.o.s.o.
0360: 66 00 74 00 2e 00 53 00   f.t...S.
0368: 68 00 61 00 72 00 65 00   h.a.r.e.
0370: 50 00 6f 00 69 00 6e 00   P.o.i.n.
0378: 74 00 2e 00 50 00 6f 00   t...P.o.
0380: 72 00 74 00 61 00 6c 00   r.t.a.l.
0388: 2e 00 54 00 6f 00 70 00   ..T.o.p.
0390: 6f 00 6c 00 6f 00 67 00   o.l.o.g.
0398: 79 00 2e 00 44 00 61 00   y...D.a.
03a0: 74 00 61 00 62 00 61 00   t.a.b.a.
03a8: 73 00 65 00 2e 00 61 00   s.e...a.
03b0: 28 00 61 00 20 00 41 00   (.a. .A.
03b8: 5f 00 30 00 29 00 0d 00   _.0.)...
03c0: 0a 00 20 00 20 00 20 00   .. . . .
03c8: 61 00 74 00 20 00 4d 00   a.t. .M.
03d0: 69 00 63 00 72 00 6f 00   i.c.r.o.
03d8: 73 00 6f 00 66 00 74 00   s.o.f.t.
03e0: 2e 00 53 00 68 00 61 00   ..S.h.a.
03e8: 72 00 65 00 50 00 6f 00   r.e.P.o.
03f0: 69 00 6e 00 74 00 2e 00   i.n.t...
03f8: 50 00 6f 00 72 00 74 00   P.o.r.t.
0400: 61 00 6c 00 2e 00 54 00   a.l...T.
0408: 6f 00 70 00 6f 00 6c 00   o.p.o.l.
0410: 6f 00 67 00 79 00 2e 00   o.g.y...
0418: 43 00 6f 00 6e 00 66 00   C.o.n.f.
0420: 69 00 67 00 75 00 72 00   i.g.u.r.
0428: 61 00 74 00 69 00 6f 00   a.t.i.o.
0430: 6e 00 44 00 61 00 74 00   n.D.a.t.
0438: 61 00 62 00 61 00 73 00   a.b.a.s.
0440: 65 00 2e 00 67 00 65 00   e...g.e.
0448: 74 00 5f 00 44 00 61 00   t._.D.a.
0450: 74 00 61 00 62 00 61 00   t.a.b.a.
0458: 73 00 65 00 56 00 65 00   s.e.V.e.
0460: 72 00 73 00 69 00 6f 00   r.s.i.o.
0468: 6e 00 28 00 29 00 0d 00   n.(.)...
0470: 0a 00 20 00 20 00 20 00   .. . . .
0478: 61 00 74 00 20 00 4d 00   a.t. .M.
0480: 69 00 63 00 72 00 6f 00   i.c.r.o.
0488: 73 00 6f 00 66 00 74 00   s.o.f.t.
0490: 2e 00 53 00 68 00 61 00   ..S.h.a.
0498: 72 00 65 00 50 00 6f 00   r.e.P.o.
04a0: 69 00 6e 00 74 00 2e 00   i.n.t...
04a8: 50 00 6f 00 72 00 74 00   P.o.r.t.
04b0: 61 00 6c 00 2e 00 41 00   a.l...A.
04b8: 64 00 6d 00 69 00 6e 00   d.m.i.n.
04c0: 69 00 73 00 74 00 72 00   i.s.t.r.
04c8: 61 00 74 00 69 00 6f 00   a.t.i.o.
04d0: 6e 00 53 00 65 00 72 00   n.S.e.r.
04d8: 76 00 69 00 63 00 65 00   v.i.c.e.
04e0: 2e 00 52 00 75 00 6e 00   ..R.u.n.
04e8: 28 00 29 00               (.).   

This was occurring on a SharePoint 2003 upgrade portal. The only thing we needed to fix was shutting down the SharePoint Portal Administration service. The errors stopped.

Filed under: Uncategorized No Comments
2Jun/070

SPS 2003 Restore – The database schema is too old to perform this operation in this SharePoint cluster

When I do 2007 upgrades. I typically like to restore the 2003 portal to a virtual server. What this typically means is that I need to determine the service packs on both machines, match SQL server version and service packs, etc. No matter how hard I tried in a couple of instances I always hit the same brick wall... "The database schema is too old to perform this operation in this SharePoint cluster. Please upgrade the database and try again"
 
Part of the problem for me is that most of the older portals I'm upgrading are running SQL 2000 with some Service Pack applied. I prefer to use SQL 2005. Depending on how proactive the IT team managing the portal was... Who knows what service packs were applied.
 
You can determine what version of SPS 2003 Service packs have been installed by using the system here.
 
You can try using the .spb files to use the Backup/Restore utility. At a minimum, this will attach the databases to the SQL 2005 instance. However, it will likely stil fail with the same message... "Schema too old."
 
My solution:
Install 2003 as you normally would. Then create a new portal and name it "Temp" or "Delete Me". Open up SQL Management and look at the SystemVersion table in the Site database for the newly created portal. Jot down the version number specified in the table. Now open up the Site database of the portal you are trying to restore, open the SystemVersion table and overwrite the version specified there. Go back to Central Admin and delete the temp portal, and now restore the problem child.
 
It should restore without a hitch now.

Filed under: Uncategorized No Comments