You receive a "Database <Database_Name> already exists" error message when you manage your Windows SharePoint Services content database (828815)



The information in this article applies to:

  • Microsoft Windows SharePoint Services
  • Microsoft Office SharePoint Portal Server 2003

SYMPTOMS

When you try to manage your Microsoft Windows SharePoint Services content database by using the Manage Content Databases page in SharePoint Central Administration, you may receive one of the following error messages:
Database 'Database_Name' already exists. (Error code:1801)


The current user or the application pool identity of the virtual server is not the owner of the database 'sts_servername_1' on server 'server_name\share_point'.

CAUSE

This issue may occur when the database owner of the database that you are connecting to is different from the application pool identity that SharePoint is running under.

RESOLUTION

To resolve this issue, change the database ownership and the permissions for the content database to match the identities of the virtual server accounts for content and configuration. To do this, follow these steps:
  1. On the computer that is running Microsoft SQL Server, click Start, point to All Programs, point to Microsoft SQL Server, and then click Query Analyzer.
  2. In the Connect to SQL Server dialog box, type the server name in the SQL Server box, and then click OK.
  3. On the Query menu, click Change Database.
  4. In the Select Database of Server_Name box, click the content database that you want to update, and then click OK.
  5. In the Query pane, type the following query.

    Note In lines 3 and 4 of the query, replace Domain_Name\Content_Account and Domain_Name\Admin_Account with the domain account for the content virtual server and the domain account for the SharePoint Central Administration virtual server. If the accounts are the same, SQL Query Analyzer displays an error when you run the query, but the process still succeeds.

    DECLARE @AdminVSAccount nvarchar(255)
    DECLARE @ContentVSAccount nvarchar(255)
    SET @ContentVSAccount = N'Domain_Name\Content_Account';
    SET @AdminVSAccount = N'Domain_Name\Admin_Account';
    EXEC sp_grantlogin @ContentVSAccount;
    EXEC sp_grantlogin @AdminVSAccount;
    EXEC sp_changedbowner @AdminVSAccount;
    IF NOT EXISTS (SELECT * FROM sysusers WHERE name=@ContentVSAccount)
    EXEC sp_grantdbaccess @ContentVSAccount;
    EXEC sp_addrolemember 'db_owner', @ContentVSAccount;
  6. On the Query menu, click Execute.
If you are running Windows SharePoint Services with WMSDE, there are separate steps to resolve the problem. In the WMSDE installation, the application pool identity for the SharePoint Central Administration is Network Service. For SQL 2000, you cannot change the database owner to Network Service because of a design limitation. The workaround for WMSDE installations is to add Network Service to the SYSADMIN role in WMSDE, add the database back by using SharePoint Manage Content databases, and then drop the role for Network Service back to its original settings.

To set Network Service as SYSADMIN, follow these steps:
  1. Start an OSQL Session.

    To do so, click Start, click All Programs, click Accessories, and then click Command Prompt.
  2. At the command prompt, start an OSQL session by typing the following syntax where servername is the name of your server, and then pres ENTER:

    osql -S servername\sharepoint -E

  3. Type the following command, and then press ENTER:

    sp_addsrvrolemember 'nt authority\network service', 'sysadmin'

  4. Type go, and then press ENTER.
  5. In the SharePoint Central Administration, add the content database to the virtual server.
  6. After the content database is added back, drop Network Service role back to Security Administrators and Database Creators.
  7. Type the following command in the OSQL command prompt, and then press ENTER:

    sp_dropsrvrolemember 'nt authority\network service', 'sysadmin'

  8. Type go, and then press ENTER.
  9. Type quit to exit the OSQL session.

REFERENCES

For more information, see the Microsoft Windows SharePoint Services Administration Guide. For more information about required database owner permissions and database permissions, see the "Migrating from WMSDE to SQL Server" topic in the "Backup and Migration" topic.

Modification Type:MinorLast Reviewed:7/27/2006
Keywords:kbtshoot kbDatabase kberrmsg kbWebServices kbprb KB828815