Friday, August 13, 2010

SIMPLE BACKUP AND RESTORE OPERATIONS

One would think that SharePoint would prevent you from loading up a SharePoint backup on a new domain with conflicting SIDs and usernames, but it actually allows you to do so without too much grief. Your reason for this could be anything from simulations to test or duplicating a site or just about anything...I guess the reason is up to you but it invloves moving a site from one place to another.

Here’s How It's Done

Source Server

Login to the source server and run the following command:
stsadm -o backup -url "http://servername:port/sites/sitename" -filename "c:\foldername\sitename.bak"
This backs up the site to the specified destination folder.

Destination Server

Build out the destination server and run SharePoint configuration wizard, it is OK if you’ve already created a site collection on the target server because the new site will be overwritten by the -overwrite command below.
Warning – When you build out the new server you should try to build it using the same version and install all of the same Application Templates and binaries that were on the original server.

stsadm -o restore -url "http://servername:port/sites/sitename" -filename c:\foldername\sitename.bak" -overwrite

If you access the site immediately after restore here’s what you’ll see (if you restored it to a new domain)
image
Add a user via command line because the restored site will deny all of your login attempts (unless your server is on the same domain as the original source server.
stsadm -o siteowner -url "http://servername:port/sites/sitename" -ownerlogin domain\accountname


 OR
Using the Central Administration console, you will note that the site collection still references the original administrators which are now invalid on this new domain:
>> Central Administration >> Application Management >> Site Collection Administrators
image
Run the command below to change ownership:
stsadm -o siteowner -url "http://servername:port/sites/sitename" -ownerlogin domain\accountname
image
Now if you refresh Central Admin console you will see the new administrator as an owner, you can change the secondary administrator at this point as well.
image
Run the command below to add your new administrator to the site collection with the administrator role
stsadm -o adduser -url "http://servername:port/sites/sitename" -userlogin domain\accountname -useremail test@test.com -role administrator -username administrator
clip_image005
On the command prompt type IISRESET and execute.
Warning – Do not skip this step, you won’t be able to login until you run IISReset
clip_image006
Now you can refresh your main site and successfully login as the administrator.
Afterwards, you can optionally run this to clean up the old lingering logins explicitly
stsadm -o migrateuser -oldlogin olddomain\accountname -newlogin newdomain\accountname
That's all !

No comments:

Post a Comment