locked
STSADM mergecontentdbs command throwing site exists message RRS feed

  • Question

  • I receive the following error on performing the mergecontentdbs operation:
    Another site already exists at /sites/sitename. Delete this site before attempting to create a new site with the same URL, choose a new URL, or create a new inclusion at the path you originally specified.
    I am a farm admin and site collection admin of the site im trying to move. Also, I am added to the sysadmin group of the DB, and am a member of db_owner group of both the source and destination content dbs that i am trying to move.
    Also, the DB is attached only to 1 web application.
    I could perform the operation successfully at the DEV box though.

    Also, below is the error detail from event viewer:

     

    Duplicate unique index on SQL Server instance 'TPATSPDB01' in database 'Sharepoint_Config_int'. Additional error information from SQL Server is included below.

     

    Cannot insert duplicate key row in object 'dbo.SiteMap' with unique index 'IX_SiteMap_ApplicationId_Path'.

    The statement has been terminated.


    Any insights, leads, tips will be great (I ve googled a lot on this, but haven't hit a solution).
    Thanks!

    Ganesh.M




    • Edited by Ganesh.M Wednesday, December 28, 2011 12:57 PM Error details update
    Tuesday, December 27, 2011 12:22 PM

Answers

  • Thanks for the reply Rahul.

    We needed to move a lot of site collections at a time, using the XML from enumsites, that was reason why we were using the mergecontentdbs command.

    Finally, i found the reason for the error after a lot of investigation.

    Our content DB did have the owner of the DB as the farmadmin's account, but the farm account could not be added as an user to the contentdb, since the "dbo" user uses the account of the DB owner as the login name, thus adding the farm account to the DB was not being allowed (I found this out, while trying to move the site collection to another DB using DocAve, which showed an error in event viewer saying:

    Message: Cannot open database "WSS_Content_80_1GB" requested by the login. The login failed.
    Login failed for user 'DomainName\adminspFarmt'
    

    Therefore, you must make sure that the farm account is added as an user to the DB that you want to move, in our case, the account could not be added since the owner of the db was under the farm account, hence the login name of the “dbo” user is the farm account, but this prevents the farm account from being added as an user to the db, with the error “The user already exists”, the workaround used, was to change the DB owner to a different account name, and then adding the farm account to the DB as an user, which resolved the issue. 

    Still not sure what is the root cause of such an issue (i.e. why the farm account is not added by default etc). Guess a few changes to the environment are required.

    Thanks to all who helped with this!


    Ganesh.M
    • Marked as answer by Ganesh.M Tuesday, January 3, 2012 12:55 PM
    Tuesday, January 3, 2012 12:55 PM

All replies

  • Hi,

    Do you also have the same access levels to the sites in destination DB as well?

    If not then get that before carrying out this operation.

    The same is stated here:

     

    http://technet.microsoft.com/en-us/library/cc262923(office.12).aspx


    Thanks, Rahul Rashu
    Wednesday, December 28, 2011 4:14 AM
  • Hi Rahul,

    I am trying to move a site collection from 1 DB to another, the sites do not exist in the destination DB, therefore setting permissions on the sites on the destination DB, is not possible, since the site doesent exist there. But, if you meant permissions to the destination DB, yes i do have the necessary permissions.

     

    Also, below is the error detail from event viewer:

     

    Duplicate unique index on SQL Server instance 'DBServerName' in database 'Sharepoint_Config_int'. Additional error information from SQL Server is included below.

     

    Cannot insert duplicate key row in object 'dbo.SiteMap' with unique index 'IX_SiteMap_ApplicationId_Path'.

    The statement has been terminated.

     

    Thanks,

    Ganesh

     


    Ganesh.M
    • Edited by Ganesh.M Friday, December 30, 2011 9:44 AM
    Wednesday, December 28, 2011 7:30 AM
  • Hi Ganesh,

    Try to use the farm admin account to run the mergecontentdbs command, please check the following article with the similar error message,

    http://blogs.msdn.com/b/alimaz/archive/2008/05/21/getting-5762-error-moving-site-collections-to-separate-database-using-stsadm-mergecontentdbs.aspx

    Thanks


    Daniel Yang

    TechNet Community Support

    Thursday, December 29, 2011 7:22 AM
    Moderator
  • Try to use the farm admin account to run the mergecontentdbs command, please check the following article with the similar error message,

    http://blogs.msdn.com/b/alimaz/archive/2008/05/21/getting-5762-error-moving-site-collections-to-separate-database-using-stsadm-mergecontentdbs.aspx

     

    I used the Farm Admin account to open the server and tried running stsadm mergecontentdbs operation, but still i get the same error saying "Site already exists".  I even tried the apppool account, with no success.

    Please help/advice.

    Thanks!


    Ganesh.M

    • Edited by Ganesh.M Friday, December 30, 2011 9:35 AM info update
    Friday, December 30, 2011 9:10 AM
  • Hi,

    We will do this in the other way. Try following these steps:

    1. Take full backups of these two Dbs.

    2. Take STSADM backup of the site collection you have in first DB.

    3. Delete the same and remove the DB from farm.

    4. Now set the current number of sites as maximum in all content dbs except the second pone.

    5. Execute STSADM restore on the backup taken in step 2.

    6. Revert back the numbers altered in step 4.

    I hope this will help you out.


    Thanks, Rahul Rashu
    Friday, December 30, 2011 9:09 PM
  • Thanks for the reply Rahul.

    We needed to move a lot of site collections at a time, using the XML from enumsites, that was reason why we were using the mergecontentdbs command.

    Finally, i found the reason for the error after a lot of investigation.

    Our content DB did have the owner of the DB as the farmadmin's account, but the farm account could not be added as an user to the contentdb, since the "dbo" user uses the account of the DB owner as the login name, thus adding the farm account to the DB was not being allowed (I found this out, while trying to move the site collection to another DB using DocAve, which showed an error in event viewer saying:

    Message: Cannot open database "WSS_Content_80_1GB" requested by the login. The login failed.
    Login failed for user 'DomainName\adminspFarmt'
    

    Therefore, you must make sure that the farm account is added as an user to the DB that you want to move, in our case, the account could not be added since the owner of the db was under the farm account, hence the login name of the “dbo” user is the farm account, but this prevents the farm account from being added as an user to the db, with the error “The user already exists”, the workaround used, was to change the DB owner to a different account name, and then adding the farm account to the DB as an user, which resolved the issue. 

    Still not sure what is the root cause of such an issue (i.e. why the farm account is not added by default etc). Guess a few changes to the environment are required.

    Thanks to all who helped with this!


    Ganesh.M
    • Marked as answer by Ganesh.M Tuesday, January 3, 2012 12:55 PM
    Tuesday, January 3, 2012 12:55 PM