The "Database 'Master' is causing a Companyweb Disaster...."

After installing the WSS SharePoint Service Pack for Small Business Server 2003, Companyweb fails to open - it returns the error "Cannot connect to the Configuration Database" . After checking the SharePoint services, The Microsoft SP Timer service was started, but the MSSQL$SHAREPOINT service was not. Started the service, refreshed the screen and the service had stopped once again....Hmmmmmmmmmmm.

This happened after installing the latest WSS SharePoint Service Pack for SBS. I ran the installation for the SP once again and it returned a notice stating the "Update had been previously installed ". Hmmmmmmmmm

Interestingly enough I noticed that the SharePoint Databases were NOT located in SBS' default installation path. The default path is C:\Program Files\Microsoft SQL Server\MSSQL$SHAREPOINT\Data. These were located in D:\Program Files\Microsoft SQL Server\MSSQL$SHAREPOINT\Data, but had worked without issue until the recent install of the WSS Service Pack.

I then opened the SharePoint SQL log - located in D:\Program Files\Microsoft SQL Server\MSSQL$SHAREPOINT\Log folder. In this folder there are a number of Errorlogs that keep track of SharePoint. In this log I noticed an unusual error:

SQL Error log returns; "Database 'Master' has invalid Schema"

Thats pointing to the Master.mdf located in the data folder.

Master.mdf and Mastlog.ldf are in place. Verifying the paths in the registry - HKLM\Software\Microsoft\Microsoft SQL Server\SharePoint\MSSQLSERVER\Parameters - the SQL keys are pointing to the correct drive. Hmmmmmmmmmmm

So here's what we have:

  1. MSSQL$SHAREPOINT service cannot maintain a "Started" state.
  2. We cannot connect to the SharePoint configuration database.
  3. Service Pack reinstall says the WSS SP has was installed.
  4. My SharePoint databases are located on a drive other than the default.
  5. The errorlogs are returning "Database 'Master' has invalid Schema".

Based on the information given it appears there is a problem with WMSDE. So why do I think that? 

  1. MSSQL$SHAREPOINT service depends on a successful WMSDE install or in this case upgrade/reinstall in order to function correctly. So.......what would happen if I reinstalled WMSDE, but this time manually reinstall it to the drive where the Companyweb databases were being stored.
  2. This would allow SharePoint to connect to the Configuration database if I reattached them.
  3. This would also rebuild the Master.mdf.

Danger, Danger, Will Robinson.......

Things can happen if you reinstall WMSDE and you are not aware of some of the things that can happen. Reinstalling WMSDE should not be your first line of defense! 

There are many programs that can quit on you by modifying this. Some of the programs are WSUS, Veritas Backup Exec, and Symantec Anti-Virus to name a few. Before proceeding you should consider what other programs maybe using WSMDE instances as well.

So how do I manually reinstall WMSDE on SBS?

  1. Make a backup of the databases in the MSSSQL$SHAREPOINT\DATA folder.
  2. Add/Remove Programs Uninstall “Microsoft SQL Server Desktop Engine (SHAREPOINT)
  3. Copy out then remove any files in the MSSQL$SHAREPOINT\Binn, Data, Install, and Log folder. Leave the folders.
  4. You will need SBS CD #3 (change paths as needed):
    F:\sbs\CLIENT~2\SHAREPT\sqlrun16.msi DISABLENETWORKPROTOCOLS=1 DISABLEAGENTSTARTUP=1 DISABLETHROTTLE=1 SAPWD=2194032892 INSTANCENAME=SharePoint
    DATADIR="<Drive letter with databases>:\Program Files\Microsoft SQL Server\" /l*v C:\wsmde.log
  5. Copy the STS_servername*.* and STS_Config*.* databases from the previous backup of the DATA folder to the new DATA folder in this example of C:\Microsoft SQL Server\MSSQL$SHAREPOINT\DATA.
  6. Start the MSSQL$SHAREPOINT service.

Attach the databases: <From a command Prompt>
osql -E -S <servername> \sharepoint

1>EXEC sp_attach_db @dbname = 'STS_Config', @filename1 = 'C:\Microsoft SQL Server\MSSQL$SHAREPOINT\Data\STS_Config.mdf', @filename2 = 'C:\Microsoft SQL Server\MSSQL$SHAREPOINT\Data\STS_Config_log.LDF' <ent>
2>go

1>EXEC sp_attach_db @dbname = 'STS_SERVERNAME_1', @filename1 = 'C:\Microsoft SQL Server\MSSQL$SHAREPOINT\Data\STS_SERVERNAME_1.mdf', @filename2 = 'C:\Microsoft SQL Server\MSSQL$SHAREPOINT\Data\ STS_SERVERNAME_1_log.LDF'
2>go

**Make sure the command is right! If there is something wrong it will return an error. Make sure the commands, paths and file names are correct. You will know that it has completed successfully when it returns a "1>". 

Now that my databases are attached, whats next?

Add User rights to the database: <From the OSQL command listed above>
exec sp_grantlogin 'DOMAIN3\SBS SP ADMINS'
go

exec sp_grantlogin 'NT AUTHORITY\NETWORK SERVICE'
go

exec sp_grantlogin ‘DOMAIN\Administrator'
go

Reinstalling WSS Service pack - Completed without an issue

Tested Companyweb and it work flawlessly.....

>edwalt