25 November, 2013

Restore site collection within the same farm

We are aware that requirement can be of any form, it might be logically possible or not but when the requirements arises then clock start ticking and task assignment counter starts! :)

One of our users requested such kind of strange request that he wanted the backup of one of the web application to get restored in the same farm with different web application, I tried my level best to convince him that I can get this one restored in development/stage and not understanding the logic of same replica within same farm! But he seems to get this one done so I tried my research and started taking the backup by SQL console.

Backup completed successfully and now the turn of restore – keeping my fingers crossed! Let me tell you guys- you might have done so many backup-restorations across multiple farms but this seems to be unique.
Why unique? – Because you are restoring that backup within the same farm.

As soon as I hit the restore command-BOOM :) it got failed!

Resolution:-

As per this reference- It is not possible to create a duplicate site collection using Content Database backup method. This is because when you restore the content database backup on another empty database the site collection ID remains the same.

Because of this, even if you add the new restored content database both the content databases will have the same site collection ID and that is the reason why the central admin shows only one site collection.

Pretty straight forward to understand and the only possible way to accomplish this requirement are either by PowerShell or by stsadm.

Step –by- details:-
1)   Create a web application by the generic way either by central administration or by PowerShell
2)   By this way – a new database will be created which has an altogether different ID
3)   Take the backup of the main web application that you want to restore on new one by using PowerShell command- Backup-SPSite -Identity “http://amolsharepointgalaxy.com” -Path "E:\Backup\galaxy.bak"
4)   Restore the backup on to the web application that you have created in the step#1
5)   That’s it- you are done.

If you have any queries/questions regarding the above mentioned information then please let me know, Thank you.

6 comments:

  1. I was wondering if you ever considered changing the structure of your blog?
    Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better.
    Youve got an awful lot of text for only having one or 2 pictures.
    Maybe you could space it out better?

    Here is my webpage; mmorpg

    ReplyDelete
  2. Use PowerShell command to backup and restore SharePoint site within or out side the farm, just make sure you have same SQL server version in both environment.

    Backup-SPSite http://server_name/sites/site_name -Path "C:Backupsite_name.bak"
    http://technet.microsoft.com/en-us/library/ff607901.aspx

    Restore-SPSite http://server_name/sites/site_name -Path "C:Backupsite_name.bak"
    http://technet.microsoft.com/en-us/library/ff607788.aspx

    Also you can use the -Force parameter in the restore command, if you want to overwrite the previous backup on the existing (working) site content database.

    Restore-SPSite http://server_name/sites/site_name -Path "C:Backupsite_name.bak" -Froce

    -Tariq Afzal
    Assistant Manager

    ReplyDelete
  3. Amol...if you are trying to restore the site collection via SQL with the DBAttach method that won't work because the GUID inside the database is already registered with the farm in the original site collection. You'll need to create new site collection in Central Admin and then do a backup in SharePoint. Once you have this then you can do a restore into the new site collection you created. Now you will have separate GUID's which makes SharePoint happy and the content from your original Site Collection.

    Hopefully this helps.
    By Steve Pucelik

    ReplyDelete
  4. Yes Amol. I also agree with Steve. I have faced this type issues a lot.
    A lot means, Sometime, schema is not same (While deploying on different FARM server) some time id issue,etc..

    Ajeet

    ReplyDelete

Your feedback is always appreciated. I will try to reply to your queries as soon as possible- Amol Ghuge

Note: Only a member of this blog may post a comment.