Backup/Restore a site collection in SharePoint 2007

Posted on 9/25/2007 @ 3:10 PM in #SharePoint by | Feedback | 25813 views

So we all know that Sharepoint 2007 has a fancy recycle bin. Well thats all good except if you delete an entire site or site collection itself. Then it doesn't show up in the recycle bin. Yes you read that right, not even in the administrator's recycle bin - that site - is "Gone".

Now you may think, as a good ASP.NET developer, that backing up databases is good enough. No it ain't.

So, here is something that I know you will find useful, note this down so you won't forget it.

Even if you haven’t customized (i.e. modified the css/aspx/.master files) the site, there is still a lot of configuration information that sites in SharePoint_Config databases, shared services etc.

The best way to backup a SharePoint site is –

Stsadm –o backup –url <SiteURL> -filename <FileName>

And then at a later date you can restore the site using

Stsadm –o restore –url <restoretoURL> -filename <filetorestorefrom>

A few things to be wary of –

a) The above commands must be run using proper access rights, or the restore will be half crap.

b) The above commands will restore/backup the site collection you specify at the URL. What it won’t restore is, all the configuration you need to do under shared services or SCAW. Say, if you had trusted locations defined under excel services, forms services configuration, search scopes – all that must be backed up separately.

c) You should still plan on backing up databases as a last oh shit resort.

Sound off but keep it civil:

Older comments..


On 12/15/2006 3:52:28 PM Mark said ..
Will the stsadm backup-restore take care of the modified css/aspx/.master files, webparts,features etc?


On 1/17/2007 4:29:51 PM Glater said ..
"The above commands must be run using proper access rights, or the restore will be half crap"

Thanks for the partial documentation, now I must go research "proper access rights" as you haven't explained it...


On 1/18/2007 4:34:59 AM Sahil Malik said ..
Glater,

You poor baby. I'm so sorry you had to read MSDN all by yourself. You poor poor baby.

SM


On 2/5/2007 10:06:27 PM swati said ..
Will the stsadm backup-restore take care of the modified css/aspx/.master files, webparts,features etc?


On 3/27/2007 4:37:02 PM Andrew Evrovski said ..
Can anyone please tell me "how" I can backup the Search Scopes, Keywords, and Best Bets? When I do an stsadm restore, not only does it not backup the above, but it also wipes them out ont he destination server (which I find retarded). Any help would be appreciated.

Andy


On 9/25/2007 11:41:08 AM kman said ..
Stsadm –o restore –url <restoretoURL> -file <filetorestorefrom>

should be

Stsadm –o restore –url <restoretoURL> -filename <filetorestorefrom>


On 9/25/2007 3:10:39 PM Sahil Malik said ..
Hey Kman - Thx for the comment, I fixed it!


On 2/27/2008 11:59:39 AM Phil said ..
Hi all, there is a tool that we just bought which automates this, we also used their version for 2003, ccompany is webfox.ca and the tool is Backup ELite sc 5, hope that helps. cheers phil


On 6/20/2008 5:35:08 AM raju said ..
Hey


when I took backup of sitecollection i didn't get cinfig file.how to take backup of web.config and how to restore


On 10/24/2008 7:37:46 PM Andy said ..
Hi.....I am in similar situation.....the problem is I didnt back up the site.....I am not sure if it is now possible to get the site back.....please have some comments over this


On 10/29/2008 2:52:39 AM Dok said ..
I backed up a site, and when I restore it on a new server, I don't get "Edit page" when I login as Site Administrator or Contributor except on the main page only!


why is that?


On 6/15/2009 9:41:04 AM Naor said ..
Will the stsadm backup-restore take care of the modified css/aspx/.master files, webparts,features etc? i didn't see the answer for that question.


On 7/21/2009 9:27:07 AM Pradip Pardeshi said ..
Steps:

1) Create new application with site collection.

2) Delete content database.

central administration - > application management - > sharepoint web application management - > content databases

i) click on wss_content_xxx


ii) select "remove content databases"


iii) click OK

3) Restore backup database (using moss functionality)

4) Run following command from command prompt

stsadm.exe -O addcontentdb -url http://xxx:111/sites/zzz -databasename wss_content_xxx

Thanks,


Pradip Pardeshi


On 11/2/2009 10:19:58 AM nagaraju said ..
HI Guys ,when iam Tryig TO Perform Restore with STSADM command my Top Level Site Was GOne.i ponted the URL to New Subsite.but TOp Level Site Is Replaced with the New Backdup FIle.please advice any Solution.

Thanks,


Nagaraju.


On 3/3/2010 12:25:54 PM hoogw said ..
If you plan on install templates in Windows Sharepoint Service (WSS) you will need the stsadm.exe, but it does not tell you the location of the tool. So the location is

c:\Program Files\common files\microsoft shared\web server extensions\12\bin

Along with other WSS tools


On 5/13/2010 10:00:28 AM Joe Mack said ..
I know this is old, but I am curious. I am unfamiliar with "last oh shit resort". Is that one of those technical terms? LMAO


On 6/18/2010 9:36:47 AM Peter said ..
You must be kidding - last resort!?!? Nightly SQL Backups should be your FIRST resort!! With offsite tape storage.

Using stsadm is useful for moving a site collection, or archiving a site collection, if yoiu'll be doing major modifications to a site.


On 6/18/2010 10:09:36 AM Sahil Malik said ..
Peter - see this - http://blah.winsmarts.com/2007-10-Backup_and_Restore_Strategies_in_MOSS_2007.aspx

What I meant above is, even though you do stsadm backups, they do not replace sql backups - you should do those anyway.

S


On 6/30/2010 4:58:57 AM Venkateswarlu said ..
If you want to take backup of sub site, don't go for stsadm instead you can use sharepoint designer backup option under site administration menu. Also restore that backup site by using designer only.


On 7/20/2010 1:20:44 PM Donna said ..
I just want to make sure I'm understanding this correctly. If I write a script to do the

Stsadm –o backup –url <SiteURL> -filename <FileName>

on a weekly basis, will it back up the content and the front end and things like workflows?

Thank you,


Donna


On 2/11/2011 1:44:00 AM Vishal Wattamwar (INDIA) said ..
Hi Friends;


First I have created web Application then using backup command I have restored .dat file then I deleted my content data base & I attached new connent data base(back up from production Envi.) but still it is showing me error & disturbed GUI.


My Application is in MOSS


Please suggest me.


Shall I add manually images or Shall I deploy webparts again??